![不应用 Linux ports.deny 设置](https://linux22.com/image/41404/%E4%B8%8D%E5%BA%94%E7%94%A8%20Linux%20ports.deny%20%E8%AE%BE%E7%BD%AE.png)
我想让我的计算机上无法访问许多网站。
我的hosts.allow
文件:
sendmail: all
# /etc/hosts.allow: list of hosts that are allowed to access the system.
# See the manual pages hosts_access(5) and hosts_options(5).
#
# Example: ALL: LOCAL @some_netgroup
# ALL: .foobar.edu EXCEPT terminalserver.foobar.edu
#
# If you're going to protect the portmapper use the name "rpcbind" for the
# daemon name. See rpcbind(8) and rpc.mountd(8) for further information.
我的hosts.deny
文件:
# /etc/hosts.deny: list of hosts that are allowed to access the system.
# See the manual pages hosts_access(5) and hosts_options(5).
#
# Example: ALL: some.host.name, .some.domain
# ALL EXCEPT in.fingerd: other.host.name, .other.domain
#
# If you're going to protect the portmapper use the name "rpcbind" for the
# daemon name. See rpcbind(8) and rpc.mountd(8) for further information.
#
# The PARANOID wildcard matches any host whose name does not match its
# address.
#
# You may wish to enable this to ensure any programs that don't
# validate looked up hostnames still leave understandable logs. In past
# versions of Debian this has been the default.
# ALL: PARANOID
ALL: .vk.com
ALL: .ria.ru
ALL: facebook.com
我的hosts
文件:
127.0.0.1 localhost
127.0.0.1:82 testsecond
127.0.1.1 shc
127.0.2.2:81 someth.com
127.0.2.2:83 test
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe02::1 ip6-allnodes
fe02::2 ip6-allrouters
我确实遵循有关设置主机*文件的所有建议,并且我仍然可以访问它们。我必须做一些非常愚蠢或错误的事情。
对我来说,他们似乎被忽视了。
答案1
hosts.deny
用于服务器,不是您的计算机上运行的客户端,因此您无法使用它来阻止网站。我建议阅读hosts_access(5)
系统的手册页(德班版本,自由BSD版本)。
顺便说一下,Lennart Poettering 有一个提案摆脱 tcpwrappers/tcpd在 Fedora 和开放SSH也会做同样的事情。