chiark / gitweb /
use libinn logging where applicable - debugged
[inn-innduct.git] / doc / pod / nnrpd.pod
1 =head1 NAME
2
3 nnrpd - NNTP server for reader clients
4
5 =head1 SYNOPSIS
6
7 B<nnrpd> [B<-DfnoSt>] [B<-b> I<address>] [B<-c> I<configfile>]
8 [B<-g> I<shadowgroup>>] [B<-i> I<initial>] [B<-I> I<instance>] [B<-p> I<port>]
9 [B<-P> I<prefork>] [B<-r> I<reason>] [B<-s> I<padding>]
10
11 =head1 DESCRIPTION
12
13 B<nnrpd> is an NNTP server for newsreaders.  It accepts commands on its
14 standard input and responds on its standard output.  It is normally
15 invoked by innd(8) with those descriptors attached to a remote client
16 connection.  B<nnrpd> also supports running as a standalone daemon.
17
18 Unlike innd(8) B<nnrpd> supports all NNTP commands for user-oriented
19 reading and posting.  B<nnrpd> uses the F<readers.conf> file to control
20 who is authorized to access the Usenet database.
21
22 On exit, B<nnrpd> will report usage statistics through syslog(3).
23
24 B<nnrpd> only reads config files (both F<readers.conf> and F<inn.conf>)
25 when it is spawned.  You can therefore never change the behavior of a
26 client that's already connected.  If B<nnrpd> is run from B<innd> (the
27 default) or from inetd(8), xinetd(8), or some equivalent, a new B<nnrpd>
28 process is spawned for every connection and therefore any changes to
29 configuration files will be immediately effective for all new
30 connections.  If you are instead running B<nnrpd> with the B<-D> option,
31 any configuration changes won't take effect until B<nnrpd> is restarted.
32
33 The F<inn.conf> setting I<nnrpdflags> can be used to pass any of the
34 options below to instances of B<nnrpd> that are spawned directly from
35 B<innd>.  Many options only make sense when B<-D> is used, so these
36 options should not be used with I<nnrpdflags>.  See also the discussion
37 of I<nnrpdflags> in inn.conf(5).
38
39 When I<nnrpdloadlimit> in F<inn.conf> is not 0, it will also reject
40 connections if the load average is greater than that value (typically 16).
41 B<nnrpd> can also prevent high-volume posters from abusing your
42 resources. See the discussion of exponential backoff in inn.conf(5).
43
44 =head1 OPTIONS
45
46 =over 4
47
48 =item B<-b> I<address>
49
50 The B<-b> parameter instructs B<nnrpd> to bind to the specified IP
51 address when started as a standalone daemon using the B<-D> flag. This
52 has to be a valid IPv4 or IPv6 address belonging to an interface of
53 the local host.  It can also be ::0 (although the default is 0.0.0.0
54 if unspecified).
55
56 =item B<-c> I<configfile>
57
58 By default, B<nnrpd> reads the F<readers.conf> to determine how to
59 authenticate connections.  The B<-c> flag specifies an alternate file
60 for this purpose.  If the file name isn't fully qualified, it is taken
61 to be relative to I<pathetc> in F<inn.conf> (this is useful to have
62 several instances of B<nnrpd> running on different ports or IP
63 addresses with different settings.)
64
65 =item B<-D>
66
67 If specified, this parameter causes B<nnrpd> to operate as a
68 daemon. That is, it detaches itself and runs in the background,
69 forking a process for every connection. By default B<nnrpd> listens on
70 the NNTP port (119), so either innd(8) has to be started on another
71 port or B<nnrpd> B<-p> parameter.  Note that with this parameter,
72 B<nnrpd> continues running until killed.  This means that it reads
73 F<inn.conf> once on startup and never again until restarted. B<nnrpd>
74 should therefore be restarted if inn.conf is changed.
75
76 When started in daemon mode, B<nnrpd> will write its PID into a file in
77 the I<pathrun> directory.  The file will be named F<nnrpd-%d.pid>, where
78 C<%d> is replaced with the port that B<nnrpd> is configured to listen on
79 (119 unless the B<-p> option is given).
80
81 =item B<-f>
82
83 If specified, B<nnrpd> does not detach itself and runs in the
84 foreground when started as a standalone daemon using the B<-D> flag.
85
86 =item B<-g> I<shadowgroup>
87
88 On systems that have a shadow password file, B<nnrpd> tries to add the
89 group I<shadow> as a supplementary group if it is running in
90 standalone mode. On many systems, members of that group have read
91 permission for the shadow password file. The B<-g> parameter instructs
92 B<nnrpd> to try to add the named group as a supplementary group on
93 shadow systems instead of I<shadow>. This only works if
94 C<HAVE_GETSPNAM> in F<include/config.h> is defined and B<nnrpd> is
95 running in standalone mode since this call only works when B<nnrpd> is
96 started as root.
97
98 =item B<-i> I<initial>
99
100 Specify an initial command to B<nnrpd>. When used, I<initial> is taken
101 as if it were the first command received by B<nnrpd>.
102
103 =item B<-I> I<instance>
104
105 If specified I<instance> is used as an additional static portion
106 within MessageIDs generated by B<nnrpd>; typically this option would
107 be used where a cluster of machines exist with the same virtual
108 hostname and must be disambiguated during posts.
109
110 =item B<-n>
111
112 The B<-n> flag turns off resolution of IP addresses to names.  If you
113 only use IP-based restrictions in F<readers.conf> and can handle IP
114 addresses in your logs, using this flag may result in some additional
115 speed.
116
117 =item B<-o>
118
119 The B<-o> flag causes all articles to be spooled instead of sending
120 them to innd(8). B<rnews> with the B<-U> flag should be invoked from
121 cron on a regular basis to take care of these articles. This flag is
122 useful if innd(8) in accepting articles and B<nnrpd> is started
123 standalone or using inetd(8).
124
125 =item B<-p> I<port>
126
127 The B<-p> parameter instructs B<nnrpd> to listen on I<port> when
128 started as a standalone daemon using the B<-D> flag.
129
130 =item B<-P> I<prefork>
131
132 The B<-P> parameter instructs B<nnrpd> to prefork I<prefork> children
133 awaiting connections when started as a standalone daemon using the
134 B<-D> flag.
135
136 =item B<-r> I<reason>
137
138 If the B<-r> flag is used, then B<nnrpd> will reject the incoming
139 connection giving I<reason> as the text. This flag is used by innd(8)
140 when it is paused or throttled.
141
142 =item B<-s> I<padding>
143
144 As each command is received, B<nnrpd> tries to change its C<argv>
145 array so that ps(1) will print out the command being executed. To get
146 a full display, the B<-s> flag may be used with a long string as its
147 argument, which will be overwritten when the program changes its
148 title.
149
150 =item B<-S>
151
152 If specified, B<nnrpd> will start a negotiation for SSL session as
153 soon as connected. To use this flag, C<--with-openssl> must have been
154 specified at C<configure> time.
155
156 =item B<-t>
157
158 If the B<-t> flag is used then all client commands and initial
159 responses will be traced by reporting them in syslog. This flag is set
160 by innd(8) under the control of the ctlinnd(8) C<trace> command, and
161 is toggled upon receipt of a C<SIGHUP>; see signal(2).
162
163 =back
164
165 =head1 SSL SUPPORT
166
167 If INN is built with C<--with-openssl>, B<nnrpd> will support news reading
168 over TLS (also known as SSL).  For clients that use the STARTTLS command,
169 no special configuration is needed beyond creating a TLS/SSL certificate
170 for the server.  You should do this in exactly the same way that you would
171 generate a certificate for a web server.
172
173 If you're happy with a self-signed certificate (which will generate
174 warnings with some news reader clients), you can create and install one in
175 the default path by running C<make cert> after C<make install> when
176 installing INN, or by running the following commands:
177
178     openssl req -new -x509 -nodes -out /usr/local/news/lib/cert.pem \
179         -days 366 -keyout /usr/local/news/lib/key.pem
180     chown news:news /usr/local/news/lib/cert.pem
181     chmod 640 /usr/local/news/lib/cert.pem
182     chown news:news /usr/local/news/lib/key.pem
183     chmod 600 /usr/local/news/lib/key.pem
184
185 Replace the paths with something appropriate to your INN installation.
186 This will create a self-signed certificate that will expire in a year.
187 The B<openssl> program will ask you a variety of questions about your
188 organization.  Enter the fully qualified domain name of the server as the
189 name the certificate is for.
190
191 Most news clients currently do not use the STARTTLS command, however, and
192 instead expect to connect to a separate port (563) and start an SSL
193 negotiation immediately.  B<innd> does not, however, know how to listen
194 for connections to that port and then spawn B<nnrpd> the way that it does
195 for regular reader connections.  You will therefore need to arrange for
196 B<nnrpd> to listen on that port through some other means.  This can be
197 done with the B<-D> flag (and C<-P 563>), but the easiest way is probably
198 to add a line like:
199
200     nntps stream tcp nowait news /usr/lib/news/bin/nnrpd nnrpd -S
201
202 to F</etc/inetd.conf> or the equivalent on your system and let B<inetd>
203 run B<nnrpd>.  (Change the path to B<nnrpd> to match your installation if
204 needed.)  You may need to replace C<nntps> with C<563> if C<nntps> isn't
205 defined in F</etc/services> on your system.
206
207 =head1 PROTOCOL DIFFERENCES
208
209 B<nnrpd> implements the NNTP commands defined in RFC 977, with the
210 following differences:
211
212 =over 4
213
214 =item 1.
215
216 The C<slave> command is not implemented.  This command has never been
217 fully defined.
218
219 =item 2.
220
221 The C<list> command may be followed by the optional word C<active.times>,
222 C<distributions>, C<distrib.pats>, C<moderators>, C<newsgroups>,
223 C<subscriptions>, or C<Ioverview.fmt> to get a list of when newsgroups
224 where created, a list of valid distributions, a file specifying default
225 distribution patterns, moderators list, a one-per-line description of the
226 current set of newsgroups, a list of the automatic group subscriptions, or
227 a listing of the F<overview.fmt> file.
228
229 The command C<list active> is equivalent to the C<list> command. This
230 is a common extension.
231
232 =item 3.
233
234 The C<xhdr>, C<authinfo user> and C<authinfo pass> commands are
235 implemented.  These are based on the reference Unix implementation.  See
236 RFC 2980.
237
238 =item 4.
239
240 A new command, C<xpat header range|MessageID pat [morepat...]>, is
241 provided.  The first argument is the case-insensitive name of the header
242 to be searched.  The second argument is either an article range or a
243 single Message-ID, as specified in RFC 977.  The third argument is a
244 C<uwildmat>(3)-style pattern; if there are additional arguments they are
245 joined together separated by a single space to form the complete pattern.
246 This command is similar to the C<xhdr> command.  It returns a C<221>
247 response code, followed by the text response of all article numbers that
248 match the pattern.
249
250 =item 5.
251
252 The C<listgroup group> command is provided.  This is a comment extension.
253 It is equivalent to the C<group> command, except that the reply is a
254 multi-line response containing the list of all article numbers in the
255 group.
256
257 =item 6.
258
259 The C<xgtitle [group]> command is provided. This extension is used by
260 ANU-News.  It returns a C<282> reply code, followed by a one-line
261 description of all newsgroups thatmatch the pattern.  The default is the
262 current group.
263
264 =item 7.
265
266 The C<xover [range]> command is provided. It returns a C<224> reply code,
267 followed by the overview data for the specified range; the default is to
268 return the data for the current article.
269
270 =item 8.
271
272 The C<xpath MessageID> command is provided; see innd(8).
273
274 =item 9.
275
276 The C<date> command is provided; this is based on the draft NNTP protocol
277 revision (draft-ietf-nntpext-imp-04.txt).  It returns a one-line response
278 code of C<111> followed by the GMT date and time on the server in the form
279 C<YYYYMMDDhhmmss>.
280
281 =back
282
283 =head1 HISTORY
284
285 Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.  Overview
286 support added by Rob Robertston <rob@violet.berkeley.edu> and Rich in
287 January, 1993.  Exponential backoff (for posting) added by Dave Hayes in
288 Febuary 1998.
289
290 $Id: nnrpd.pod 7751 2008-04-06 14:35:40Z iulius $
291
292 =head1 SEE ALSO
293
294 ctlinnd(8), innd(8), inn.conf(5), signal(2), uwildmat(3).