1. TCP Wrapper简介 (出处:http://www.softpanorama.org/Net/Network_security/TCP_wrappers/)

  (维基百科)TCP Wrapper is a host-based Networking ACL system, used to filter network access to Internet Protocolservers on (Unix-likeoperating systems such as Linux or BSD. It allows host or subnetwork IP addresses,names and/or ident query replies, to be used as tokens on which to filter for access control purposes.

  看看大牛们怎么说这玩意的: TCP wrappers is a classic security tool available on most flavors of Unix including AIX, HP-UX, Linux and Solaris).  Sadly despite being a classic tool it is extremely underutilized and widely misunderstood tool.

  Very few sysadmins know that TCP wrappers represents (for TCP-based protocols only) a lightweight alternative to firewall(which is actually a heavyweight,  obtuse and CPU intensive tool).  Some capabilities of TCP wrappers cannot be emulated using firewall.

  任何用xinetd管理的服务都可以通过/etc/host.allow,/etc/host.deny 来过滤网络访问。当然,在xinetd管理的服务的配置文件中也可以通过only_from,no_access等参数来实现相同的功能。 但是用tcp wrappers 可以更集中的管理。

  如果要使用tcp wrappers 来管理某个服务,则这个服务就必须要支持TCP Wrappers 的函数功能,要用到libwrap.so动态链接库。例如: 查看sshd和httpd能否能用TCP Wrapppers 来管理:

  

  由此可知,sshd 可以用它管理,但是httpd就不行。

2. TCP Wrappers配置文件

  To determine if a client machine is allowed to connect to a service, TCP wrappers reference the following two files, which are commonly referred to as hosts access files:

  • /etc/hosts.allow
  • /etc/hosts.deny

  You can use single file and include action (allow or deny as the last field of TCP wrapper configuration file directive (see above). Often this is more transparent approach as you see all directives in a single file.

  这两个文件的判断依据是:host.allow优先,若没有分析到的IP 或网段用hosts.deny来判断。

  2.1 这两个文件格式
    服务列表 :地址列表 :选项
    A. 服务列表格式:如果有多个服务,那么就用逗号隔开
    B. 地址列表格式:
    1. 标准IP地址:如果多于一个用,隔开

      telnetd :192.168.8.2, 192.168.9.22: deny

      telnetd,sshd:192.168.4.10 , 192.168.6.: allow
    2. 主机名称:例如:www.baidu.com, .example.con匹配整个域

      telnetd,sshd:.mydomain.com :allow   (请注意本例中 mydomain.com 之前的点号(“.”)。这是个通配符)
    3. 利用掩码:140.116.34.0/255.255.255.0指定整个网段

      telnet: 140.116.34.0/255.255.255.0 : allow

    4. 文件中的特殊字段:

      ALL :指代所有主机
      LOCAL :指代本地主机
      KNOWN :能够解析的
      UNKNOWN :不能解析的

      ALL:PARANOID, mydomain:allow
   5. 写在hosts.allow中的选项默认为是deny,第三列可以不写,同理hosts.deny

  

  

linux TCP Wrappers的更多相关文章

  1. Linux网络安全篇,认识防火墙(三),TCP Wrappers

    1.防火墙设置文件 任何以xinetd管理的服务都可以通过 /etc/hosts.allow /etc/hosts.deny 这两个文件来设置防火墙(针对源IP或域进行允许或操作的设置). 其实/et ...

  2. SSH服务与tcp wrappers实验

    SSH服务与tcp wrappers实验 实验环境: 一台linux(ssh client) 一台linux(ssh server) 实验步骤: 1.配置IP,测试连通性 2.在客户端创建用户yuzl ...

  3. firewall-cmd 防火墙命令详解 及 TCP Wrappers

    firewall-cmd 常用参数及作用 参数 作用 --get-default-zone 查询默认的区域名称 --set-default-zone=<区域名称> 设置默认的区域,使其永久 ...

  4. TCP Wrappers

    TCP Wrappers 是 RHEL 7 系统中默认启用的一款流量监控程序,它能够根据来访主机的地址与本机的目标服务程序作出允许或拒绝的操作.换句话说,Linux 系统中其实有两个层面的防火墙,第一 ...

  5. SSH使用TCP Wrappers实现访问控制

    SSH使用TCP Wrappers实现访问控制主要配置文件/etc/hosts.allow/etc/hosts.deny===TCP Wrappers的访问控制原则首先检查 hosts.allow 文 ...

  6. linux tcp调优

    Linux TCP Performance Tuning News Linux Performance Tuning Recommended Books Recommended Links Linux ...

  7. CentOS 访问控制列表(tcp wrappers)

    1.TCP Wrappers是一个工作在应用层的安全工具,它只能针对某些具体的应用或者服务起到一定的防护作用.比如说ssh.telnet.FTP等服务的请求,都会先受到TCP Wrappers的拦截. ...

  8. [转]linux tcp/ip调优

    LINUX tcp/ip性能调优 On 2011年03月15日, in linux, tips, by netoearth 在TCP/IP协议中,TCP协议提供可靠的连接服务,采用三次握手建立一个连接 ...

  9. [转帖]Linux TCP/IP协议栈,数据发送接收流程,TCP协议特点

    Linux TCP/IP协议栈,数据发送接收流程,TCP协议特点 http://network.51cto.com/art/201909/603780.htm 可以毫不夸张的说现如今的互联网是基于TC ...

随机推荐

  1. xcode 自定义Eclipse里边常用的快捷键

    之前在用Eclipse写Java的 时候,有几个常用的快捷键,比如删除当前行,在当前行下面插入空行,向上/下移动当前行等等,到了Xcode里怎么也找不到这些快捷键,一直觉得 Xcode自带的快捷键不够 ...

  2. linux日常易忘指令

    1.编辑全局指令 进入~/.bash_profile 增加"exprot +(启动文件的地址)" source ~/.bash_profilr(刷新) 2.修改mysql密码 my ...

  3. IOS - 多态

    1. 多态性 多态性是个生物名词,用来表示生物体在生命周期中的不同形态,用在编程语言中则表示相同的方法名,但是却有不同的实现方式.或者说相同的名字,不同的类.我们来看一个书上的示例: #import  ...

  4. 'XCTest/XCTest.h' file not found

    直接写解决方法吧:在报错的 Target 中的 Building Settings 中 Framework Search Paths 里面添加 $(PLATFORM_DIR)/Developer/Li ...

  5. Javascript中最常用的55个经典技巧(转)

    1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键 <table border oncontextmenu ...

  6. 关于Cookie和Session的优缺点

    关于Cookie和Session的优缺点 具体来说cookie机制采用的是在客户端保持状态的方案,而session机制采用的是在服务器端保持状态的方案. Cookie的优缺点:优点:极高的扩展性和可用 ...

  7. Tmux的安装、使用与配置

    tmux 安装.使用.配置 因上线需求,故需要使用tumx,方便上线 tmux功能 提供了强大的.易于使用的命令行界面 可横向.纵向分割窗口 窗格可以自由移动和调整大小,或者直接利用四个预设布局之一 ...

  8. Ionic2 Tutorial

    build your first app Now that you have Ionic and its dependencies installed, you can build your firs ...

  9. JAVA中读取xls数据方法介绍

    用例编号(UI-0001) 用例名称({验证页面跳转|验证元素文本}-简要明确表述) 验证类型 是否执行 初始URL 初始元素xpath 目标元素xpath 目标元素属性 期望结果 UI-0001 验 ...

  10. sql server 常用脚本(日常查询所需)

    1:查看sql server代理中作业的运行状况的脚本 -- descr : a simple sql script to view sql server jobs run status -- las ...