Tcp-wrappers access Control

Source: Internet
Author: User

TCP wrappers wraps up other TCP services and adds a security detection process that requires this layer of security detection to access the real service program before the incoming connection request.

For most Linux distributions, TCP wrappers is the default feature provided. The protection object of TCP wrappers mechanism is a variety of network service programs, access control for the client address of the Access service, the corresponding two policy files are/etc/hosts.allow and/etc/hosts.deny, respectively, to set the policy of allow and deny.

Two files in the same format:< service Program list >:< client address list >

1> List of service programs

The list of service programs is divided into the following categories: (1) All: On behalf of all services, (2) A single service program: such as "VSFTPD"; (3) A list of multiple service programs, such as "vsftpd,sshd".

2> Client Address List

The client address list is divided into the following categories: (1) All: On behalf of all client addresses, (2) Local: On behalf of the local address, (3) Single IP address: "192.168.1.1", (4) network segment address: such as "192.168.1.0/255.255.255.0"; (5) to "." Starting domain name: such as ". Baidu.com" matches all hosts in the baidu.com domain; (6) with "." End of network address: such as "192.168.1." Match the entire 192.168.1.0/24 network segment; (7) Embedding wildcards *,?: The former represents any length of character, the latter represents only one character, such as "10.0.8.2*" matches all IP addresses that begin with 10.0.8.2. cannot be associated with "." The starting or ending pattern is mixed; (8) A list of multiple client addresses: such as "192.168.1.,172.17.17.,.baidu.com".


With regard to the access policy of the TCP wrappers mechanism, the application follows the following order and principle: first check the/etc/hosts.allow file and allow access if a matching policy is found, otherwise continue checking/etc/ Hosts.deny file, Access is denied if a matching policy is found, and access is allowed if none of the two files can find a matching policy.


When actually using the TCP wrappers mechanism, the looser policy can be "allow all, deny individual", and the more stringent strategy is "allow individual, deny all". The former only needs to add the appropriate deny policy in the Hosts.deny file, while the latter will need to set the "All:all" Deny policy in the Hosts.deny file in addition to the Allow policy in Hosts.allow.


For example, if you only want to access the SSHD service from a host that has an IP 192.168.0.0/24 segment, and other addresses are rejected, you should do the following:

[Email protected] ~]# Cat/etc/hosts.allow

sshd:192.168.0.

[Email protected] ~]# Cat/etc/hosts.deny

Sshd:all


Because my host is 192.168.200.0/24 network segment, now disconnect Xshell reconnect is not connected.


Tcp-wrappers access Control

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.