linux TCP Wrappers
2016-03-30 16:06
676 查看
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-like) operating 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 :不能解析的
(维基百科)TCP Wrapper is a host-based Networking ACL system, used to filter network access to Internet Protocolservers on (Unix-like) operating 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
相关文章推荐
- 网络相关系列之一:Android中使用HttpClient发送HTTP请求
- 屏蔽HTTPS证书验证下载apk安装包
- c++ 构造http post 发文件
- (OK) port_php-5.6.14_to_Android—(和lighttpd集成成功)—没有基于android 4.4源码
- OSI、TCP/IP参考模型对应的网络协议
- 神经网络模型算法与生物神经网络的最新联系
- 美图欣赏,转载[原文链接http://toutiao.com/a4001258776/]
- HDU5455 沈阳网络赛 Fang Fang
- 跨域问题解决方案(HttpClient安全跨域 & jsonp跨域)
- 常用对照表之HTTP content-type
- ASIHttpRequest所需要的FrameWork
- TCP四次挥手
- httpClient PostMethod
- Nagle算法
- 深度信念网络与受限玻尔兹曼机
- TCP三次握手
- 神经网络与深度学习
- httpClient httpPost
- Glide与OkHttp3集成
- Swift UITableView瀑布流/NSURLConnection异步网络请求