Tcp_wrapper Knowledge Collation
I. Introduction of TCP Wrapper
TCP Wrapper is an access control tool similar to iptables that can be used for access control.
TCP wrapper can only use TCP protocol-based services for access control, but not all TCP protocol-based services can be implemented with TCP Wraper as access control.
The TCP wrapper implements the access control mainly relies on two files, one is the/etc.hosts.allow file, the other is the/etc/hosts.deny file. It can be understood from the name of the file: one is the definition allowed, and one is the definition of the deny. What is the order in which the two documents will take effect?
650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M02/A6/5F/wKioL1nNruPAdm2UAAMWHrdFXz4564.jpg "title=" 1.jpg "alt=" Wkiol1nnrupadm2uaamwhrdfxz4564.jpg "/>
The diagram should be easy to understand, first check if there is a matching rule in the Hosts.allow file. If there is a matching rule, then access is allowed, if there is no matching rule, check if there is a matching rule in the Hosts.deny file, deny access if there is a matching rule, if there is no matching rule, the default rule is allowed, so access is allowed.
Second, the format of the configuration file:
Daemon_list:client_list [[[: Option]: option] ...]
Daemon_list:
Note: Must be the name of the application file; that is, the file name stored in the/usr/sbin directory;
1. Single Application file name:
such as: VSFTPD
2. A list of the names of the program files, separated by commas:
such as: sshd, VSFTPD
3.ALL: an indiscriminate representation of all applications controlled by Tcp_wrapper;
Client_list:
1. A single IP address or hostname, if the use of host name, you must ensure that the machine can be resolved;
2. Network address: The previous prefix length represents an invalid mask (172.16.0.0/16)
A) If there is a mask, the full-format mask must be used;
such as: 172.16.0.0/255.255.0.0
b) You can use a short format:
such as: 172.16.
3. Built-in Access control list:
All: the host;
Known: All host names that can be parsed correctly by the current host;
UNKNOWN: All host names that cannot be parsed correctly by the current host;
PARANOID: Forward parsing and reverse parsing result inconsistent with all hosts;
: option
Deny: Deny, mainly used for Hosts.allow files, define access rules;
Allow: Allows, primarily for hosts.deny files, to define allowed access rules;
Spawn: Generate, initiate, execute;
Instance:
The SSHD service does not allow 172.16.0.0/16, but allows 172.16.1.3 access:
Method One:
1,/etc/hosts.allow
sshd:172.16.1.3
2,/etc/hosts.deny
sshd:172.16.
Method Two:
/etc/hosts.deny
sshd:172.16. EXCEPT 172.16.1.3
Method Three:
1,/etc/hosts.allow
Sshd:all EXCEPT 172.16. EXCEPT 172.16.1.3
2,/etc/hosts.deny
Sshd:all
Three, extended options:
Spawn Use Example:
SSHD, Vsftpd:all:spawn/bin/echo $ (date +%f-%t)%c attempt login%s >>/var/log/tcpwrapper.log
%c:client information: [email protected], [email protected], a host name, or just an address, depending on how much Information is available.
%s:server information: [email protected], [email protected], or just a daemon name, depending on how much information I S available.
%h:client hostname
%p:server PID
Instance:
SSH login to 172.16.1.3 host with 172.16.1.2 host
/etc/hosts.allow
Sshd:ALL:spawn echo ' Date ' form%c to%s >>/var/log/tcp_wrapper.log
172.16.1.2 after landing
[Email protected] ~]# Cat/var/log/tcp_wrapper.log
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/A6/5F/wKioL1nNrwagWvXYAAATh9ikA94746.png "title=" QQ Browser screenshot is not named. png "alt=" Wkiol1nnrwagwvxyaaath9ika94746.png "/>
This article is from the "12657170" blog, please be sure to keep this source http://12667170.blog.51cto.com/12657170/1969639
Tcp_wrapper Knowledge Collation