func (fedora Unified Network Controller) 统一网络控制器。这个工具我安装了一周。个人能力+时间不集中 导致时间这么长。功夫不负有心人啊,下面把几个重要的点提一下:

   官方文档要求是 Linux 2.6或更高, PYthon2.5及以上。安装文档一般都是 yum install,除了在介绍AIX安装的时候使用源码(而且很旧)外,都是yum instal不齐全。对于ubuntu 只能摸着石头过河。 

   对于python是使用源码安装,还是本身自带的python,这个很重要,因为。func所使用的模块存储位置是不一样的。对比 centos 的结果得出。

   我的环境:  

   Ubuntu 11.10

   内核  3.2

   python 2.7.3 (系统自带)(我参考其他文档,python都是源码安装,所以可能由于模块包的位置不一致才导致我这边的问题)

   大致安装步骤:

   wget https://fedorahosted.org/releases/f/u/func/func-0.28.tar.gz
   wget https://fedorahosted.org/releases/c/e/certmaster/certmaster-0.28.tar.gz
   wget http://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.13.tar.gz#md5=767bca18a71178ca353dff9e10941929

   对于 pyOpenSSL 必须选择0.13,而不是稳定指出的0.9 ,否则的话会提示:

   ImportError: /usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.so: undefined symbol: SSLv2_method

   软件依赖包处理:

   apt-get install swig -y
   apt-get install python-m2crypto -y
   apt-get install python-dev -y
   apt-get install smolt*

   以上文件的安装 全部是: 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

   修改/etc/init.d/certmaster 中的第28 行为:PROCESS=/usr/local/bin/certmaster

   在master端 和slave端,/etc/hosts 都添加上自己和对方的ip  和 hostname

   master配置:

   cat /etc/certmaster/certmaster.conf  (该文件不需要修改)
   # configuration for certmasterd and certmaster-ca
   [main]
   autosign = no
   listen_addr = 
   listen_port = 51235  # certmaster 通讯端口
   cadir = /etc/pki/certmaster/ca
   cert_dir = /etc/pki/certmaster
   certroot = /var/lib/certmaster/certmaster/certs
   csrroot = /var/lib/certmaster/certmaster/csrs
   cert_extension = cert
   sync_certs = False
   cat /etc/certmaster/minion.conf 
   # configuration for minions
   [main]
   certmaster = 10-4-6-190 (写入master的hostname, 先在/etc/hosts注明)
   certmaster_port = 51235 (slave 端与master端 证书通讯端口)
   log_level = DEBUG
   cert_dir = /etc/pki/certmaster

 slave配置:

   /etc/certmaster/certmaster.conf 与master保持一致
   /etc/certmaster/minion.conf 
   # configuration for minions
   [main]
   certmaster = 10-4-6-190 (写入master的hostname, 先在/etc/hosts注明)
   certmaster_port = 51235 (slave 端与master端 证书通讯端口)
   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 (func 通讯端口)
   minion_name = 10-4-1-109 (写上minion的hostname)
   method_log_dir = /var/log/func/methods/

对于ubuntu,python module与centos 的位置不一致,做软连接

ln -s /usr/local/lib/python2.7/dist-packages/  /usr/lib/python2.7/site-packages
ln -s //usr/local/lib/python2.7/dist-packages/func  /usr/lib/python2.7/dist-packages/func

 启动服务:

 master: service  certmaster start

 slave:   service funcd start ;service certmaster start

 slave端向master 申请证书:

 master端: certmaster-ca  --list  可以查看请求证书的slave的ip:

            certmaster-ca -s  hostname  对slave发布证书。

           (快速发布证书的的方式:certmaster-ca -s $(certmaster-ca  --list))

 证书申请完毕后,简单测试:

 func '*' ping 
[ ok ... ] 10-4-6-190
[ ok ... ] 10-4-3-65
[ ok ... ] localhost
[ ok ... ] 10-4-1-109

安装常见问题:

1、对于certmaster-ca  --list 无法查看slave 证书请求信息。

   /etc/hosts 必须添加master和slave的信息

   查看双方是否ping 通

   防火墙设置

   telnet  ip  51234/51235 进行排查

   如果是第二次重新申请证书的话,删除slave的证书位置:/etc/pki/certmaster/*(不要删除该目录下的ca目录),/var/lib/certmaster/certmaster/csrs,/var/lib/certmaster/certmaster/certs

2、错误提示

ImportError: /usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.so: undefined symbol: SSLv2_method

   下载 pyOpenSSL 必须选择0.13,不能是0.9版本

3、func '*' ping 没有任何

   在下也碰到这个问题,

   在python idle中,编写模块,提示:func.minion.codes.ModuleNotFoundException

   ln -s /usr/local/lib/python2.7/dist-packages/  /usr/lib/python2.7/site-packages
   ln -s //usr/local/lib/python2.7/dist-packages/func  /usr/lib/python2.7/dist-packages/func

   该解决方法是参考,在centos服务器上的位置,设置的。

   centos 里面是 :
   /etc/certmaster/
   /etc/func/
   /etc/pki/certmaster/
   /var/lib/certmaster/
   modules
   /usr/lib/python2.4/site-packages/func/overlord/
   /usr/lib/python2.4/site-packages/func/overlod/cmd_modues/

4、master和 slave能ping通,certmaster和funcd双方没有错误信息;

   但: func '*' ping 总显示 Failed

   func '*' call system list_modules 发现不能加载任何的modules。

   解决方法:


 

 
  

5、如果安装无误的话, ping 显示错误的话,那么试着在master端 进行: certmaster-ca -c hostname, 在slave端 删除相应的验证文件!

后期文章会为大家带来具体使用过程!

有什么问题可以随时联系我,留言,weibo:@光年weipengfei  QQ 1085769773