xref: /openbsd-src/usr.sbin/inetd/inetd.8 (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1.\"	$OpenBSD: inetd.8,v 1.34 2009/12/29 10:25:43 sobrado Exp $
2.\" Copyright (c) 1985, 1991 The Regents of the University of California.
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. Neither the name of the University nor the names of its contributors
14.\"    may be used to endorse or promote products derived from this software
15.\"    without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\"     from: @(#)inetd.8	6.7 (Berkeley) 3/16/91
30.\"
31.Dd $Mdocdate: December 29 2009 $
32.Dt INETD 8
33.Os
34.Sh NAME
35.Nm inetd
36.Nd internet
37.Dq super-server
38.Sh SYNOPSIS
39.Nm inetd
40.Op Fl d
41.Op Fl R Ar rate
42.Op Ar configuration_file
43.Sh DESCRIPTION
44.Nm inetd
45should be run at boot time by
46.Pa /etc/rc
47(see
48.Xr rc 8 ) .
49It then listens for connections on certain internet sockets.
50When a connection is found on one
51of its sockets, it decides what service the socket
52corresponds to, and invokes a program to service the request.
53After the program is
54finished, it continues to listen on the socket (except in some cases which
55will be described below).
56Essentially,
57.Nm inetd
58allows running one daemon to invoke several others,
59reducing load on the system.
60.Pp
61The options are as follows:
62.Bl -tag -width Ds
63.It Fl d
64Turns on debugging.
65.It Fl R Ar rate
66Specify the maximum number of times a service can be invoked
67in one minute; the default is 256.
68If a service exceeds this limit,
69.Nm
70will log the problem
71and stop servicing requests for the specific service for ten minutes.
72See also the wait/nowait configuration fields below.
73.El
74.Pp
75Upon execution,
76.Nm inetd
77reads its configuration information from a configuration
78file which, by default, is
79.Pa /etc/inetd.conf .
80There must be an entry for each field of the configuration
81file, with entries for each field separated by a tab or
82a space.
83Comments are denoted by a
84.Dq #
85at the beginning
86of a line.
87The fields of the configuration file are as follows:
88.Bd -unfilled -offset indent
89service name
90socket type
91protocol
92wait/nowait[.max]
93user[.group] or user[:group]
94server program
95server program arguments
96.Ed
97.Pp
98To specify a Sun-RPC
99based service, the entry would contain these fields.
100.Bd -unfilled -offset indent
101service name/version
102socket type
103rpc/protocol
104wait/nowait[.max]
105user[.group] or user[:group]
106server program
107server program arguments
108.Ed
109.Pp
110For internet services, the first field of the line may also have a host
111address specifier prefixed to it, separated from the service name by a
112colon.
113If this is done, the string before the colon in the first field
114indicates what local address
115.Nm
116should use when listening for that service.
117Multiple local addresses
118can be specified on the same line, separated by commas.
119Numeric IP
120addresses in dotted-quad notation can be used as well as symbolic
121hostnames.
122Symbolic hostnames are looked up using
123.Fn gethostbyname .
124If a hostname has multiple address mappings, inetd creates a socket
125to listen on each address.
126.Pp
127The single character
128.Dq \&*
129indicates
130.Dv INADDR_ANY ,
131meaning
132.Dq all local addresses .
133To avoid repeating an address that occurs frequently, a line with a
134host address specifier and colon, but no further fields, causes the
135host address specifier to be remembered and used for all further lines
136with no explicit host specifier (until another such line or the end of
137the file).
138A line
139.Dl *:
140is implicitly provided at the top of the file; thus, traditional
141configuration files (which have no host address specifiers) will be
142interpreted in the traditional manner, with all services listened for
143on all local addresses.
144If the protocol is
145.Dq unix ,
146this value is ignored.
147.Pp
148The
149.Em service name
150entry is the name of a valid service in
151the file
152.Pa /etc/services .
153For
154.Dq internal
155services (discussed below), the service
156name
157.Em must
158be the official name of the service (that is, the first entry in
159.Pa /etc/services ) .
160When used to specify a Sun-RPC
161based service, this field is a valid RPC service name in
162the file
163.Pa /etc/rpc .
164The part on the right of the
165.Dq /
166is the RPC version number.
167This can simply be a single numeric argument or a range of versions.
168A range is bounded by the low version to the high version -
169.Dq rusers/1-3 .
170For
171.Ux Ns -domain
172sockets this field specifies the path name of the socket.
173.Pp
174The
175.Em socket type
176should be one of
177.Dq stream ,
178.Dq dgram ,
179.Dq raw ,
180.Dq rdm ,
181or
182.Dq seqpacket ,
183depending on whether the socket is a stream, datagram, raw,
184reliably delivered message, or sequenced packet socket.
185.Pp
186The
187.Em protocol
188must be a valid protocol as given in
189.Pa /etc/protocols .
190Examples might be
191.Dq tcp
192or
193.Dq udp .
194RPC based services are specified with the
195.Dq rpc/tcp
196or
197.Dq rpc/udp
198service type.
199.Dq tcp
200and
201.Dq udp
202will be recognized as
203.Dq TCP or UDP over default IP version .
204This is currently IPv4, but in the future it will be IPv6.
205If you need to specify IPv4 or IPv6 explicitly, use something like
206.Dq tcp4
207or
208.Dq udp6 .
209A
210.Em protocol
211of
212.Dq unix
213is used to specify a socket in the
214.Ux Ns -domain .
215.Pp
216The
217.Em wait/nowait
218entry is used to tell
219.Nm
220if it should wait for the server program to return,
221or continue processing connections on the socket.
222If a datagram server connects
223to its peer, freeing the socket so
224.Nm inetd
225can receive further messages on the socket, it is said to be
226a
227.Dq multi-threaded
228server, and should use the
229.Dq nowait
230entry.
231For datagram servers which process all incoming datagrams
232on a socket and eventually time out, the server is said to be
233.Dq single-threaded
234and should use a
235.Dq wait
236entry.
237.Xr comsat 8
238.Pq Xr biff 1
239and
240.Xr talkd 8
241are both examples of the latter type of
242datagram server.
243.Xr tftpd 8
244is an exception; it is a datagram server that establishes pseudo-connections.
245It must be listed as
246.Dq wait
247in order to avoid a race;
248the server reads the first packet, creates a new socket,
249and then forks and exits to allow
250.Nm inetd
251to check for new service requests to spawn new servers.
252The optional
253.Dq max
254suffix (separated from
255.Dq wait
256or
257.Dq nowait
258by a dot) specifies the maximum number of times a service can be invoked
259in one minute; the default is 256.
260If a service exceeds this limit,
261.Nm
262will log the problem
263and stop servicing requests for the specific service for ten minutes.
264See also the
265.Fl R
266option above.
267.Pp
268Stream servers are usually marked as
269.Dq nowait
270but if a single server process is to handle multiple connections, it may be
271marked as
272.Dq wait .
273The master socket will then be passed as fd 0 to the server, which will then
274need to accept the incoming connection.
275The server should eventually time
276out and exit when no more connections are active.
277.Nm
278will continue to
279listen on the master socket for connections, so the server should not close
280it when it exits.
281.Pp
282The
283.Em user
284entry should contain the user name of the user as whom the server
285should run.
286This allows for servers to be given less permission
287than root.
288An optional group name can be specified by appending a dot to
289the user name followed by the group name.
290This allows for servers to run with
291a different (primary) group ID than specified in the password file.
292If a group
293is specified and user is not root, the supplementary groups associated with
294that user will still be set.
295.Pp
296The
297.Em server program
298entry should contain the pathname of the program which is to be
299executed by
300.Nm inetd
301when a request is found on its socket.
302If
303.Nm inetd
304provides this service internally, this entry should
305be
306.Dq internal .
307.Pp
308The
309.Em server program arguments
310should be just as arguments
311normally are, starting with argv[0], which is the name of
312the program.
313If the service is provided internally, the word
314.Dq internal
315should take the place of this entry.
316.Pp
317.Nm inetd
318provides several
319.Dq trivial
320services internally by use of routines within itself.
321These services are
322.Dq echo ,
323.Dq discard ,
324.Dq chargen
325(character generator),
326.Dq daytime
327(human readable time), and
328.Dq time
329(machine readable time,
330in the form of the number of seconds since midnight, January
3311, 1900).
332All of these services are TCP based.
333For details of these services, consult the appropriate
334.Tn RFC
335from the Network Information Center.
336.Pp
337.Nm inetd
338rereads its configuration file when it receives a hangup signal,
339.Dv SIGHUP .
340Services may be added, deleted or modified when the configuration file
341is reread.
342.Nm inetd
343creates a file
344.Em /var/run/inetd.pid
345that contains its process identifier.
346.Ss IPv6 TCP/UDP behavior
347If you wish to run a server for IPv4 and IPv6 traffic,
348you'll need to run two separate processes for the same server program,
349specified as two separate lines in
350.Pa inetd.conf ,
351for
352.Dq tcp4
353and
354.Dq tcp6 .
355.Pp
356Under various combinations of IPv4/v6 daemon settings,
357.Nm
358will behave as follows:
359.Bl -bullet -compact
360.It
361If you have only one server on
362.Dq tcp4 ,
363IPv4 traffic will be routed to the server.
364IPv6 traffic will not be accepted.
365.It
366If you have two servers on
367.Dq tcp4
368and
369.Dq tcp6 ,
370IPv4 traffic will be routed to the server on
371.Dq tcp4 ,
372and IPv6 traffic will go to server on
373.Dq tcp6 .
374.It
375If you have only one server on
376.Dq tcp6 ,
377only IPv6 traffic will be routed to the server.
378.El
379.Sh SEE ALSO
380.Xr comsat 8 ,
381.Xr fingerd 8 ,
382.Xr ftp-proxy 8 ,
383.Xr ftpd 8 ,
384.Xr identd 8 ,
385.Xr rshd 8 ,
386.Xr talkd 8 ,
387.Xr tftpd 8
388.Sh HISTORY
389The
390.Nm
391command appeared in
392.Bx 4.3 .
393Support for Sun-RPC
394based services is modelled after that
395provided by SunOS 4.1.
396IPv6 support was added by the KAME project in 1999.
397.Sh BUGS
398Host address specifiers, while they make conceptual sense for RPC
399services, do not work entirely correctly.
400This is largely because the
401portmapper interface does not provide a way to register different ports
402for the same service on different local addresses.
403Provided you never
404have more than one entry for a given RPC service, everything should
405work correctly.
406(Note that default host address specifiers do apply to
407RPC lines with no explicit specifier.)
408