服务的访问控制列表

服务的访问控制列表

TCP Wrapper是RHEL 6/7系统中默认启用的一款流量监控程序,它能够根据来访主机的地址与本机的目标服务程序做出允许或拒绝的操作在,RHEL 8版本中,它已经被firewalld正式替代

Linux系统中其实有两个层面的防火墙,第一种是前面讲到的基于TCP/IP协议的流量过滤工具,而TCP Wrapper服务则是能允许或禁止Linux系统提供服务的防火墙,从而在更高层面保护了Linux系统的安全运行

TCP Wrapper服务的防火墙策略由两个控制列表文件所控制,用户可以编辑允许控制列表文件来放行对服务的请求流量,也可以编辑拒绝控制列表文件来阻止对服务的请求流量。控制列表文件修改后会立即生效,系统将会先检查允许控制列表文件(/etc/hosts.allow),如果匹配到相应的允许策略则放行流量;如果没有匹配,则会进一步匹配拒绝控制列表文件(/etc/hosts.deny),若找到匹配项则拒绝该流量。如果这两个文件都没有匹配到,则默认放行流量

RHEL8版本中已不再支持TCP Wrappers服务程序

在这里插入图片描述
在这里插入图片描述
优先级

  1. /etc/hosts.allow:允许服务
  2. /etc/hosts.deny:拒绝服务

下面编写拒绝策略规则文件,禁止访问本机sshd服务的所有流量(无须修改/etc/hosts.deny文件中原有的注释信息)

[root@xiudaochengxian ~]# vim /etc/hosts.deny 
  1 #
  2 # hosts.deny    This file contains access rules which are     used to
  3 #               deny connections to network services that     either use
  4 #               the tcp_wrappers library or that have been
  5 #               started through a tcp_wrappers-enabled xin    etd.
  6 #
  7 #               The rules in this file can also be set up     in
  8 #               /etc/hosts.allow with a 'deny' option inst    ead.
  9 #
 10 #               See 'man 5 hosts_options' and 'man 5 hosts    _access'
 11 #               for information on rule syntax.
 12 #               See 'man tcpd' for information on tcp_wrap    pers
 13 #
 14 sshd:*
[root@xiudaochengxian ~]# ssh 192.168.1.105
ssh_exchange_identification: read: Connection reset by peer

在允许策略规则文件中添加一条规则,使其放行源自192.168.1.0/24网段,且访问本机sshd服务的所有流量。可以看到,服务器立刻就放行了访问sshd服务的流量,效果非常直观

[root@xiudaochengxian ~]# vim /etc/hosts.allow 
  1 #
  2 # hosts.allow   This file contains access rules which are     used to
  3 #               allow or deny connections to network servi    ces that
  4 #               either use the tcp_wrappers library or tha    t have been
  5 #               started through a tcp_wrappers-enabled xin    etd.
  6 #
  7 #               See 'man 5 hosts_options' and 'man 5 hosts    _access'
  8 #               for information on rule syntax.
  9 #               See 'man tcpd' for information on tcp_wrap    pers
 10 #
 11 sshd:192.168.1.
[root@xiudaochengxian ~]#ssh 192.168.1.105
The authenticity of host '192.168.1.105 (192.168.1.105)' can't be established.
ECDSA key fingerprint is SHA256:fiTPucRYLsdfDkT9bK7g3AeAnFjAqT8LkjNJZZZY4yQ.
ECDSA key fingerprint is MD5:1c:2c:f3:b7:69:89:5a:6c:38:d2:2c:7f:5c:8d:a6:78.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.105' (ECDSA) to the list of known hosts.
root@192.168.1.105's password: 
Last login: Wed Apr  7 09:25:46 2021
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值