工作在第四层(传输层)的TCP协议
对有状态连接的特定服务进行安全检测并实现访问控制
以库文件形式实现
某进程是否接受libwrap的控制取决于发起此进程的程序在编译时是否针对libwrap进行编译的
1 | $ ldd /PATH/TO/PROGRAM|grep libwrap.so |
配置文件
/etc/hosts.allow,/etc/hosts.deny
检查顺序
1 | hosts.allow,hosts.deny(默认允许) |
基本语法
daemon_list@hosts:client_list [:options:option…]
[:options]选项
1 | deny:主要用来在/etc/hosts.allow文件中定义"拒绝"规则 |
spawn使用示例
1 | $ cat /etc/hosts.allow |
说明:
在/etc/hosts.allow中添加,允许登录并记录日志
在/etc/hosts.deny中添加,拒绝登陆并记录日志
%c 客户端信息
%s 服务器端信息
%d 服务名
%p 守护进程的PID
%% 表示%
twist使用示例
1 | $ [root@node01 ~]#sed -n '/^[^#]/p' /etc/hosts.allow |
daemon_list@host格式
1 | 单个应用程序的二进制文件名,而非服务名,例如vsftpd |
client_list选项
1 | 对哪些主机生效定义的规则,可以是地址段 |
测试工具
1 | tcpdmatch [-d] daemon[@host] client |
-d 测试当前目录下的hosts.allow和hosts.deny规则是否生效