在CentOS 5和6 Linux中使用iptables – 你怎么能防止进程作为根 , Apache或没有人启动传出连接?
在CentOS 5 Linux上我试过把这些行放到/ etc / sysconfig / iptables中:
-A OUTPUT -m owner --uid-owner root -j DROP -A OUTPUT -m owner --uid-owner apache -j DROP -A OUTPUT -m owner --uid-owner nobody -j DROP
但不幸的是得到的错误:
# sudo service iptables restart iptables: Flushing firewall rules: [ OK ] iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Unloading modules: [ OK ] iptables: Applying firewall rules: iptables-restore v1.4.7: owner: Bad value for "--uid-owner" option: "apache" Error occurred at line: 27 Try `iptables-restore -h' or 'iptables-restore --help' for more information. [FAILED]
尝试使用数字UID而不是名称。 铁:
-A OUTPUT -m owner --uid-owner 400 -j DROP
代替
-A OUTPUT -m owner --uid-owner apache -j DROP
你可以通过inputfinduid
id user