1 .\" $NetBSD: inetd.8,v 1.49 2008/08/27 19:55:20 elric Exp $
3 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
8 .\" NASA Ames Research Center.
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
19 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 .\" POSSIBILITY OF SUCH DAMAGE.
31 .\" Copyright (c) 1985, 1991 The Regents of the University of California.
32 .\" All rights reserved.
34 .\" Redistribution and use in source and binary forms, with or without
35 .\" modification, are permitted provided that the following conditions
37 .\" 1. Redistributions of source code must retain the above copyright
38 .\" notice, this list of conditions and the following disclaimer.
39 .\" 2. Redistributions in binary form must reproduce the above copyright
40 .\" notice, this list of conditions and the following disclaimer in the
41 .\" documentation and/or other materials provided with the distribution.
42 .\" 3. Neither the name of the University nor the names of its contributors
43 .\" may be used to endorse or promote products derived from this software
44 .\" without specific prior written permission.
46 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
47 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
50 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 .\" from: @(#)inetd.8 8.4 (Berkeley) 6/1/94
72 .Op Ar configuration file
75 should be run at boot time by
79 It then opens sockets according to its configuration and listens
81 When a connection is found on one of its sockets, it decides what
82 service the socket corresponds to, and invokes a program to service
84 After the program is finished, it continues to listen on the socket
85 (except in some cases which will be described below).
88 allows running one daemon to invoke several others,
89 reducing load on the system.
91 The options available for
97 Turns on libwrap connection logging.
102 reads its configuration information from a configuration
103 file which, by default, is
104 .Pa /etc/inetd.conf .
105 The path given for this configuration file must be absolute, unless
108 option is also given on the command line.
109 There must be an entry for each field of the configuration
110 file, with entries for each field separated by a tab or
112 Comments are denoted by a ``#'' at the beginning of a line.
113 There must be an entry for each field (except for one
114 special case, described below).
115 The fields of the configuration file are as follows:
117 .Bd -unfilled -offset indent -compact
119 socket-type[:accept_filter]
120 protocol[,sndbuf=size][,rcvbuf=size]
124 server program arguments
129 based service, the entry would contain these fields:
131 .Bd -unfilled -offset indent -compact
134 rpc/protocol[,sndbuf=size][,rcvbuf=size]
138 server program arguments
141 To specify a UNIX-domain (local) socket, the entry would contain
144 .Bd -unfilled -offset indent -compact
147 unix[,sndbuf=size][,rcvbuf=size]
151 server program arguments
154 For Internet services, the first field of the line may also have a host
155 address specifier prefixed to it, separated from the service name by a colon.
156 If this is done, the string before the colon in the first field
157 indicates what local address
159 should use when listening for that service, or the single character
164 .Sq all local addresses .
165 To avoid repeating an address that occurs frequently, a line with a
166 host address specifier and colon, but no further fields, causes the
167 host address specifier to be remembered and used for all further lines
168 with no explicit host specifier (until another such line or the end of
172 is implicitly provided at the top of the file; thus, traditional
173 configuration files (which have no host address specifiers) will be
174 interpreted in the traditional manner, with all services listened for
175 on all local addresses.
179 entry is the name of a valid service in
184 services (discussed below), the service
187 be the official name of the service (that is, the first entry in
188 .Pa /etc/services ) .
189 When used to specify a
191 based service, this field is a valid RPC service name in
194 The part on the right of the
196 is the RPC version number.
197 This can simply be a single numeric argument or a range of versions.
198 A range is bounded by the low version to the high version \-
210 depending on whether the socket is a stream, datagram, raw,
211 reliably delivered message, or sequenced packet socket.
215 can be specified by appending a colon to the socket-type, followed by
216 the name of the desired accept filter. In this case
218 will not see new connections for the specified service until the accept
219 filter decides they are ready to be handled.
223 must be a valid protocol as given in
231 Rpc based services are specified with the
239 will be recognized as
240 .Dq TCP or UDP over default IP version .
241 It is currently IPv4, but in the future it will be IPv6.
242 If you need to specify IPv4 or IPv6 explicitly, use something like
246 If you would like to enable special support for
255 In addition to the protocol, the configuration file may specify the
256 send and receive socket buffer sizes for the listening socket.
257 This is especially useful for
259 as the window scale factor, which is based on the receive socket
260 buffer size, is advertised when the connection handshake occurs,
261 thus the socket buffer size for the server must be set on the listen socket.
262 By increasing the socket buffer sizes, better
264 performance may be realized in some situations.
265 The socket buffer sizes are specified by appending their values to
266 the protocol specification as follows:
267 .Bd -literal -offset indent
270 tcp,rcvbuf=64k,sndbuf=1m
273 A literal value may be specified, or modified using
275 to indicate kilobytes or
277 to indicate megabytes.
278 Socket buffer sizes may be specified for all
279 services and protocols except for tcpmux services.
283 entry is used to tell
285 if it should wait for the server program to return,
286 or continue processing connections on the socket.
287 If a datagram server connects
288 to its peer, freeing the socket so
290 can receive further messages on the socket, it is said to be
293 server, and should use the
296 For datagram servers which process all incoming datagrams
297 on a socket and eventually time out, the server is said to be
306 are both examples of the latter type of
309 is an exception; it is a datagram server that establishes pseudo-connections.
312 in order to avoid a race;
313 the server reads the first packet, creates a new socket,
314 and then forks and exits to allow
316 to check for new service requests to spawn new servers.
319 suffix (separated from
323 by a dot or a colon) specifies the maximum number of server instances that may
326 within an interval of 60 seconds.
330 If it reaches this maximum spawn rate,
332 will log the problem (via the syslogger using the LOG_DAEMON
333 facility and LOG_ERR level)
334 and stop handling the specific service for ten minutes.
336 Stream servers are usually marked as
338 but if a single server process is to handle multiple connections, it may be
341 The master socket will then be passed as fd 0 to the server, which will then
342 need to accept the incoming connection.
343 The server should eventually time
344 out and exit when no more connections are active.
347 listen on the master socket for connections, so the server should not close
350 is usually the only stream server marked as wait.
354 entry should contain the user name of the user as whom the server should run.
355 This allows for servers to be given less permission than root.
356 Optionally, a group can be specified by appending a colon to the user name,
357 followed by the group name (it is possible to use a dot (``.'') in lieu of a
358 colon, however this feature is provided only for backward compatibility).
359 This allows for servers to run with a different (primary) group id than
360 specified in the password file.
361 If a group is specified and
363 is not root, the supplementary groups associated with that user will still be
368 entry should contain the pathname of the program which is to be
371 when a request is found on its socket.
374 provides this service internally, this entry should
379 .Em server program arguments
380 should be just as arguments
381 normally are, starting with argv[0], which is the name of
383 If the service is provided internally, the
386 should take the place of this entry.
387 It is possible to quote an argument using either single or double quotes.
388 This allows you to have, e.g., spaces in paths and parameters.
389 .Ss Internal Services
393 services internally by use of routines within itself.
398 (character generator),
400 (human readable time), and
402 (machine readable time,
403 in the form of the number of seconds since midnight, January 1, 1900 GMT).
404 For details of these services, consult the appropriate
407 TCP services without official port numbers can be handled with the
408 RFC1078-based tcpmux internal service.
409 TCPmux listens on port 1 for requests.
410 When a connection is made from a foreign host, the service name
411 requested is passed to TCPmux, which performs a lookup in the
412 service name table provided by
414 and returns the proper entry for the service.
415 TCPmux returns a negative reply if the service doesn't exist,
416 otherwise the invoked server is expected to return the positive
417 reply if the service type in
421 If the service type has the
424 TCPmux will return the positive reply for the
425 process; this is for compatibility with older server code, and also
426 allows you to invoke programs that use stdin/stdout without putting any
427 special server code in them.
428 Services that use TCPmux are
430 because they do not have a well-known port number and hence cannot listen
434 rereads its configuration file when it receives a hangup signal,
436 Services may be added, deleted or modified when the configuration file
440 .Em /var/run/inetd.pid
441 that contains its process identifier.
445 wrappers is included with
447 to provide internal tcpd-like access control functionality.
448 An external tcpd program is not needed.
449 You do not need to change the
451 server-program entry to enable this capability.
457 for access control facility configurations, as described in
462 wrappers do not affect/restrict
464 or internal services.
466 The implementation includes a tiny hack to support IPsec policy settings for
468 A special form of the comment line, starting with
470 is used as a policy specifier.
471 The content of the above comment line will be treated as a IPsec policy string,
473 .Xr ipsec_set_policy 3 .
474 Multiple IPsec policy strings may be specified by using a semicolon
476 If conflicting policy strings are found in a single line,
477 the last string will take effect.
480 line affects all of the following lines in
481 .Pa /etc/inetd.conf ,
482 so you may want to reset the IPsec policy by using a comment line containing
485 .Pq with no policy string .
487 If an invalid IPsec policy string appears in
488 .Pa /etc/inetd.conf ,
490 logs an error message using
492 and terminates itself.
493 .Ss IPv6 TCP/UDP behavior
494 If you wish to run a server for IPv4 and IPv6 traffic,
495 you'll need to run two separate process for the same server program,
496 specified as two separate lines on
497 .Pa /etc/inetd.conf ,
503 means TCP on top of currently-default IP version,
504 which is, at this moment, IPv4.
506 Under various combination of IPv4/v6 daemon settings,
508 will behave as follows:
511 If you have only one server on
513 IPv4 traffic will be routed to the server.
514 IPv6 traffic will not be accepted.
516 If you have two servers on
520 IPv4 traffic will be routed to the server on
522 and IPv6 traffic will go to server on
525 If you have only one server on
527 only IPv6 traffic will be routed to the server.
528 The kernel may route to the server IPv4 traffic as well,
529 under certain configuration.
535 .Bl -tag -width /etc/hosts.allow -compact
536 .It Pa /etc/inetd.conf
537 configuration file for all
541 service name to protocol and port number mappings.
542 .It Pa /etc/protocols
543 protocol name to protocol number mappings
546 service name to service number mappings.
547 .It Pa /etc/hosts.allow
548 explicit remote host access list.
549 .It Pa /etc/hosts.deny
550 explicit remote host denial of service list.
554 .Xr hosts_options 5 ,
578 .%T "Discard Protocol"
585 .%T "Character Generator Protocol"
592 .%T "Daytime Protocol"
607 .%T "TCP port service Multiplexer (TCPMUX)"
616 based services is modeled after that
617 provided by SunOS 4.1.
618 Support for specifying the socket buffer sizes was added in
620 In November 1996, libwrap support was added to provide
621 internal tcpd-like access control functionality;
622 libwrap is based on Wietse Venema's tcp_wrappers.
623 IPv6 support and IPsec hack was made by KAME project, in 1999.
625 Host address specifiers, while they make conceptual sense for RPC
626 services, do not work entirely correctly.
627 This is largely because the portmapper interface does not provide
628 a way to register different ports for the same service on different
630 Provided you never have more than one entry for a given RPC service,
631 everything should work correctly (Note that default host address
632 specifiers do apply to RPC lines with no explicit specifier.)
635 on IPv6 is not tested enough.
636 .Sh SECURITY CONSIDERATIONS
642 built-in trivial services is not recommended because remote
643 users may abuse these to cause a denial of network service to
644 or from the local host.