centos – 阻止认证uid的传出连接(root,apache,nobody)

使用CentOS 5和6 Linux中的iptables – 如何防止以root用户,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

您可以通过键入找到UID

id user

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native