Debian Codegraph @

upstream/debian-unstable/man8/inetd.8

raw
1 .\" $OpenBSD: inetd.8,v 1.41 2017/10/04 19:52:26 jca 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: February 10 2020 $
32 .Dt INETD 8
33 .Os
34 .Sh NAME
35 .Nm inetd ,
36 .Nm inetd.conf
37 .Nd internet super-server
38 .Sh SYNOPSIS
39 .Nm inetd
40 .Op Fl d
41 .Op Fl E
42 .Op Fl i
43 .Op Fl l
44 .Op Fl q Ar length
45 .Op Fl R Ar rate
46 .Op Ar configuration_file
47 .Sh DESCRIPTION
48 .Nm inetd
49 listens for connections on certain internet sockets.
50 When a connection is found on one
51 of its sockets, it decides what service the socket
52 corresponds to, and invokes a program to service the request.
53 After the program is
54 finished, it continues to listen on the socket (except in some cases which
55 will be described below).
56 Essentially,
57 .Nm inetd
58 allows running one daemon to invoke several others,
59 reducing load on the system.
60 .Pp
61 The options are as follows:
62 .Bl -tag -width Ds
63 .It Fl d
64 Turns on debugging.
65 .It Fl E
66 Prevents
67 .Nm inetd
68 from laundering the environment. Without this option a selection of
69 potentially harmful environment variables, including
70 .Pa PATH ,
71 will be removed and not inherited by services.
72 .It Fl i
73 Makes the program not daemonize itself.
74 .It Fl l
75 Turns on libwrap connection logging and access control.
76 Internal services cannot be wrapped. When enabled,
77 .Pa /usr/sbin/tcpd
78 is silently not executed even if present in
79 .Pa /etc/inetd.conf
80 and instead libwrap is called directly by inetd.
81 .It Fl q Ar length
82 Specify the length of the
83 .Xr listen 2
84 connections queue; the default is 128.
85 .It Fl R Ar rate
86 Specify the maximum number of times a service can be invoked
87 in one minute; the default is 256.
88 If a service exceeds this limit,
89 .Nm
90 will log the problem
91 and stop servicing requests for the specific service for ten minutes.
92 See also the wait/nowait configuration fields below.
93 .El
94 .Pp
95 Upon execution,
96 .Nm inetd
97 reads its configuration information from a configuration
98 file which, by default, is
99 .Pa /etc/inetd.conf .
100 There must be an entry for each field of the configuration
101 file, with entries for each field separated by a tab or
102 a space.
103 Comments are denoted by a
104 .Dq #
105 at the beginning
106 of a line.
107 The fields of the configuration file are as follows:
108 .Bd -unfilled -offset indent
109 service name
110 socket type
111 protocol[,sndbuf=size][,rcvbuf=size]
112 wait/nowait[.max]
113 user[.group] or user[:group]
114 server program
115 server program arguments
116 .Ed
117 .Pp
118 To specify a Sun-RPC
119 based service, the entry would contain these fields.
120 .Bd -unfilled -offset indent
121 service name/version
122 socket type
123 rpc/protocol[,sndbuf=size][,rcvbuf=size]
124 wait/nowait[.max]
125 user[.group] or user[:group]
126 server program
127 server program arguments
128 .Ed
129 .Pp
130 For internet services, the first field of the line may also have a host
131 address specifier prefixed to it, separated from the service name by a
132 colon.
133 If this is done, the string before the colon in the first field
134 indicates what local address
135 .Nm
136 should use when listening for that service.
137 Multiple local addresses
138 can be specified on the same line, separated by commas.
139 Numeric IP
140 addresses in dotted-quad notation can be used as well as symbolic
141 hostnames.
142 Symbolic hostnames are looked up using
143 .Fn getaddrinfo .
144 If a hostname has multiple address mappings, inetd creates a socket
145 to listen on each address.
146 .Pp
147 The single character
148 .Dq \&*
149 indicates
150 .Dv INADDR_ANY ,
151 meaning
152 .Dq all local addresses .
153 To avoid repeating an address that occurs frequently, a line with a
154 host address specifier and colon, but no further fields, causes the
155 host address specifier to be remembered and used for all further lines
156 with no explicit host specifier (until another such line or the end of
157 the file).
158 A line
159 .Dl *:
160 is implicitly provided at the top of the file; thus, traditional
161 configuration files (which have no host address specifiers) will be
162 interpreted in the traditional manner, with all services listened for
163 on all local addresses.
164 If the protocol is
165 .Dq unix ,
166 this value is ignored.
167 .Pp
168 The
169 .Em service name
170 entry is the name of a valid service in
171 the file
172 .Pa /etc/services
173 or a port number.
174 For
175 .Dq internal
176 services (discussed below), the service
177 name
178 .Em must
179 be the official name of the service (that is, the first entry in
180 .Pa /etc/services ) .
181 When used to specify a Sun-RPC
182 based service, this field is a valid RPC service name in
183 the file
184 .Pa /etc/rpc .
185 The part on the right of the
186 .Dq /
187 is the RPC version number.
188 This can simply be a single numeric argument or a range of versions.
189 A range is bounded by the low version to the high version -
190 .Dq rusers/1\-3 .
191 For
192 .Ux Ns -domain
193 sockets this field specifies the path name of the socket.
194 .Pp
195 The
196 .Em socket type
197 should be one of
198 .Dq stream
199 or
200 .Dq dgram ,
201 depending on whether the socket is a stream or datagram socket.
202 .Pp
203 The
204 .Em protocol
205 must be a valid protocol as given in
206 .Pa /etc/protocols or
207 .Dq unix .
208 Examples might be
209 .Dq tcp
210 or
211 .Dq udp .
212 RPC based services are specified with the
213 .Dq rpc/tcp
214 or
215 .Dq rpc/udp
216 service type.
217 .Dq tcp
218 and
219 .Dq udp
220 will be recognized as
221 .Dq TCP or UDP over both IPv4 and IPv6.
222 If you need to specify IPv4 or IPv6 explicitly, use something like
223 .Dq tcp4
224 or
225 .Dq udp6 .
226 A
227 .Em protocol
228 of
229 .Dq unix
230 is used to specify a socket in the
231 .Ux Ns -domain .
232 .Pp
233 In addition to the protocol, the configuration file may specify the
234 send and receive socket buffer sizes for the listening socket.
235 This is especially useful for
236 .Tn TCP
237 as the window scale factor, which is based on the receive socket
238 buffer size, is advertised when the connection handshake occurs,
239 thus the socket buffer size for the server must be set on the listen socket.
240 By increasing the socket buffer sizes, better
241 .Tn TCP
242 performance may be realized in some situations.
243 The socket buffer sizes are specified by appending their values to
244 the protocol specification as follows:
245 .Bd -literal -offset indent
246 tcp,rcvbuf=16384
247 tcp,sndbuf=64k
248 tcp,rcvbuf=64k,sndbuf=1m
249 .Ed
250 .Pp
251 A literal value may be specified, or modified using
252 .Sq k
253 to indicate kilobytes or
254 .Sq m
255 to indicate megabytes.
256 .Pp
257 The
258 .Em wait/nowait
259 entry is used to tell
260 .Nm
261 if it should wait for the server program to return,
262 or continue processing connections on the socket.
263 If a datagram server connects
264 to its peer, freeing the socket so
265 .Nm inetd
266 can receive further messages on the socket, it is said to be
267 a
268 .Dq multi-threaded
269 server, and should use the
270 .Dq nowait
271 entry.
272 For datagram servers which process all incoming datagrams
273 on a socket and eventually time out, the server is said to be
274 .Dq single-threaded
275 and should use a
276 .Dq wait
277 entry.
278 .Xr comsat 8
279 .Pq Xr biff 1
280 and
281 .Xr talkd 8
282 are both examples of the latter type of
283 datagram server.
284 The optional
285 .Dq max
286 suffix (separated from
287 .Dq wait
288 or
289 .Dq nowait
290 by a dot) specifies the maximum number of times a service can be invoked
291 in one minute; the default is 256.
292 If a service exceeds this limit,
293 .Nm
294 will log the problem
295 and stop servicing requests for the specific service for ten minutes.
296 See also the
297 .Fl R
298 option above.
299 .Pp
300 Stream servers are usually marked as
301 .Dq nowait
302 but if a single server process is to handle multiple connections, it may be
303 marked as
304 .Dq wait .
305 The master socket will then be passed as fd 0 to the server, which will then
306 need to accept the incoming connection.
307 The server should eventually time
308 out and exit when no more connections are active.
309 .Nm
310 will continue to
311 listen on the master socket for connections, so the server should not close
312 it when it exits.
313 .Pp
314 The
315 .Em user
316 entry should contain the user name of the user as whom the server
317 should run.
318 This allows for servers to be given less permission
319 than root.
320 An optional group name can be specified by appending a dot to
321 the user name followed by the group name.
322 This allows for servers to run with
323 a different (primary) group ID than specified in the password file.
324 If a group
325 is specified and user is not root, the supplementary groups associated with
326 that user will still be set.
327 .Pp
328 The
329 .Em server program
330 entry should contain the pathname of the program which is to be
331 executed by
332 .Nm inetd
333 when a request is found on its socket.
334 If
335 .Nm inetd
336 provides this service internally, this entry should
337 be
338 .Dq internal .
339 .Pp
340 The
341 .Em server program arguments
342 should be just as arguments
343 normally are, starting with argv[0], which is the name of
344 the program.
345 If the service is provided internally, the word
346 .Dq internal
347 should take the place of this entry.
348 .Pp
349 .Nm inetd
350 provides several
351 .Dq trivial
352 services internally by use of routines within itself.
353 These services are
354 .Dq echo ,
355 .Dq discard ,
356 .Dq chargen
357 (character generator),
358 .Dq daytime
359 (human readable time), and
360 .Dq time
361 (machine readable time,
362 in the form of the number of seconds since midnight, January
363 1, 1900).
364 All of these services are TCP based.
365 For details of these services, consult the appropriate RFC
366 from the Network Information Center.
367 .Pp
368 .Nm inetd
369 rereads its configuration file when it receives a hangup signal,
370 .Dv SIGHUP .
371 Services may be added, deleted or modified when the configuration file
372 is reread.
373 .Ss libwrap
374 Support for
375 .Tn TCP
376 wrappers is included with
377 .Nm
378 to provide built-in tcpd-like access control functionality.
379 An external tcpd program is not needed.
380 You do not need to change the
381 .Pa /etc/inetd.conf
382 server-program entry to enable this capability.
383 .Nm
384 uses
385 .Pa /etc/hosts.allow
386 and
387 .Pa /etc/hosts.deny
388 for access control facility configurations, as described in
389 .Xr hosts_access 5 .
390 .Ss IPv6 TCP/UDP behavior
391 The default is to run two servers: one for IPv4 and one for IPv6 traffic.
392 If you have different requirements then you may specify one or two
393 separate lines in
394 .Pa inetd.conf ,
395 for
396 .Dq tcp4
397 and
398 .Dq tcp6 .
399 .Pp
400 Under various combinations of IPv4/v6 daemon settings,
401 .Nm
402 will behave as follows:
403 .Bl -bullet -compact
404 .It
405 If you have only one server on
406 .Dq tcp4 ,
407 IPv4 traffic will be routed to the server.
408 IPv6 traffic will not be accepted.
409 .It
410 If you have two servers on
411 .Dq tcp4
412 and
413 .Dq tcp6 ,
414 IPv4 traffic will be routed to the server on
415 .Dq tcp4 ,
416 and IPv6 traffic will go to the server on
417 .Dq tcp6 ,
418 which is identical to the default behaviour when only
419 .Dq tcp
420 is specified.
421 .It
422 If you have only one server on
423 .Dq tcp6 ,
424 only IPv6 traffic will be routed to the server.
425 .Pp
426 The special
427 .Dq tcp46
428 parameter can be used for obsolete servers which require to receive IPv4
429 connections mapped in an IPv6 socket. Its usage is discouraged.
430 .El
431 .Sh FILES
432 .Bl -tag -width /etc/inetd.conf -compact
433 .It Pa /etc/inetd.conf
434 .El
435 .Sh SEE ALSO
436 .Xr fingerd 8 ,
437 .Xr ftpd 8 ,
438 .Xr identd 8 ,
439 .Xr talkd 8
440 .Sh HISTORY
441 The
442 .Nm
443 command appeared in
444 .Bx 4.3 .
445 Support for Sun-RPC
446 based services is modelled after that
447 provided by SunOS 4.1.
448 IPv6 support was added by the KAME project in 1999.
449 .Pp
450 Marco d'Itri ported this code from OpenBSD in summer 2002 and added
451 socket buffers tuning and libwrap support from the NetBSD source tree.
452 .Sh BUGS
453 On Linux systems, the daemon cannot reload its configuration and needs
454 to be restarted when the host address for a service is changed between
455 .Dq \&*
456 and a specific address.
457 .Pp
458 Server programs used with
459 .Dq dgram
460 .Dq udp
461 .Dq nowait
462 must read from the network socket, or
463 .Nm inetd
464 will spawn processes until the maximum is reached.
465 .Pp
466 Host address specifiers, while they make conceptual sense for RPC
467 services, do not work entirely correctly.
468 This is largely because the
469 portmapper interface does not provide a way to register different ports
470 for the same service on different local addresses.
471 Provided you never
472 have more than one entry for a given RPC service, everything should
473 work correctly.
474 (Note that default host address specifiers do apply to
475 RPC lines with no explicit specifier.)