zoukankan      html  css  js  c++  java
  • TCP_Wrappers

    TCP_Wrappers配置

    这里主要涉及到两个配置文件/etc/hosts.allow和/etc/hosts.deny。/usr/sbin/tcpd进程会根据这两个文件判断是否对访问请求提供服务。
    /usr/sbin/tcpd进程先检查文件/etc/hosts.allow,如果请求访问的主机名或IP包含在此文件中,则允许访问。
    如果请求访问的主机名或IP不包含在/etc/hosts.allow中,那么tcpd进程就检查/etc/hosts.deny。看请求访问的主机名或IP有没有包含在hosts.deny文件中。如果包含,那么访问就被拒绝;如果既不包含在/etc/hosts.allow中,又不包含在/etc/hosts.deny中,那么此访问也被允许。

    例1:
    # cat /etc/hosts.allow
    sshd:192.168.100.0

    # cat/etc/hosts.deny
    sshd:ALL

    只允许192.168.100.0/24这个网段访问

    例2:
    # cat /etc/hosts.allow
    sshd:192.168.100.0/255.255.255.0 except 192.168.100.3
    # cat/etc/hosts.deny
    sshd:ALL

    192.168.100.0/24这个网段内除了192.168.100.3这个主机无法连接过来,其它主机都可以通过ssh协议连接进来。

    例3:
    # cat /etc/hosts.allow
    sshd:ALL except 192.168.100.2

    # cat/etc/hosts.deny

    除了192.168.100.2外,允许所有主机连接。


    检查某种服务是否可以通过tcp_wrappers来进行限制:
    [root@rhel1 ~]# which vsftpd
    /usr/sbin/vsftpd
    [root@rhel1 ~]# ldd /usr/sbin/vsftpd | grep libwrap
    libwrap.so.0 => /lib64/libwrap.so.0 (0x00007f6d52faf000)

    比如httpd就不能通过tcp_wrappers来进行控制:

  • 相关阅读:
    封装ajax---基于axios
    XHR的理解和作用
    params和 query区别
    HTTP请求交互的基本过程
    http3次握手
    ES6----import * as 用法
    微信小程序真机调试:Setting data field "XXX" to undefined is invalid
    webpack详解-----optimization
    node跨域
    shell 的 功能语句--1
  • 原文地址:https://www.cnblogs.com/rusking/p/7575428.html
Copyright © 2011-2022 走看看