~ubuntu-branches/ubuntu/saucy/inetutils/saucy-proposed

« back to all changes in this revision

Viewing changes to src/inetd.8

  • Committer: Package Import Robot
  • Author(s): Guillem Jover
  • Date: 2011-11-05 05:10:10 UTC
  • Revision ID: package-import@ubuntu.com-20111105051010-n4uve7f49wvqs6im
Tags: 2:1.8-5
* Move man pages from patches to actual files under debian/local/man/ to
  ease their modification, given that upstream has rejected including
  useful man pages there.
* Add a new inetutils-traceroute package providing a portable traceroute
  implementation for GNU/Hurd and GNU/kFreeBSD. (Closes: #610437)
  Thanks to Mats Erik Andersson <mats.andersson@gisladisker.se>.
* Do not link against unused shared libraries. This removes the following
  dependencies from binaries:
  - inetutils-inetd, inetutils-syslogd → libshishi0
  - inetutils-telnet, inetutils-telnetd → libncurses5
  - inetutils-ftp → libncurses5, libtinfo5
* Disable silent rules to get useful build logs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.\" Copyright (c) 1985, 1991, 1993, 1994
2
 
.\"     The Regents of the University of California.  All rights reserved.
3
 
.\"
4
 
.\" Redistribution and use in source and binary forms, with or without
5
 
.\" modification, are permitted provided that the following conditions
6
 
.\" are met:
7
 
.\" 1. Redistributions of source code must retain the above copyright
8
 
.\"    notice, this list of conditions and the following disclaimer.
9
 
.\" 2. Redistributions in binary form must reproduce the above copyright
10
 
.\"    notice, this list of conditions and the following disclaimer in the
11
 
.\"    documentation and/or other materials provided with the distribution.
12
 
.\" 4. Neither the name of the University nor the names of its contributors
13
 
.\"    may be used to endorse or promote products derived from this software
14
 
.\"    without specific prior written permission.
15
 
.\"
16
 
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17
 
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
 
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
 
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20
 
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
 
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
 
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
 
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
 
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
 
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
 
.\" SUCH DAMAGE.
27
 
.\"
28
 
.\"     @(#)inetd.8     8.4 (Berkeley) 6/1/94
29
 
.\"
30
 
.Dd October 21, 2006
31
 
.Dt INETD 8
32
 
.Os BSD 4.4
33
 
.Sh NAME
34
 
.Nm inetd
35
 
.Nd internet
36
 
.Dq super-server
37
 
.Sh SYNOPSIS
38
 
.Nm inetd
39
 
.Op Fl d
40
 
.Op Fl R Ar rate
41
 
.Op Fl -environment
42
 
.Op Fl -resolve
43
 
.Op Ar configuration_files ...
44
 
.Sh WARNING
45
 
The information in this man page may be inaccurate or incomplete.  The
46
 
authoritative documentation for the
47
 
.Nm inetd
48
 
utility is contained in
49
 
.Pa inetutils.info
50
 
document.  To access it from your command line, type
51
 
.Pp
52
 
\fBinfo inetd\fR
53
 
.Pp
54
 
The online copy of the documentation is available at the following
55
 
address:
56
 
.Pp
57
 
http://www.gnu.org/software/inetutils/manual.
58
 
.Sh DESCRIPTION
59
 
The
60
 
.Nm inetd
61
 
program
62
 
should be run at boot time by
63
 
.Pa /etc/rc
64
 
(see
65
 
.Xr rc 8 ) .
66
 
It then listens for connections on certain
67
 
internet sockets.  When a connection is found on one
68
 
of its sockets, it decides what service the socket
69
 
corresponds to, and invokes a program to service the request.
70
 
The server program is invoked with the service socket
71
 
as its standard input, output and error descriptors.
72
 
After the program is
73
 
finished,
74
 
.Nm inetd
75
 
continues to listen on the socket (except in some cases which
76
 
will be described below).  Essentially,
77
 
.Nm inetd
78
 
allows running one daemon to invoke several others,
79
 
reducing load on the system.
80
 
.Pp
81
 
The options available for
82
 
.Nm inetd:
83
 
.Bl -tag -width Ds
84
 
.It Fl d, -debug
85
 
Turns on debugging.
86
 
.It Fl -environment
87
 
Pass local and remote address data via environment variables. See
88
 
\fBENVIRONMENT\fP below.
89
 
.It Fl R, -rate Ar rate
90
 
Specifies the maximum number of times a service can be invoked
91
 
in one minute; the default is 40.
92
 
.It Fl -resolve
93
 
Resolve local and remote IP addresses and pass them to the server program
94
 
via \fBTCPLOCALHOST\fP and \fBTCPREMOTEHOST\fP environment variables. See
95
 
\fBENVIRONMENT\fP below. This option implies \fB--environment\fP.
96
 
.It Fl -version
97
 
Shows the version.
98
 
.It Fl -help
99
 
Shows the help.
100
 
.El
101
 
.Pp
102
 
Upon execution,
103
 
.Nm inetd
104
 
reads its configuration information from a configuration
105
 
file on the command line, by default,
106
 
.Pa /etc/inetd.conf and /etc/inetd.d .
107
 
If the configuration pathname is a directory, all the files in the
108
 
directory are read like a configuration file. All of the configuration
109
 
files are read and merged.  There must be an entry for each field in
110
 
the configuration file, with entries for each field separated by a tab
111
 
or a space.  Comments are denoted by a ``#'' at the beginning of a
112
 
line.  The fields of the configuration file are as follows:
113
 
.Pp
114
 
.Bd -unfilled -offset indent -compact
115
 
service name
116
 
socket type
117
 
protocol
118
 
wait/nowait[.max]
119
 
user
120
 
server program
121
 
server program arguments
122
 
.Ed
123
 
.Pp
124
 
There are two types of services that
125
 
.Nm inetd
126
 
can start: standard and TCPMUX.
127
 
A standard service has a well-known port assigned to it;
128
 
it may be a service that implements an official Internet standard or is a
129
 
BSD-specific service.
130
 
As described in
131
 
.Tn RFC 1078 ,
132
 
TCPMUX services are nonstandard services that do not have a
133
 
well-known port assigned to them.
134
 
They are invoked from
135
 
.Nm inetd
136
 
when a program connects to the
137
 
.Dq tcpmux
138
 
well-known port and specifies
139
 
the service name.
140
 
This feature is useful for adding locally-developed servers.
141
 
.Pp
142
 
The
143
 
.Em service-name
144
 
entry is the name of a valid service in
145
 
the file
146
 
.Pa /etc/services .
147
 
For
148
 
.Dq internal
149
 
services (discussed below), the service
150
 
name
151
 
.Em must
152
 
be the official name of the service (that is, the first entry in
153
 
.Pa /etc/services ) .
154
 
For TCPMUX services, the value of the
155
 
.Em service-name
156
 
field consists of the string
157
 
.Dq tcpmux
158
 
followed by a slash and the
159
 
locally-chosen service name.
160
 
The service names listed in
161
 
.Pa /etc/services
162
 
and the name
163
 
.Dq help
164
 
are reserved.
165
 
Try to choose unique names for your TCPMUX services by prefixing them with
166
 
your organization's name and suffixing them with a version number.
167
 
.Pp
168
 
The
169
 
.Em socket-type
170
 
should be one of
171
 
.Dq stream ,
172
 
.Dq dgram ,
173
 
.Dq raw ,
174
 
.Dq rdm ,
175
 
or
176
 
.Dq seqpacket ,
177
 
depending on whether the socket is a stream, datagram, raw,
178
 
reliably delivered message, or sequenced packet socket.
179
 
TCPMUX services must use
180
 
.Dq stream .
181
 
.Pp
182
 
The
183
 
.Em protocol
184
 
must be a valid protocol as given in
185
 
.Pa /etc/protocols .
186
 
Examples might be
187
 
.Dq tcp
188
 
or
189
 
.Dq udp .
190
 
TCPMUX services must use
191
 
.Dq tcp .
192
 
.Pp
193
 
The
194
 
.Em wait/nowait[.max]
195
 
entry specifies whether the server that is invoked by inetd will take over
196
 
the socket associated with the service access point, and thus whether
197
 
.Nm inetd
198
 
should wait for the server to exit before listening for new service
199
 
requests.
200
 
Datagram servers must use
201
 
.Dq wait ,
202
 
as they are always invoked with the original datagram socket bound
203
 
to the specified service address.
204
 
These servers must read at least one datagram from the socket
205
 
before exiting.
206
 
If a datagram server connects
207
 
to its peer, freeing the socket so
208
 
.Nm inetd
209
 
can received further messages on the socket, it is said to be
210
 
a
211
 
.Dq multi-threaded
212
 
server;
213
 
it should read one datagram from the socket and create a new socket
214
 
connected to the peer.
215
 
It should fork, and the parent should then exit
216
 
to allow
217
 
.Nm inetd
218
 
to check for new service requests to spawn new servers.
219
 
Datagram servers which process all incoming datagrams
220
 
on a socket and eventually time out are said to be
221
 
.Dq single-threaded .
222
 
.Xr Comsat 8 ,
223
 
.Pq Xr biff 1
224
 
and
225
 
.Xr talkd 8
226
 
are both examples of the latter type of
227
 
datagram server.
228
 
.Xr Tftpd 8
229
 
is an example of a multi-threaded datagram server.
230
 
The optional
231
 
.Dq max
232
 
suffix (separated from
233
 
.Dq wait
234
 
or
235
 
.Dq nowait
236
 
by a dot) specifies the maximum number of times a service can be invoked
237
 
in one minute; the default is 40.
238
 
If a service exceeds this limit,
239
 
.Nm
240
 
will log the problem
241
 
and stop servicing requests for the specific service for ten minutes.
242
 
See also the
243
 
.Fl R
244
 
option above.
245
 
.Pp
246
 
Servers using stream sockets generally are multi-threaded and
247
 
use the
248
 
.Dq nowait
249
 
entry.
250
 
Connection requests for these services are accepted by
251
 
.Nm inetd ,
252
 
and the server is given only the newly-accepted socket connected
253
 
to a client of the service.
254
 
Most stream-based services operate in this manner.
255
 
Stream-based servers that use
256
 
.Dq wait
257
 
are started with the listening service socket, and must accept
258
 
at least one connection request before exiting.
259
 
Such a server would normally accept and process incoming connection
260
 
requests until a timeout.
261
 
TCPMUX services must use
262
 
.Dq nowait .
263
 
.Pp
264
 
The optional
265
 
.Dq max
266
 
suffix (separated from
267
 
.Dq wait
268
 
or
269
 
.Dq nowait
270
 
by a dot) is a decimal number that specifies the maximum number of server
271
 
instances that may be spawned from
272
 
.Nm inetd
273
 
within an interval of 60 seconds.  It overrides the settings of the
274
 
\fB-R\fP command line option. 
275
 
.Pp
276
 
The
277
 
.Em user
278
 
entry should contain the user name of the user as whom the server
279
 
should run.  This allows for servers to be given less permission
280
 
than root.
281
 
.Pp
282
 
The
283
 
.Em server-program
284
 
entry should contain the pathname of the program which is to be
285
 
executed by
286
 
.Nm inetd
287
 
when a request is found on its socket.  If
288
 
.Nm inetd
289
 
provides this service internally, this entry should
290
 
be
291
 
.Dq internal .
292
 
.Pp
293
 
The
294
 
.Em server program arguments
295
 
should be just as arguments
296
 
normally are, starting with argv[0], which is the name of
297
 
the program.  If the service is provided internally, the
298
 
word
299
 
.Dq internal
300
 
should take the place of this entry.
301
 
.Pp
302
 
The
303
 
.Nm inetd
304
 
program
305
 
provides several
306
 
.Dq trivial
307
 
services internally by use of
308
 
routines within itself.  These services are
309
 
.Dq echo ,
310
 
.Dq discard ,
311
 
.Dq chargen
312
 
(character generator),
313
 
.Dq daytime
314
 
(human readable time), and
315
 
.Dq time
316
 
(machine readable time,
317
 
in the form of the number of seconds since midnight, January
318
 
1, 1900).  All of these services are tcp based.  For
319
 
details of these services, consult the appropriate
320
 
.Tn RFC
321
 
from the Network Information Center.
322
 
.Pp
323
 
The
324
 
.Nm inetd
325
 
program
326
 
rereads its configuration file when it receives a hangup signal,
327
 
.Dv SIGHUP .
328
 
Services may be added, deleted or modified when the configuration file
329
 
is reread.
330
 
.Sh TCPMUX
331
 
.Pp
332
 
.Tn RFC 1078
333
 
describes the TCPMUX protocol:
334
 
``A TCP client connects to a foreign host on TCP port 1.  It sends the
335
 
service name followed by a carriage-return line-feed <CRLF>.  The
336
 
service name is never case sensitive.  The server replies with a
337
 
single character indicating positive (+) or negative (\-)
338
 
acknowledgment, immediately followed by an optional message of
339
 
explanation, terminated with a <CRLF>.  If the reply was positive,
340
 
the selected protocol begins; otherwise the connection is closed.''
341
 
The program is passed the TCP connection as file descriptors 0 and 1.
342
 
.Pp
343
 
If the TCPMUX service name begins with a ``+'',
344
 
.Nm inetd
345
 
returns the positive reply for the program.
346
 
This allows you to invoke programs that use stdin/stdout
347
 
without putting any special server code in them.
348
 
.Pp
349
 
The special service name
350
 
.Dq help
351
 
causes
352
 
.Nm inetd
353
 
to list TCPMUX services in
354
 
.Pa inetd.conf .
355
 
.ne 1i
356
 
.Sh "ENVIRONMENT"
357
 
If a connection is made with a streaming protocol (TCP) and if
358
 
\fB--environment\fP option has been given, inetd will set
359
 
the following environment variables before starting the program:
360
 
.Pp
361
 
\fBPROTO\fP: always "TCP".
362
 
.Pp
363
 
\fBTCPLOCALIP\fP: the local IP address of the interface which accepted the connection.
364
 
.Pp
365
 
\fBTCPLOCALPORT\fP: the port number on which the TCP connection was established.
366
 
.Pp
367
 
\fBTCPREMOTEIP\fP: the IP address of the remote client.
368
 
.Pp
369
 
\fBTCPREMOTEPORT\fP: the port number on the client side of the TCP connection.
370
 
.Pp
371
 
In addition, if given the \fB--remote\fP option,
372
 
.Nm inetd
373
 
will set the following environment variables:
374
 
.Pp
375
 
\fBTCPLOCALHOST\fP: the DNS name of \fITCPLOCALIP\fR.
376
 
.Pp
377
 
\fBTCPREMOTEHOST\fP: the DNS name of \fITCPREMOTEIP\fR.
378
 
.Sh "EXAMPLES"
379
 
.Pp
380
 
Here are several example service entries for the various types of services:
381
 
.Bd -literal
382
 
ftp           stream  tcp   nowait root  /usr/libexec/ftpd       ftpd -l
383
 
ntalk         dgram   udp   wait   root  /usr/libexec/ntalkd     ntalkd
384
 
tcpmux/+date  stream  tcp   nowait guest /bin/date               date
385
 
tcpmux/phonebook stream tcp nowait guest /usr/local/bin/phonebook phonebook
386
 
.Ed
387
 
.Sh "ERROR MESSAGES"
388
 
The
389
 
.Nm inetd
390
 
server
391
 
logs error messages using
392
 
.Xr syslog 3 .
393
 
Important error messages and their explanations are:
394
 
.Bd -literal
395
 
\fIservice\fP/\fIprotocol\fP server failing (looping), service terminated.
396
 
.Ed
397
 
The number of requests for the specified service in the past minute
398
 
exceeded the limit. The limit exists to prevent a broken program
399
 
or a malicious user from swamping the system.
400
 
This message may occur for several reasons:
401
 
1) there are lots of hosts requesting the service within a short time period,
402
 
2) a 'broken' client program is requesting the service too frequently,
403
 
3) a malicious user is running a program to invoke the service in
404
 
a 'denial of service' attack, or
405
 
4) the invoked service program has an error that causes clients
406
 
to retry quickly.
407
 
Use the
408
 
.Op Fl R
409
 
option,
410
 
as described above, to change the rate limit.
411
 
Once the limit is reached, the service will be
412
 
reenabled automatically in 10 minutes.
413
 
.sp
414
 
.Bd -literal
415
 
\fIservice\fP/\fIprotocol\fP: No such user '\fIuser\fP', service ignored
416
 
\fIservice\fP/\fIprotocol\fP: getpwnam: \fIuser\fP: No such user
417
 
.Ed
418
 
No entry for
419
 
.Em user
420
 
exists in the
421
 
.Pa passwd
422
 
file. The first message
423
 
occurs when
424
 
.Nm inetd
425
 
(re)reads the configuration file. The second message occurs when the
426
 
service is invoked.
427
 
.sp
428
 
.Bd -literal
429
 
\fIservice\fP: can't set uid \fInumber\fP
430
 
\fIservice\fP: can't set gid \fInumber\fP
431
 
.Ed
432
 
The user or group ID for the entry's
433
 
.Em user
434
 
is invalid.
435
 
.Sh SEE ALSO
436
 
.Xr comsat 8 ,
437
 
.Xr fingerd 8 ,
438
 
.Xr ftpd 8 ,
439
 
.Xr rexecd 8 ,
440
 
.Xr rlogind 8 ,
441
 
.Xr rshd 8 ,
442
 
.Xr telnetd 8 ,
443
 
.Xr tftpd 8
444
 
.Sh BUGS
445
 
The environment variables (see \fBENVIRONMENT\fP) are set only for
446
 
TCP IPv4 nowait connections.
447
 
.Sh HISTORY
448
 
The
449
 
.Nm
450
 
command appeared in
451
 
.Bx 4.3 .
452
 
TCPMUX is based on code and documentation by Mark Lottor.