Manage the Linux inetd server-Linux Enterprise Application-Linux server application information. For more information, see. The most important network service process is the inetd server program. In fact, most services with less frequent requests are
Started by it.
The inetd program appears as a service process in the system. It listens to many ports and receives client requests.
Start the service program on this port. Because of its versatility, we will introduce it in this chapter.
The inetd program can be started by the command line:
Inetd [-d]
-D option is used to open debugging information.
The working method of inetd is set by the/etc/inetd. conf and/etc/services files. We will explain the following:
The two files.
The format of the services file is basically as follows:
Netstat 15/tcp
Qotd 17/tcpquote
Msp 18/tcp # message send protocol
Msp 18/udp # message send protocol
Chargen19/tcpttytst source
Chargen19/udpttytst source
Ftp21./tcp
#22-unassigned
Telnet23/tcp
Each row contains two or three columns, the first column is the service name, and the second row is the port and protocol used, such
Here, telnet 23/tcp indicates that the telnet service should use port 23 and the protocol type is tcp. Third
The column is the service alias, which can be omitted.
Inetd. conf depends on the services file. It is also a text file. Each line represents a service job.
Mode. The line guided by "#" indicates the comment row. The format of a non-Comment row is roughly as follows:
Service name data type protocol listening mode user identity service program parameters
For example, to start the telnet service, add the following line:
The service name is telnet, which will provide services on port 23 according to the definition of/etc/services; s
Tream indicates that data transmission and receiving will be completed using simple stream file read/write (fscanf and fprintf );
Tcp indicates that the tcp protocol is used. The Listener mode can be set to two options: wait AND nowait. Simply put,
If the corresponding service program is multi-process, set it to nowait. At this time, inetd will receive each request
Start a service program process, such as telnet.
Start a telnet service process. On the contrary, if it is a single process, you can set it to wait.
User identity indicates the uid/euid used when the service process starts, Because telnet can be sent by any user
And the user can execute any command via telnet, so use the root user identity.
/Usr/sbin/tcpd is the program actually started. This program is actually a common TCP connection processing program,
The parameter uses in. telnetd. When a connection request with port 23 is made, the inetd executes/usr/sbin/t.
Cpd in. telnetd.
Generally, various services have been written in inetd. conf, And the unenabled service uses comment # to invalidate it.
To enable this service, you only need to delete the # annotation symbol of the pilot.
It is worth mentioning that the/usr/sbin/tcpd program is a TCP connection filtering program, which usually needs to be connected
All services that are verified should be started through the tcpd program, which can automatically verify the IP address of the customer's machine
Authentication and Security filtering. The main function is to disable connections from some addresses. For example
In the above form, the in. telnetd program is started through the/usr/sbin/tcpd program, so you can telnet
Request for address verification.
The tcpd address is verified through the/etc/hosts. deny and/etc/hosts. allow files. If the file does not exist
You can create such a file by yourself. the syntax of the two is almost the same, but hosts. allow allows
A connection from an address, while hosts. deny disallows a connection from a location.
The basic syntax is:
Service Program: Customer address
A service program is the name of the program started through the tcpd program. The customer address is a list of related addresses, such
Add the following line to the/etc/hosts. allow file:
In. telnetd: 10.0.0.2
Allow machines at 10.0.0.2 to use the local telnet service. If this line is added to/etc/hosts. den
Y: Disable Machine Logon at 10.0.0.2.
The address can be in the set form. Common set forms include the following:
A string starting with a comma defines a domain. For example, .edu.cn indicates that all machines whose domain names are suffixed with .edu.cn.
Define an IP address string ending with a comma, for example, 202.199.248. represents 202.199.248.0 to 202.199.
. 248.255.
It is interpreted as a/separate string as a network address/subnet mask, for example, 172.13.0.0/255.255.0.0
Table 172.13.0.0 to 172.13.255.255.
In addition, both addresses and service programs can use wildcards, which include the following:
ALL represents ALL, ALL service programs, or ALL addresses. It is often used with the limit t clause, and the limit t clause
Table "". For example, write ALL: ALL privileges t 202.199.248 in hosts. deny.
All machines outside of. 199. * use any tcpd-based service. Write all ct in.
Telnetd: ALL will disable ALL tcpd-based services except telnet.
LOCAL refers to all machines without name suffixes.
KNOWN machines with all IP addresses and domain names
Unknown ip address or machine with an UNKNOWN domain name
The paranoid ip address does not match the name returned from the Domain Name Service.
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