INETD(8) BSD System Manager's Manual INETD(8) NNAAMMEE iinneettdd - internet ``super-server'' SSYYNNOOPPSSIISS iinneettdd [--dd] [--RR _r_a_t_e] [_c_o_n_f_i_g_u_r_a_t_i_o_n _f_i_l_e] DDEESSCCRRIIPPTTIIOONN IInneettdd should be run at boot time by _/_e_t_c_/_r_c_._l_o_c_a_l (see rc(8)). It then listens for connections on certain internet sockets. When a connection is found on one of its sockets, it decides what service the socket corre- sponds to, and invokes a program to service the request. After the pro- gram is finished, it continues to listen on the socket (except in some cases which will be described below). Essentially, iinneettdd allows running one daemon to invoke several others, reducing load on the system. The options available for iinneettdd:: --dd Turns on debugging. --RR _r_a_t_e Specifies the maximum number of times a service can be invoked in one minute; the default is 1000. Upon execution, iinneettdd reads its configuration information from a configu- ration file which, by default, is _/_e_t_c_/_i_n_e_t_d_._c_o_n_f. There must be an entry for each field of 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. There must be an entry for each field. The fields of the configuration file are as follows: service name socket type protocol wait/nowait user server program server program arguments There are two types of services that iinneettdd can start: standard and TCP- MUX. A standard service has a well-known port assigned to it; it may be a service that implements an official Internet standard or is a BSD- specific service. As described in RFC 1078, TCPMUX services are nonstan- dard services that do not have a well-known port assigned to them. They are invoked from iinneettdd when a program connects to the ``tcpmux'' well- known port and specifies the service name. This feature is useful for adding locally-developed servers. The _s_e_r_v_i_c_e_-_n_a_m_e entry is the name of a valid service in the file _/_e_t_c_/_s_e_r_v_i_c_e_s. For ``internal'' services (discussed below), the service name _m_u_s_t be the official name of the service (that is, the first entry in _/_e_t_c_/_s_e_r_v_i_c_e_s). For TCPMUX services, the value of the _s_e_r_v_i_c_e_-_n_a_m_e field consists of the string ``tcpmux'' followed by a slash and the lo- cally-chosen service name. The service names listed in _/_e_t_c_/_s_e_r_v_i_c_e_s and the name ``help'' are reserved. Try to choose unique names for your TCP- MUX services by prefixing them with your organization's name and suffix- ing them with a version number. The _s_o_c_k_e_t_-_t_y_p_e 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 ser- vices must use ``stream''. The _p_r_o_t_o_c_o_l must be a valid protocol as given in _/_e_t_c_/_p_r_o_t_o_c_o_l_s. Exam- ples might be ``tcp'' or ``udp''. TCPMUX services must use ``tcp''. The _w_a_i_t_/_n_o_w_a_i_t entry is applicable to datagram sockets only (other sock- ets should have a ``nowait'' entry in this space). If a datagram server connects to its peer, freeing the socket so iinneettdd can received further messages on the socket, it is said to be a ``multi-threaded'' server, and should use the ``nowait'' entry. For datagram servers which process all incoming datagrams on a socket and eventually time out, the server is said to be ``single-threaded'' and should use a ``wait'' entry. Com- sat(8) (biff(1)) and talkd(8) are both examples of the latter type of datagram server. Tftpd(8) is an exception; it is a datagram server that establishes pseudo-connections. It must be listed as ``wait'' in order to avoid a race; the server reads the first packet, creates a new socket, and then forks and exits to allow iinneettdd to check for new service requests to spawn new servers. TCPMUX services must use ``nowait''. The _u_s_e_r entry should contain the user name of the user as whom the serv- er should run. This allows for servers to be given less permission than root. The _s_e_r_v_e_r_-_p_r_o_g_r_a_m entry should contain the pathname of the program which is to be executed by iinneettdd when a request is found on its socket. If iinneettdd provides this service internally, this entry should be ``internal''. The _s_e_r_v_e_r _p_r_o_g_r_a_m _a_r_g_u_m_e_n_t_s should be just as arguments normally are, starting with argv[0], which is the name of the program. If the service is provided internally, the word ``internal'' should take the place of this entry. IInneettdd provides several ``trivial'' services internally by use of routines within itself. These services are ``echo'', ``discard'', ``chargen'' (character generator), ``daytime'' (human readable time), and ``time'' (machine readable time, in the form of the number of seconds since mid- night, January 1, 1900). All of these services are tcp based. For de- tails of these services, consult the appropriate RFC from the Network In- formation Center. IInneettdd rereads its configuration file when it receives a hangup signal, SIGHUP. Services may be added, deleted or modified when the configuration file is reread. TTCCPPMMUUXX RFC 1078 describes the TCPMUX protocol: ``A TCP client connects to a for- eign host on TCP port 1. It sends the service name followed by a car- riage-return line-feed <CRLF>. The service name is never case sensitive. The server replies with a single character indicating positive (+) or negative (-) acknowledgment, immediately followed by an optional message of explanation, terminated with a <CRLF>. If the reply was positive, the selected protocol begins; otherwise the connection is closed.'' The pro- gram is passed the TCP connection as file descriptors 0 and 1. If the TCPMUX service name begins with a ``+'', iinneettdd returns the posi- tive reply for the program. This allows you to invoke programs that use stdin/stdout without putting any special server code in them. The special service name ``help'' causes iinneettdd to list TCPMUX services in _i_n_e_t_d_._c_o_n_f. EEXXAAMMPPLLEESS Here are several example service entries for the various types of ser- vices: ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l ntalk dgram udp wait root /usr/libexec/ntalkd ntalkd tcpmux/+date stream tcp nowait guest /bin/date date tcpmux/phonebook stream tcp nowait guest /usr/local/bin/phonebook phonebook EERRRROORR MMEESSSSAAGGEESS IInneettdd logs error messages using syslog(3). Important error messages and their explanations are: _s_e_r_v_i_c_e/_p_r_o_t_o_c_o_l server failing (looping), service terminated. The number of requests for the specified service in the past minute ex- ceeded the limit. The limit exists to prevent a broken program or a mali- cious user from swamping the system. This message may occur for several reasons: 1) there are lots of hosts requesting the service within a short time period, 2) a 'broken' client program is requesting the service too frequently, 3) a malicious user is running a program to invoke the ser- vice in a 'denial of service' attack, or 4) the invoked service program has an error that causes clients to retry quickly. Use the [--RR] option, as described above, to change the rate limit. Once the limit is reached, the service will be reenabled automatically in 10 minutes. _s_e_r_v_i_c_e/_p_r_o_t_o_c_o_l: No such user '_u_s_e_r', service ignored _s_e_r_v_i_c_e/_p_r_o_t_o_c_o_l: getpwnam: _u_s_e_r: No such user No entry for _u_s_e_r exists in the _p_a_s_s_w_d file. The first message occurs when iinneettdd (re)reads the configuration file. The second message occurs when the service is invoked. _s_e_r_v_i_c_e: can't set uid _n_u_m_b_e_r _s_e_r_v_i_c_e: can't set gid _n_u_m_b_e_r The user or group ID for the entry's _u_s_e_r is invalid. SSEEEE AALLSSOO comsat(8), fingerd(8), ftpd(8), rexecd(8), rlogind(8), rshd(8), telnetd(8), tftpd(8) HHIISSTTOORRYY The iinneettdd command appeared in 4.3BSD. TCPMUX is based on code and docu- mentation by Mark Lottor. 4.4BSD June 6, 1993 3