使用xinetd进行在线设备的访问控制

1. 在/etc/xinetd.d下创建文件ccagent,内容如下:

service ccagent
{
disable = no
flags = REUSE
type = UNLISTED
port = 9991
protocol = tcp
socket_type = stream
wait = no
user = root
redirect = 127.0.0.1 1988
log_type = SYSLOG daemon debug
log_on_success += DURATION HOST USERID TRAFFIC
}

###单机监控server绑定127.0.0.1,监听端口1988
2. 修改/etc/hosts.allow文件,加入访问控制:

ccagent : 192.168.2.143: allow
ccagent : ALL : deny
3. 在192.168.2.208上访问,可以看到访问被拒绝 /var/log/syslog

Aug 15 15:49:32 ldap xinetd[34959]: libwrap refused connection to ccagent (libwrap=ccagent) from 192.168.2.208
4. /etc/xinetd.conf 的内容

defaults
{

# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
log_type = SYSLOG daemon debug

}

includedir /etc/xinetd.d
5. 重启xinetd

service xinetd restart

你可能感兴趣的:(使用xinetd进行在线设备的访问控制)