The following column of centos Getting Started Tutorial will introduce to you about TCP Wrappers access control in CentOS. I hope it will be helpful to friends who need it. Helped!

TCP Wrappers access control in CentOS
1. Overview of TCP Wrappers
TCP Wrappers "wrap" the TCP service program and Listening to the port of the TCP service program adds a security detection process. External connection requests must first pass this layer of security detection and obtain permission before they can access the real service program. As shown in the figure below, TCP Wrappers can also record all attempts to access the Protect the behavior of services and provide administrators with rich security analysis information.

2. Access policy of TCP Wrappers
The protection objects of the TCP Wrappers mechanism are various network service programs, and are accessed based on the client address of the access service control. The two corresponding policy files are /etc/hosts.allow and /etc/hosts.deny, which are used to set allow and deny policies respectively.
1. Policy configuration format
The two policy files have opposite functions, but the format of the configuration record is the same, as shown below:
The service program list and client address list are separated by colons, and multiple items in each list are separated by commas.
1) Service program list
ALL: represents all services;
Single service program: such as "vsftpd";
Composed of multiple service programs List: such as "vsftpd.sshd";
2) Client address list
ALL: represents any client address;
LOCAL: represents the local address;
Single IP address: such as "192.1668.10.1";
Network segment address: such as "192.168.10.0/255.255.255.0";
Domain name starting with "." : For example, "benet.com" matches all hosts in the benet.com domain;
Network addresses ending with ".": For example, "192.168.10." matches the entire 192.168.10.0/24 network segment;
Embedded wildcard characters """?": The former represents any length of characters, and the latter represents only one character. For example, "192.168.10.1" matches all IP addresses starting with 192.168.10.1. Cannot be mixed with patterns starting or ending with ".";
A list of multiple client addresses: such as "192.168.1., 172.16.16., .benet.com";
2. Basic principles of access control
Regarding the access policy of the TCP Wrappers mechanism, follow the following order and principles when applying it: first check the /etc/hosts.allow file, and if a matching policy is found, allow it Access; otherwise, continue to check the /etc/hosts.deny file. If a matching policy is found, access is denied; if no matching policy is found by checking the above two files, access is allowed.
3. TCP Wrappers configuration example
When actually using the TCP Wrappers mechanism, the looser policy can be "allow all, deny some", and the stricter policy is "allow some, deny all ". The former only needs to add the corresponding deny policy in the hosts.deny file; the latter, in addition to adding the allow policy in host.allow, also needs to set the "ALL: ALL" deny policy in the hosts.deny file. .
The example is as follows:
Now we only want to access the sshd service from the host with the IP address 192.168.10.1 or the host located in the 172.16.16 network segment. Other addresses are denied. You can perform the following operations:
[root@CentOS01 ~]# vim /etc/hosts.allow sshd:192.168.10.1 172.16.16.* [root@centos01 ~]# vim /etc/hosts.deny sshd:ALL
The above is the detailed content of About TCP Wrappers access control in CentOS. For more information, please follow other related articles on the PHP Chinese website!
CentOS: Exploring the AlternativesApr 15, 2025 am 12:03 AMAlternatives to CentOS include UbuntuServer, Debian, Fedora, RockyLinux, and AlmaLinux. 1) UbuntuServer is suitable for basic operations, such as updating software packages and configuring the network. 2) Debian is suitable for advanced usage, such as using LXC to manage containers. 3) RockyLinux can optimize performance by adjusting kernel parameters.
Centos shutdown command lineApr 14, 2025 pm 09:12 PMThe CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.
Difference between centos and ubuntuApr 14, 2025 pm 09:09 PMThe key differences between CentOS and Ubuntu are: origin (CentOS originates from Red Hat, for enterprises; Ubuntu originates from Debian, for individuals), package management (CentOS uses yum, focusing on stability; Ubuntu uses apt, for high update frequency), support cycle (CentOS provides 10 years of support, Ubuntu provides 5 years of LTS support), community support (CentOS focuses on stability, Ubuntu provides a wide range of tutorials and documents), uses (CentOS is biased towards servers, Ubuntu is suitable for servers and desktops), other differences include installation simplicity (CentOS is thin)
Centos configuration IP addressApr 14, 2025 pm 09:06 PMSteps to configure IP address in CentOS: View the current network configuration: ip addr Edit the network configuration file: sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0 Change IP address: Edit IPADDR= Line changes the subnet mask and gateway (optional): Edit NETMASK= and GATEWAY= Lines Restart the network service: sudo systemctl restart network verification IP address: ip addr
How to install centosApr 14, 2025 pm 09:03 PMCentOS installation steps: Download the ISO image and burn bootable media; boot and select the installation source; select the language and keyboard layout; configure the network; partition the hard disk; set the system clock; create the root user; select the software package; start the installation; restart and boot from the hard disk after the installation is completed.
Centos8 restarts sshApr 14, 2025 pm 09:00 PMThe command to restart the SSH service is: systemctl restart sshd. Detailed steps: 1. Access the terminal and connect to the server; 2. Enter the command: systemctl restart sshd; 3. Verify the service status: systemctl status sshd.
How to restart the network in centos8Apr 14, 2025 pm 08:57 PMRestarting the network in CentOS 8 requires the following steps: Stop the network service (NetworkManager) and reload the network module (r8169), start the network service (NetworkManager) and check the network status (by ping 8.8.8.8)
Restart centos7 commandApr 14, 2025 pm 08:54 PMReboot command is available to restart CentOS 7. The steps are as follows: Open the terminal window and enter the reboot command. Confirm the restart prompt. The system will restart and the boot menu will appear during this period. After the restart is complete, log in with the credentials.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools






