安装使用Func一些总结

1  关于Func
func全称 Fedora Unified Network Controller ,主要用在Radhat, Fedora,OpenSuse,Centos系列系统上由一个server管理任意台服务器的工具,建立了Master-Slaves 主从SSL证书管控体系,可以将证书自动分发到所有受控服务.func直接发送远程命令或者远程获取数据,但是只适用于一些常用功能的模块的操作,实现其它功能需要自己写Python API,个人认为没有使用比较适当的”for do done”循环程序效果明确和方便.

2  安装配置:
1  master端:

#yum install func
#chkconfig --level 345 certmaster on && service certmaster start
查看默认监听端口:
[root@server ~]# netstat -tunlp|grep 51235
tcp        0      0 0.0.0.0:51235               0.0.0.0:*                   LISTEN      9381/python
2  Minions端,也就是被控端:

#yum install func
修改配置文件:
#vi /etc/certmaster/minion.conf
[main]
certmaster = master.dongwm.com //master端的域名
certmaster_port = 51235   //默认的监听端口
log_level = DEBUG
cert_dir = /etc/pki/certmaster
#chkconfig –level 345 funcd on && service funcd start
[/cceW_bash]
验证证书:

在master端:
#certmaster-ca --list   //等待验证的主机列表
client.dongwm.com
#certmaster-ca --sign   client.dongwm.com// 同意客户端验证
3  进行一些操作:
语法:

func "想要操作的服务器或者服务器组的名字,支持正则" call 想要操作的模块及选项
以下操作

# func "*.dongwm.com" call disk usage boot  //表达查看所有dongwm.com组(域)服务器的/boot分区情况
{'client.dongwm.com': {'/boot': {'available': '159177',
'device': '/dev/sda1',
'percentage': 14,
'total': '194442',
'used': '25226'}}}
4 其它一些内容(转载)

1  删除客户端主机

certmaster-ca -c hostname

rm /var/lib/certmaster/certmaster/certs/hostname.cert
2  一些常用模块使用命令:

2.1 CommandModule 模块
格式:
func hostname call command run command
2.2ServiceModule 模块
格式:
Func hostname call service start/stop/restart servername
2.3. HardwareModule 模块
格式:
func hostname call hardware info
如果不能执行一般是因为 smolt 没有安装
2.4 IPtablesModule 模块
格式:
func hostname call iptables command
例:
func “ssh-1″ call iptables policy func “ssh-1″ call iptables dump func “ssh-1″ call iptables.port drop_to 53 192.168.0.0/24 udp src
func ’ssh-1′ call iptables run “-L INPUT” func ’ssh-1′ call iptables policy OUTPUT DROP func ’ssh-1′ call iptables drop_from 192.168.0.10
格式: Func hostname call command run command
例: func ’ssh-1′ call command run ‘iptables -A INPUT -s 192.168.239.233 -j DROP’
2.5. JBossModule 模块
格式:
func hostname call jboss command
例:
func “*” call jboss status
func “*” call jboss check
func “*” call jboss search_by_instance “default“
func “*” call jboss search_by_address “127.0.0.1“
func “*” call jboss search_by_port 8080
2.6 ProcessModule 模块
格式:
Func hostname call process command
例:
func ssh-1 call process info “aux”
func ssh-1 call process mem
func ssh-1 call process kill httpd SIGHUP
2.7 SysctlModule 模块
格式:
Func hostname call sysctl command
例:
func ssh-1 call sysctl list
func “*” call sysctl get <parameter> func “*” call sysctl set <parameter> <value>
func ssh-1 call sysctl set net.ipv4.tcp_syncookies 1
2.8 RpmModule模块 ( =rpm –qa )
func ssh-1 call rpms inventory
2.9 SmartModule模块 ( 看硬盘信息 )
func ssh-1 call smart info
2.10YumModule模块
func ssh-1 call yumcmd update
func ssh-1 call command run ‘yum update’

猜你喜欢

转载自duanll.iteye.com/blog/1323055