Next: , Previous: , Up: inetd: Internet super-server   [Contents][Index]


19.2 Configuration file

Upon execution, inetd reads its configuration information from configuration files and directories named on the command line. By default these are /etc/inetd.conf and /etc/inetd.d. If the configuration pathname is a directory, all files in the directory are read and interpreted like a configuration file. All of the configuration files are read and the results are merged.

There must be an entry for each field in the configuration file, with entries for each field separated by a tab or a space. Comments are denoted by a “#” at the beginning of a line. The available fields of the configuration file are summarized in the table below (optional parts are enclosed in square brackets):

[service node:]service name

The service-name entry is the name of a valid service in the file /etc/services. For “internal” services (see Built-in services), the service name must be the official name of the service (that is, the first entry in /etc/services), or a numeric representation thereof. For TCPMUX services, the value of the ‘service name’ field consists of the string ‘tcpmux’ followed by a slash and the locally-chosen service name (see TCPMUX).

An optional ‘service node’ prefix is allowed for internet services. When present, it supplies the local addresses inetd should use when listening for that service. ‘Service node’ consists of a comma-separated list of addresses. Both symbolic host names and numeric IP addresses are allowed. Symbolic hostnames are looked up in DNS service. If a hostname has multiple address mappings, inetd creates a socket to listen on each address.

To avoid repeating an address that occurs frequently, a line with a host address specifier and colon, but no further fields is allowed, e.g.:

127.0.0.1,192.168.0.5:

The address specifier from such a line is remembered and used for all further lines lacking an explicit host specifier. Such a default address remains in effect until another such line or end of the configuration is encountered, whichever occurs first.

A special hostname ‘*’ stands for the wildcard address. When used in a normal configuration line, it causes the default address specifier to be ignored for that line. When used in a default address specification, e.g.:

*:

it causes any previous default address specifier to be forgotten.

socket type

The socket type should be one of ‘stream’, ‘dgram’, ‘raw’, ‘rdm’, or ‘seqpacket’, depending on whether the socket is a stream, datagram, raw, reliably delivered message, or sequenced packet socket. TCPMUX services must use ‘stream’.

protocol

The protocol must be a valid protocol as given in /etc/protocols. Examples might be ‘tcp’ or ‘udp’. TCPMUX services must use ‘tcp’. If IPv6 support is enabled the sockets will accept both IPv4 and IPv6 connections if that is supported by the OS. If inetd should only accept IPv4 or IPv6 connections, add ‘4’ or ‘6’ to the protocol name. For example ‘tcp4’ will only accept IPv4 tcp connections and ‘udp6’ will only accept IPv6 udp connections.

wait/nowait[.max]

The ‘wait/nowait’ entry specifies whether the server that is invoked by inetd will take over the socket associated with the service access point, and thus whether inetd should wait for the server to exit before listening for new service requests. Datagram servers must use ‘wait’, as they are always invoked with the original datagram socket bound to the specified service address. These servers must read at least one datagram from the socket before exiting. If a datagram server connects to its peer, freeing the socket so inetd can received further messages on the socket, it is said to be a “multi-threaded” server; it should read one datagram from the socket and create a new socket connected to the peer. It should fork, and the parent should then exit to allow inetd to check for new service requests to spawn new servers. Datagram servers which process all incoming datagrams on a socket and eventually time out are said to be “single-threaded”. comsat and talkd are both examples of the latter type of datagram server. tftpd is an example of a multi-threaded datagram server.

Servers using stream sockets generally are multi-threaded and use the ‘nowait’ entry. Connection requests for these services are accepted by inetd, and the server is given only the newly-accepted socket connected to a client of the service. Most stream-based services and all TCPMUX services operate in this manner. For such services, the number of running instances of the server can be limitied by specifying optional ‘max’ suffix (a decimal number), e.g.: ‘nowait.15’.

Stream-based servers that use ‘wait’ are started with the listening service socket, and must accept at least one connection request before exiting. Such a server would normally accept and process incoming connection requests until a timeout. Other services must use ‘nowait’.

user

The user entry should contain the user name of the user as whom the server should run. This allows for servers to be given less permission than root. An optional form includes also a group name as a suffix, separated from the user name by colon or a period, i.e., ‘user:group’ or ‘user.group’.

server program

The server-program entry should contain the pathname of the program which is to be executed by inetd when a request is found on its socket. If inetd provides this service internally, this entry should be ‘internal’.

It is common usage to specify /usr/sbin/tcpd in this field.

server program arguments

The server program arguments should be just as arguments normally are, starting with argv[0], which is the name of the program. If the service is provided internally, this entry must contain the word ‘internal’, or be empty.


Next: Built-in services, Previous: Invocation, Up: inetd: Internet super-server   [Contents][Index]