首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >阻止用于验证uids的传出连接(root、apache、无人)

阻止用于验证uids的传出连接(root、apache、无人)
EN

Server Fault用户
提问于 2012-04-04 08:56:27
回答 1查看 2.4K关注 0票数 8

在CentOS 5和6 Linux中使用iptables --如何防止以root、apache或任何人的身份运行的进程启动传出连接?

在CentOS 5 Linux上,我尝试将这些行放入/etc/sysconfig/iptables中:

代码语言:javascript
复制
-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

但不幸的是,得到了错误:

代码语言:javascript
复制
# 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]
EN

回答 1

Server Fault用户

回答已采纳

发布于 2012-04-04 09:16:25

尝试使用数字UID而不是名称。例如:

代码语言:javascript
复制
-A OUTPUT -m owner --uid-owner 400 -j DROP

而不是

代码语言:javascript
复制
-A OUTPUT -m owner --uid-owner apache -j DROP

您可以通过键入

代码语言:javascript
复制
id user
票数 8
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/376568

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档