例如/etc/hosts.ALL包含以下内容:
ALL EXCEPT in.telnetd : foo.example.com有人告诉我,如果foo.example.com试图将网络传输到这个系统中,那么连接将被拒绝,因为除了连接,hosts.deny也不会被检查。
但是系统不需要检查hosts.deny吗?我的理解是,hosts.allow本身不能导致任何连接被拒绝;只有hosts.deny才能做到这一点。
所以我很困惑。我是不是误会了什么?
发布于 2009-07-29 15:10:09
在这种情况下,我认为你是对的。
默认拒绝情况下的man 5 host_access示例要求/etc/hosts.deny文件具有
ALL : ALL为了使EXCEPT规则在/etc/hosts.allow中工作。
也来自手册页:
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条目,以便应用第二条规则。
发布于 2009-07-29 15:14:02
还请记住,/etc/hosts.low和/etc/hosts.deny只影响通过inetd或xinetd运行的守护进程,而不仅仅是任何(非常常见的错误)。
https://serverfault.com/questions/47588
复制相似问题