对于能过xinetd程序启动的网络服务,好比ftp telnet,咱们就能够修改/etc/hosts.allow和/etc/hosts.deny的配置,来许可或者拒绝哪些IP、主机、用户能够访问。
好比咱们在 /etc/hosts.allow中加入
all:218.24.129.
这样就会容许来自218.24.129.*域的全部的客户来访问。这只是举个例子,实际上,系统默认状态 下,都是能用这些网络服的
若是咱们在 /etc/hosts.deny中加入,就限制了来自218.24.129.*域的全部的全部的IP。
all:218.24.129.
若是咱们在 /etc/hosts.deny中加入
all:218.24.129.134,这样就限制了全部在218.24.129.134中的全部的用户的访问。
当hosts.allow和 host.deny相冲突时,以hosts.allow设置优化。
设置好后,要从新启动
# /etc/rc.d/init.d/xinetd restart
# /etc/rc.d/init.d/network restart网络
不是任何服务程序都能使用TCP_wrappers的,例如使用命令ldd /usr/sbin/sshd,若是输出中有libwrap,则说明能够使用TCP_wrappers, 即该服务能够使用/etc/hosts.allow和/etc/hosts.deny,若是输出没有libwrap则不可以使用app