Func简介:
- master.laoguang.me 192.168.1.22
- slave1.laogunag.me 192.168.1.23
- slave2.laoguang.me 192.168.1.24
- echo "
- 192.168.1.22 master.laoguang.me master
- 192.168.1.23 slave1.laogunag.me slave1
- 192.168.1.24 slave2.laoguang.me slave2 " >> /etc/hosts
- scp /etc/hosts slave1:/etc/
- scp /etc/hosts slave2:/etc/
- yum -y install ntp
- ntpdate ntp.api.bz
- Python-2.5.2.tgz ##func就是Python写的
- wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz
- pyOpenSSL-0.9.tar.gz ##加密模块
- wget http://jaist.dl.sourceforge.net/project/pyopenssl/pyopenssl/0.9/pyOpenSSL-0.9.tar.gz
- func-0.28.tar.gz ##func
- wget https://fedorahosted.org/releases/f/u/func/func-0.28.tar.gz
- certmaster-0.28.tar.gz ##它来发证加密通信
- wget https://fedorahosted.org/releases/c/e/certmaster/certmaster-0.28.tar.gz
- yum -y install gdbm-devel
- tar xvf Python-2.5.2.tgz
- cd Python-2.5.2
- ./configure
- make && make install
- tar xvf pyOpenSSL-0.9.tar.gz
- cd pyOpenSSL-0.9
- python setup.py install
- tar xvf certmaster-0.28.tar.gz
- cd certmaster-0.28
- python setup.py install
- tar xvf func-0.28.tar.gz
- cd func-0.28
- python setup.py install
- ln -s /usr/local/bin/certmaster /usr/bin/certmaster
- ln -s /usr/local/bin/certmaster-request /usr/bin/certmaster-request
- ln -s /usr/local/bin/certmaster-ca /usr/bin/certmaster-ca
- ln -s /usr/local/bin/certmaster-sync /usr/bin/certmaster-sync
- ln -s /usr/local/bin/funcd /usr/bin/funcd
- ln -s /usr/local/bin/func /usr/bin/func
- ln -s /usr/local/bin/func-create-module /usr/bin/func-create-module
- ln -s /usr/local/bin/func-inventory /usr/bin/func-inventory
- ln -s /usr/local/bin/func-transmit /usr/bin/func-transmit
- ln -s /usr/local/bin/func-build-map /usr/bin/func-build-map
- cat /etc/certmaster/certmaster.conf
- # configuration for certmasterd and certmaster-ca
- [main]
- autosign = no ##这也可以修改为自动签名,我们先手动来签吧
- listen_addr =
- listen_port = 51235
- cadir = /etc/pki/certmaster/ca
- cert_dir = /etc/pki/certmaster
- certroot = /var/lib/certmaster/certmaster/certs
- csrroot = /var/lib/certmaster/certmaster/csrs
- certcert_extension = cert
- sync_certs = False
- cat /etc/certmaster/minion.conf
- # configuration for minions
- [main]
- certmastercertmaster = certmaster
- certmaster_port = 51235
- log_level = DEBUG
- cert_dir = /etc/pki/certmaster
- cat /etc/func/minion.conf
- # configuration for minions
- [main]
- log_level = INFO
- acl_dir = /etc/func/minion-acl.d
- listen_addr =
- listen_port = 51234
- minion_name =
- method_log_dir = /var/log/func/methods/
- vim /etc/certmaster/minion.conf
- [main]
- certmaster = master.laoguang.me ##改为master的地址或域名
- certmaster_port = 51235
- log_level = DEBUG
- cert_dir = /etc/pki/certmaster
- master: service certmaster start
- slave1,slave2: service funcd start
- netstat -tlnp | grep python ##服务器端,51235是certmaster监听的
- tcp 0 0 0.0.0.0:51235 0.0.0.0:* LISTEN 43613/python
- netstat -tlnp | grep python ##客户端,python也就是func没有监听端口,等签证后就
- [root@master ~]# certmaster-ca --list
- slave1.laogunag.me
- slave2.laoguang.me
- certmaster-ca --sign "slave1.laoguang.me"
- certmaster-ca --sign "slave2.laoguang.me"
- [root@master ~]# certmaster-ca --list-signed
- slave1.laoguang.me
- slave2.laoguang.me
- certmaster-ca --clean "slave1.laoguang.me"
- ##删除后再把它加进来哦,slave1删除/etc/pki/certmaster下的slave1开头的文件,重启funcd,服务器端会发现
- func 'slave1.laoguang.me' call command run 'ifconfig eth0'
- func 'slave2.laoguang.me' call service restart 'sshd'
- func '*' ping
- func slave1.laoguang.me call process mem
- func slave2.laoguang.me call sysctl list
- func slave1.laoguang.me call sysctl get net.ipv4.ip_forward
- vim /etc/func/groups
- [slave]
- host = slave1.laoguang.me,slave2.laoguang.me
- func '@slave' ping