指定正确的服务名称:
现在知道了 TCP-Wrapper 的大致用法,那我们如何指定服务名称呢?其实这个问题不难,一般来说,只要是被 xinetd 所控制的服务,大约都是使用
TCP-Wrapper 机制;其它的服务像是 vsftpd、ssh 等,也是使用 TCP-Wrapper 的机制。
如果是被 xinetd 所控制的服务,可以到 /etc/xinetd.d 看看真正的服务名称。
[root@xml root]# cd /etc/xinetd.d [root@xml xinetd.d]# ls chargen daytime-udp finger ipop2 pop3s rsh services telnet chargen-udp echo imap ipop3 rexec rsync sgi_fam time
daytime echo-udp imaps ntalk rlogin servers talk time-udp
[root@xml xinetd.d]#
假设现在要设定 ipop3,那么我们知道这个服务是被 xinetd 所控制,所以就来看看 ipop3 这个真正的服务者是谁!
[root@xml xinetd.d]# cat ipop3 # default: off # description: The POP3 service allows remote users to access their mail \
# using an POP3 client such as Netscape Communicator, mutt, \
# or fetchmail.
service pop3
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/ipop3d
log_on_success += HOST DURATION
log_on_failure += HOST
}
[root@xml xinetd.d]#
在上面有 server = /usr/sbin/ipop3d 这个字样,所以我们就可以知道,真正付责
ipop3 是由 ipop3d 这个程式来跑的,所以我们在 hosts.allow 或 hosts.deny 设定服务名称时,请记得要写成
ipop3d,而不是 ipop3 喔!
[root@xml xinetd.d]# vi /etc/hosts.deny
______________________________________________________________________
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the ′/usr/sbin/tcpd′ server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
ipop3d:ALL EXCEPT .eic.com.tw
:______________________________________________________________________
如果是非由 xinetd 所控制的服务,如 ssh 或是 vsftpd 等,就直接指定他们的服务名称就可以了!
