从LDAP记录生成IPset和IPTables规则的客户端库。
libnfldap的Python项目详细描述
从ldap记录生成iptables和ipset规则的python模块。 有关演示,请参见example.py。
安装
使用pypi:
$ sudo pip install libnfldap
或者使用:
$ python setup.py bdist_rpm
后者将包含python ldap的RPM依赖项。
示例
位于example_allusers.py的脚本将为所有人构建iptables和ipset规则 LDAP中的用户。您可以向脚本提供一个LDAP过滤器作为argv[1],以限制 范围。
$ time python example_allusers.py '(uid=jvehent)' IPTables rules written in /tmp/tmpT7JgOW IPSet rules written in /tmp/tmpJYtWM5 real 0m0.605s user 0m0.061s sys 0m0.014s
example.py做了一些类似的事情,但是对于一个通过 uidnumber(Unix用户ID)。
$ python example.py 2297#Generating rules for user ID 1664 #====== ACL details ====== jvehent has access to .....