说/etc/hosts.allow包含这个:
ALL EXCEPT in.telnetd : foo.example.com
有人告诉我,如果foo.example.com试图telnet到这个系统,连接将被拒绝,因为EXCEPT,并且hosts.deny不会被检查。
但是系统不需要检查hosts.deny? 我的理解是hosts.allow本身不能导致任何连接被拒绝; 只有hosts.deny可以做到这一点。
所以我很困惑。 我误解了什么?
我认为你在这种情况下是正确的。
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.allow中的任何条目,所以根据第三条规则将被允许。 这就是为什么您需要/etc/hosts.deny的ALL : ALL条目,以便适用第二条规则。
还要记住/etc/hosts.allow和/etc/hosts.deny只影响通过inetd或xinetd运行的守护进程,而不仅仅是任何(很常见的错误)