Skip to content

Instantly share code, notes, and snippets.

{"title":"Torque","services":{"query":{"list":{"0":{"query":"*","alias":"","color":"#7EB26D","id":0,"pin":false,"type":"lucene","enable":true}},"ids":[0]},"filter":{"list":{},"ids":[]}},"rows":[{"title":"NoJobs","height":"150px","editable":true,"collapse":false,"collapsable":true,"panels":[{"error":false,"span":4,"editable":true,"type":"terms","loadingEditor":false,"field":"user","exclude":[],"missing":false,"other":true,"size":15,"order":"count","style":{"font-size":"10pt"},"donut":false,"tilt":false,"labels":true,"arrangement":"horizontal","chart":"table","counter_pos":"above","spyable":true,"queries":{"mode":"all","ids":[0]},"tmode":"terms","tstat":"total","valuefield":"","title":"JobsByUser"},{"error":false,"span":4,"editable":true,"type":"terms","loadingEditor":false,"field":"user","exclude":[],"missing":false,"other":true,"size":20,"order":"count","style":{"font-size":"10pt"},"donut":false,"tilt":false,"labels":true,"arrangement":"horizontal","chart":"pie","counter_pos":"above","spyable":true,"queries":

download and compile pam-python-1.0.4 (http://pam-python.sourceforge.net/) on CentOS

(python-pam is a pam client, NOT to write pam modules)

Put everything under /lib64/security, such as pam_python.so, and python pam scripts, e.g. pam_permit.py

Here is a test script. It allows you to log in as test1 with password '11'. (User test1 needs to exist on the host.) Some output will be written to /var/log/secure.

#
# Duplicates pam_permit.c
@shundezhang
shundezhang / gist:322743e77e0ebaa65d6f
Last active December 23, 2015 06:06
openstack puppet all-in-one on centos 7
yum upgrade -y centos-release
yum install -y git gcc-c++ python-devel
https://github.com/openstack/puppet-openstack-integration
git clone git://git.openstack.org/openstack/puppet-openstack-integration
cd puppet-openstack-integration
./all-in-one.sh
@shundezhang
shundezhang / ceph-disk-list.sh
Created July 9, 2019 01:57
ceph disk list for ceph nautilus
#!/bin/bash
# run "ceph-volume simple scan" to generate OSD json files, these files will be placed in /etc/ceph/osd/
JSON_PATH="/etc/ceph/osd/"
for i in `ls $JSON_PATH`; do
OSD_ID=`cat $JSON_PATH$i | jq '.whoami'`
DATA_PATH=`cat $JSON_PATH$i | jq -r '.data.path'`
DB_PATH=`cat $JSON_PATH$i | jq -r '."block.db".path'`
WAL_PATH=`cat $JSON_PATH$i | jq -r '."block.wal".path'`
echo "OSD.$OSD_ID: $DATA_PATH"
# Generated by iptables-save v1.4.21 on Mon Feb 6 13:03:28 2017
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -s 10.10.10.0/24 -p tcp -m multiport --dports 5671,5672,15672 -m comment --comment "001 amqp incoming amqp_10.10.10.51" -j ACCEPT
-A INPUT -p tcp -m multiport --dports 8042 -m comment --comment "001 aodh-api incoming aodh_api" -j ACCEPT
-A INPUT -p tcp -m multiport --dports 8777 -m comment --comment "001 ceilometer-api incoming ceilometer_api" -j ACCEPT
-A INPUT -s 10.10.10.0/24 -p tcp -m multiport --dports 3260 -m comment --comment "001 cinder incoming cinder_10.10.10.53" -j ACCEPT
-A INPUT -p tcp -m multiport --dports 8776 -m comment --comment "001 cinder-api incoming cinder_api" -j ACCEPT
@shundezhang
shundezhang / 0-charmed-k8s-docker-calico-openstack
Last active July 20, 2020 06:55
use juju to deploy charmed k8s with docker, calico and openstack integration
juju deploy ./bundle.yaml --overlay openstack-overlay.yaml --trust --overlay calico-overlay.yaml
@shundezhang
shundezhang / 0pyudev-query.py
Last active March 2, 2021 04:03
pyudev-example
import pyudev
# install pyudev
# apt install python3-pyudev
context = pyudev.Context()
for device in context.list_devices(subsystem="block"):
if device.device_type == u"disk":
property_dict = dict(device.items())
if ('ID_MODEL' in property_dict):