Tcp_wrappers access Control

Source: Internet
Author: User

I. Introduction of Tcp_wrappers

Security detection and access control for a specific service with stateful connections, implemented as a library file, whether a process accepts LibWrap control depends on whether the program initiating the process compiles at compile time for libwrap, and whether the service is capable of being tcp_ Wrapper method of access control:

Ldd/path/to/program|grep libwrap.so
Strings Path/to/program|grep libwrap.so
Example sshd:

  1. [[email protected] 1372]# which sshd
  2. /usr/sbin/sshd
  3. [[email protected] 1372]# ldd/usr/sbin/sshd | grep libwrap
  4. Libwrap.so. 0 =/lib64/libwrap.so. 0 (0x00007f5659d39000)
  5. [[email protected] 1372]# strings/usr/sbin/sshd | grep libwrap
  6. Libwrap.so. 0
  7. LibWrap Refuse returns

It/etc/hosts.deny these two configuration files through/etc/hosts.allow to restrict access to the IP that is accessing the services that support the Tcp_warppers module.

The read order of the two profiles takes precedence, and if the Allow file is loaded, deny is no longer read.

Second, the basic syntax within the configuration file:

1. Syntax: Service group: Host

2. Client client_list format

List of clients separated by commas or spaces
Based on IP address: 192.168.10.1 192.168.1.
Based on host name: www.magedu.com. magedu.com less
Based on network/mask: 192.168.0.0/255.255.255.0
Based on NET/PREFIXLEN:192.168.1.0/24 (CENTOS7)
Based on network group (NIS domain): @mynetwork
Built-in Acl:all,local,known,unknown,paranoid

Cases:

    1. Edit/etc/host.allow under Editing
    2. In.telnetd,sshd:172.18. in.telnet and sshd two services allow 172.18. Ten
    3. Edit/etc/host.deny under Editing
    4. In.telentd:ALL indicates that all hosts are denied connection to in.telnetd
    5. If the above file exists at the same time, the expression is only allowed 172.18. intelnetd, other hosts inaccessible, all network segments can access sshd (if not on the whitelist, the default is to allow White list and blacklist at the same time, permission to take the whitelist)

3. Special usage spawn, EXCEPT, twist

Expect unless the meaning of:
Cases:

  1. VSFTPD: 172.16. EXCEPT 172.16.0/ EXCEPT 172.1
  2. If this configuration is within allow, all hosts are allowed access, except for the 172 of the 172.16.1. 0 network segment.
  3. If this configuration is within deny, the 172.16 is refused permission.0 network segment except 172.16.1 This address access, other addresses are denied access

Spawn start an external program to do the following:
Cases:

    1. Sshd:ALL:spawn echo "$ (date +%%f) login attempt from%c to%s,%d" >>/var/log/sshd.log
    2. Whenever there is a host visit will have a record output to the/var/log/sshd.log file, note spawn front: often lost
    3. %c Client Information
    4. %s Server-side information
    5. %d Service Name
    6. PID of%p Daemon process
    7. Percent percentage

Twist the actual action is to deny access, replace the current service with the specified operation, standard I/O and error sent to the client, default to/dev/null
Cases:

    1. Add the following within Host.allow:
    2. VSFTPD: 172.16.: Twist/bin/echo "connectionprohibited" the project will replace the action of successful access with/bin/echo " Connectionprohibited " , twist is the meaning of substitution.

Test tools:
Tcpdmatch [-d] daemon[@host] Client
-D test Hosts.allow and Hosts.deny in the current directory
Cases:

    1. tcpdmatch-d (test configuration file under current directory, not necessarily etc) sshd 192.168.5

0000000000000000000

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.