Linux下tcpwrappers防火墙介绍

tcpwrappers(防火墙) --过滤TCP包头(/usr/sbin/tcpd)

/etc/hosts.allow 允许
/etc/hosts.deny 拒绝

匹配顺序 tcp包头----<wrappers.so> ------- /etc/hosts.allow ------- /etc/hosts.deny

匹配规则< 规则马上写,触发的时候,立刻生效>
1.先匹配/etc/hosts.allow,如果匹配到相应的规则,则允许匹配到此结束
2.在匹配/etc/hosts.deny,如果匹配到相应的规则,则拒绝匹配到此结束
3.如果2个文件都没有匹配,则允许

过滤依据 包含TCP协议服务 <xinetd/rpcbind|portmap/vsftpd/samba/httpd/sshd/postfix>
ldd /usr/sbin/vsftpd |grep libwrap
ldd /sbin/rpcbind |grep wrap
strings /usr/sbin/smbd |grep access

1.拒绝192.168.0.254 通过sshd远程登录
vim /etc/hosts.deny
#二进制名称: HOST
sshd: 192.168.0.x

ssh 192.168.0.1
ssh_exchange_identification: Connection closed by remote host — 被tcpwrappers拒绝

设置规则:
1.telnet只有192.168.0.2|192.168.0.254能访问
2.vsftpd192.168.0.0/24都能访问,除192.168.0.254
3.sshd 192.168.0.254,只要有登录则发邮件告知管理员
4.本机能够访问这三个服务.

先拒绝所有,然后在一个个开放
先在/etc/hosts.deny 拒绝所有,然后在/etc/hosts.allow 逐个允许

spawn 触发按钮执行shell终端动作
LOCAL 本地所有的tcp服务
EXCEPT 除了
ALL

vim /etc/hosts.deny
ALL : ALL

vim /etc/hosts.allow
in.telnetd: 192.168.0.254,192.168.0.2 --注意’二进制名称’
vsftpd: 192.168.0.0/255.255.255.0 EXCEPT 192.168.0.254 --注意’子网掩码要写全>称’
或者 vsftpd: 192.168.0. | vsftpd: .example.com
sshd: 192.168.0.254 : spawn echo “%c正在登录%s” | mail -s “%d login” u02@qq.com
ALL: LOCAL

相关推荐

  1. Linuxtcpwrappers防火墙介绍

    2024-06-09 10:28:02       7 阅读
  2. 美国Linux服务器的iptables防火墙介绍

    2024-06-09 10:28:02       40 阅读
  3. 深入了解linux网卡防火墙selinux

    2024-06-09 10:28:02       39 阅读
  4. Linux防火墙相关命令整理【转】

    2024-06-09 10:28:02       28 阅读
  5. 深入浅出 iptables - Linux的强大防火墙工具

    2024-06-09 10:28:02       12 阅读
  6. linux防火墙

    2024-06-09 10:28:02       4 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-09 10:28:02       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-09 10:28:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-09 10:28:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-09 10:28:02       18 阅读

热门阅读

  1. Mysql的脏读、幻读、不可重复读

    2024-06-09 10:28:02       7 阅读
  2. PCL 指数函数回归(二维)

    2024-06-09 10:28:02       6 阅读
  3. Stable Diffusion之最全详解图解

    2024-06-09 10:28:02       6 阅读
  4. 频率域,空间域以及频率域和空间域如何获取

    2024-06-09 10:28:02       9 阅读
  5. vue 创建一个新项目 以及 手动配置选项

    2024-06-09 10:28:02       6 阅读
  6. 匹配算法 python

    2024-06-09 10:28:02       5 阅读
  7. 学习分享-断路器Hystrix与Sentinel的区别

    2024-06-09 10:28:02       9 阅读
  8. AdminController

    2024-06-09 10:28:02       6 阅读
  9. CMake学习记录

    2024-06-09 10:28:02       8 阅读