首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >/etc/hosts.allow .中的EXCEPTed服务

/etc/hosts.allow .中的EXCEPTed服务
EN

Server Fault用户
提问于 2009-07-29 14:52:19
回答 2查看 488关注 0票数 0

例如/etc/hosts.ALL包含以下内容:

代码语言:javascript
复制
ALL EXCEPT in.telnetd : foo.example.com

有人告诉我,如果foo.example.com试图将网络传输到这个系统中,那么连接将被拒绝,因为除了连接,hosts.deny也不会被检查。

但是系统不需要检查hosts.deny吗?我的理解是,hosts.allow本身不能导致任何连接被拒绝;只有hosts.deny才能做到这一点。

所以我很困惑。我是不是误会了什么?

EN

回答 2

Server Fault用户

发布于 2009-07-29 15:10:09

在这种情况下,我认为你是对的。

默认拒绝情况下的man 5 host_access示例要求/etc/hosts.deny文件具有

代码语言:javascript
复制
ALL : ALL

为了使EXCEPT规则在/etc/hosts.allow中工作。

也来自手册页:

代码语言:javascript
复制
   o      Access  will  be  granted when a (daemon,client) pair matches an
          entry in the /etc/hosts.allow file.

   o      Otherwise, access will be denied  when  a  (daemon,client)  pair
          matches an entry in the /etc/hosts.deny file.

   o      Otherwise, access will be granted.

因此,在您的示例中,主机将不匹配/etc/hosts.allow中的任何条目,然后在/etc/hosts.deny中不匹配任何条目,因此根据第三条规则将被允许。这就是为什么您需要在ALL : ALL中使用/etc/hosts.deny条目,以便应用第二条规则。

票数 4
EN

Server Fault用户

发布于 2009-07-29 15:14:02

还请记住,/etc/hosts.low和/etc/hosts.deny只影响通过inetd或xinetd运行的守护进程,而不仅仅是任何(非常常见的错误)。

票数 3
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/47588

复制
相关文章

相似问题

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