summaryrefslogtreecommitdiffabout
path: root/doc/inetd.texi
blob: c1413ffc60b32e5203f704fe37e0e1baafc27f5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
@c This is part of the GNU Pies manual.
@c Copyright (C) 2009, 2010, 2013 Sergey Poznyakoff
@c This file is distributed under GFDL 1.3 or any later version
@c published by the Free Software Foundation.

  This appendix describes the format of @command{inetd} compatible
configuration files.  @xref{inetd}, for the discussion on how to
use such files with GNU @command{pies}.

  The @command{inetd} configuration file has line oriented format.
Comments are denoted by a @samp{#} at the beginning of a line.  Empty
lines and comments are ignored.  Each non-empty line must be either
a service definition, or address specification.

  @dfn{Service definition} consists of at least 6 fields separated by
any amount of the white space.  These fields are described in the
following table (optional parts are enclosed in
square brackets):

@table @asis
@item [service-node:]service-name
@flindex /etc/services
The service-name entry is the name of a valid service in the file
@file{/etc/services}.  For built-in services (@pxref{builtin}),
the service name must be the official name of the service 
(that is, the first entry in @file{/etc/services}), or a numeric
representation thereof.  For TCPMUX services, the value of the
@samp{service name} field consists of the string @samp{tcpmux}
followed by a slash and the locally-chosen service name
(@pxref{TCPMUX}).  Optionally, a plus sign may be inserted after the
slash, indicating that @command{pies} must issue a @samp{+} response
before starting this server.

@cartouche
The @samp{service-name} part corresponds to component tag
in @file{pies.conf} (@pxref{Component Statement}).  For built-in
components, it corresponds to the @code{service} statement
(@pxref{builtin, service}).
@end cartouche

Optional @samp{service-node} prefix is allowed for internet services.
When present, it supplies the local addresses @command{inetd} should
listen on for that service.  @samp{Service-node} consists of
a comma-separated list of addresses.  Both symbolic host names and
numeric IP addresses are allowed.  Symbolic hostnames are looked up in
DNS service.  If a hostname has multiple address mappings, a socket
is created to listen on each address.  A special hostname @samp{*}
stands for @code{INADDR_ANY}.

@item socket type
The socket type should be one of @samp{stream}, @samp{dgram},
@samp{raw}, @samp{rdm}, or @samp{seqpacket}.  TCPMUX services must use
@samp{stream}.

@cartouche
This field corresponds to the @code{socket-type} statement in
@file{pies.conf}.  @xref{socket-type}.
@end cartouche

@item protocol
@flindex /etc/protocols
The protocol must be a valid protocol as given in
@file{/etc/protocols}.  Examples might be @samp{tcp} or @samp{udp}.
TCPMUX services must use @samp{tcp}.

@cartouche
The @samp{service-node} prefix and @samp{socket-type} field correspond
to the @code{socket} statement in @file{pies.conf}.
@xref{inetd-socket}.

For example, the following line:

@smallexample
10.0.0.1:ftp dgram   udp     wait    root  ftpd
@end smallexample

@noindent
is equivalent to

@smallexample
  socket inet+udp://10.0.0.1:ftp;
  socket-typle dgram;
@end smallexample
@end cartouche

@item wait/nowait[.max-rate]
The @samp{wait/nowait} entry specifies whether the invoked component
will take over the socket associated with the service access point,
and thus whether @command{pies} should wait for the server to exit
before listening for new service requests.  Datagram servers must use
@samp{wait}, as they are always invoked with the original datagram
socket bound to the specified service address.  These servers must
read at least one datagram from the socket before exiting.  If a
datagram server connects to its peer, freeing the socket so that
@command{pies} can go on receiving further messages from the socket,
it is  said to be a @dfn{multi-threaded} server; it should read one
datagram from the socket and create a new socket connected to the
peer.  It should fork, and the parent should then exit to allow
@command{pies} to check for new service requests to spawn new servers.
Datagram servers which process all incoming datagrams on a socket and
eventually time out are said to be @dfn{single-threaded}.  Examples of
such servers are @command{comsat} and @command{talkd}.
@command{tftpd} is an example of a multi-threaded datagram server.

Servers using stream sockets generally are multi-threaded and use the
@samp{nowait} entry.  Connection requests for these services are
accepted by @command{pies}, and the server is given only the
newly-accepted socket connected to a client of the service.  Most
stream-based services and all TCPMUX services operate in this manner.
For such services, the invocation rate may be limited by specifying
optional @samp{max-rate} suffix (a decimal number), e.g.:
@samp{nowait.15}. 

Stream-based servers that use @samp{wait} are started with the
listening service socket, and must accept at least one connection
request before exiting.  Such a server would normally accept and
process incoming connection requests until a timeout.  Datagram
services must use @samp{nowait}.  The only stream server marked as
@samp{wait} is @command{identd} (@pxref{identd,,,identd(1),identd manual}).

@cartouche
The @samp{wait} field corresponds to @code{flags wait} in the
@file{pies.conf} file.  The @samp{nowait} corresponds to @code{flags
nowait}.  @xref{flags}.

The @samp{max-rate} suffix corresponds to the @code{max-rate}
statement.  @xref{max-rate}.
@end cartouche

@item user
The user entry contains the name of the user as whom the
component should run.  This allows for components to be given less
permission than root.

@cartouche
This corresponds to the @code{user} statement in @file{pies.conf}.
@xref{Component Privileges, user}.
@end cartouche

@item program
The program entry contains the full file name of the program
which is to be executed by @command{pies} when a request arrives
on its socket.  For built-in services, this entry should
be @samp{internal}.

It is common usage to specify @file{/usr/sbin/tcpd} in this field.

@cartouche
This field corresponds to the @code{program} statement in @file{pies.conf}.
@xref{Component Statement, program}.
@end cartouche

@item server program arguments
The server program arguments should be just as arguments normally are,
starting with @code{argv[0]}, which is the name of the program.  For
built-in services, this entry must contain the word @samp{internal},
or be empty.

@cartouche
This corresponds to the @code{command} statement.  @xref{Component
Statement, command}.
@end cartouche
@end table

  @dfn{Address specification} is a special statement that declares the
@samp{service-node} part (see above) for all the services declared
below it.  It consists of a host address specifier
followed by a colon on a single line, e.g.:

@smallexample
127.0.0.1,192.168.0.5:
@end smallexample

The address specifier from such a line is remembered and used for all
further lines lacking an explicit host specifier.  It remains in
effect until another address specification or end of the 
configuration is encountered, whichever occurs first.

The following address specification:

@smallexample
*:
@end smallexample

@noindent
causes any previous default address specifier to be forgotten.

An example of @file{inetd.conf} file with various services follows:

@smallexample
ftp            stream  tcp nowait root  /usr/libexec/ftpd    ftpd -l
ntalk          dgram   udp wait   root  /usr/libexec/ntalkd  ntalkd
tcpmux         stream  tcp nowait root  internal
tcpmux/+scp-to stream  tcp nowait guest /usr/sbin/in.wydawca wydawca
tcpmux/docref  stream  tcp nowait guest /usr/bin/docref      docref
@end smallexample

     




  

Return to:

Send suggestions and report system problems to the System administrator.