with-authinfo-kludge.1: Explain that we don't configure the client.
[with-authinfo-kludge] / with-authinfo-kludge.1
CommitLineData
b3370918
MW
1.\" -*-nroff-*-
2.\"
3.\" Manual page for `with-authinfo-kludge'.
4.\"
5.\" (c) 2016 Mark Wooding
6.\"
7.
8.\"----- Licensing notice ---------------------------------------------------
9.\"
10.\" This program is free software; you can redistribute it and/or modify
11.\" it under the terms of the GNU General Public License as published by
12.\" the Free Software Foundation; either version 2 of the License, or
13.\" (at your option) any later version.
14.\"
15.\" This program is distributed in the hope that it will be useful,
16.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18.\" GNU General Public License for more details.
19.\"
20.\" You should have received a copy of the GNU General Public License
21.\" along with this program; if not, write to the Free Software Foundation,
22.\" Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23.
24.ie t \{\
25. ds o \(bu
26.\}
27.el \{\
28. ds o o
29.\}
30.
31.de hP
32.IP
33\h'-\w'\fB\\$1\ \fP'u'\fB\\$1\ \fP\c
34..
35.
36.de VS
37.sp 1
38.RS
39.nf
40.ft B
41..
42.de VE
43.ft R
44.fi
45.RE
46.sp 1
47..
48.
49.TH with-authinfo-kludge 1 "23 April 2016"
50.
51.\"--------------------------------------------------------------------------
52.SH NAME
53with-authinfo-kludge \- run a newsreader with AUTHINFO GENERIC support
54.
55.SH SYNOPSIS
56with-authinfo-kludge
57.RB [ \-v ]
58.RB [ \-d
59.IR dir ]
60.RB [ \-f
61.IR conf ]
62.RB [ \-t
63.IR tag ]
64.br
65\h'5m'\c
66[
67.BI + server
68.RI [ param \fR= value
69\&...] \&...]
70.RB [ + ]
71.br
72\h'5m'\c
73.I command
74.RI [ args
75\&...]
76.
77.\"--------------------------------------------------------------------------
78.SH DESCRIPTION
79.
80The
81.B with-authinfo-kludge
82program is an
83.I adverbial modifier
84which runs another command
85(typically a newsreader)
86in an environment in which at can,
87transparently to it,
88make connections to certain NNTP servers
89which usually require
90.B AUTHINFO GENERIC
91authentication before they'll permit clients to read or post.
92This is useful because support for
93.B AUTHINFO GENERIC
94has never been especially widely supported by newsreaders
95and now seems to be being withdrawn from those newsreaders
96which used to support it.
97.PP
98In the simple case, you say something like
99.VS
100with-authinfo-kludge slrn
101.VE
102and then
103.B slrn
104will start up,
105connect to your default NNTP server
106(as named in the
107.B NNTPSERVER
108environment variable),
109authenticate to it as needed,
110and let you read and post news.
111In more complicated cases,
112.B with-authinfo-kludge
113can handle multiple NNTP servers,
114set up SSH forwarding for them,
115offer different authentication credentials to them,
116and hide the fact that they might be running on nonstandard ports.
117.PP
118The
119.B with-authinfo-kludge
120program doesn't do all of this itself:
121it depends on some other tools existing on the system in which it runs.
122(It doesn't need anything special running on the server system.)
123The external dependencies are as follows.
124.hP \*o
125The
126.B authinfo-kludge
127program, by Richard Kettlewell,
128is a simple proxy which relays commands and responses
129between the client (on stdin/stdout) and server (over TCP),
130and responds transparently to authentication requests from the server.
131.hP \*o
132The
133.B noip
134hack, by Mark Wooding,
135is an
136.B LD_PRELOAD
137library which selectively uses Unix-domain sockets
138in place of IPv4 or IPv6 sockets.
139.
140.SS "Command line"
141The
142.B with-authinfo-kludge
143program accepts a small number of options
144before its main command-line arguments.
145.TP
146.B \-h
147Write help about the command-line syntax to standard output,
148and exit with status zero.
149.TP
150.BI "\-d " dir
151Use
152.I dir
153as the `runtime directory',
154which is used to store sockets and other working files
155while
156.B with-authinfo-kludge
157is running.
158By default, it will choose an appropriate place
159in a moderately complicated manner described below;
160this option lets you override its choice
161in order to achieve special effects.
162.TP
163.BI "\-f " conf
164Read configuration from
165.IR conf .
166The default is somewhat complicated;
167see below.
168.TP
169.BI "\-t " tag
170Use
171.I tag
172to distinguish this usage of
173.B with-authinfo-kludge
174from others.
175The tag is used to select default configuration files
176and runtime directories.
177By default, the basename of the
178.I command
179is used.
180.TP
181.B "\-v"
182Print messages explaining what
183.B with-authinfo-kludge
184is doing to standard error.
185By default,
186.B with-authinfo-kludge
187does its thing silently unless there are problems.
188.PP
189The
190.I command
191argument names the command which should be run
192with the various proxy arrangements which it is the task of
193.B with-authinfo-kludge
194to arrange; it will be passed the
195.IR args ,
196if any.
197The command name and arguments are not subject to
198interpretation by the shell;
199if, for some reason, you wanted to make use of shell features,
200you should specify a command of the form
201.B /bin/sh
202.B \-c
203.IR shell-fragment .
204.PP
205Between the options (if any) and the
206.I command
207name,
208there may be a number of server configurations.
209If any are present, they take the place of any configuration file:
210an error is reported if a
211.B \-f
212option was passed.
afaf8da0 213A server configuration starts with
b3370918
MW
214an argument consisting of a server name prefixed by a
215.RB ` + '
216character:
217.IP
218.BI + server
219.PP
220This may be followed by assignments
221.IP
222.IB param = value
223.PP
224which set configuration parameters
225for the previously-named server.
226Such a server configuration on the command line
227is treated exactly the same as a configuration-file section
228.IP
229.BI [ server ]
230.br
231.IB param = value
232.br
233\&...
234.PP
235See below for details about the configuration file.
236.PP
237To hedge against the unlikely event that the desired
238.IR command 's
239name actually begins with
240.RB ` + ',
241an argument consisting of a
242.RB ` + '
243sign on its own marks the end of the server configurations:
244the following argument will be interpreted as the command name
245regardless of its syntactic form.
246If there is a
247.RB ` + '
248marker, but no server configurations,
249then the configuration file is read,
250or the default configuration is used,
251as usual.
252.
253.SS "Configuration file"
254The
255.B with-authinfo-kludge
256program reads configuration from a standard-ish
257.RB ` .ini '-format
258file.
259The file consists of parameter settings of the form
260.IP
261.I param
262.B =
263.I value
264.PP
265divided into sections by headers of the form
266.IP
267.BI [ name ]
268.PP
269Whitespace around the
270.IR name ,
271.I param
272and
273.I value
274strings is discarded.
275A section
276.I name
277may itself contain square brackets,
278and they need not be properly nested.
279There is no syntax for continuing values over more than one line.
280.PP
281The file may also contain blank lines,
282and comment lines whose first non-whitespace character is either
283.RB ` # '
284or
285.RB ` ; '.
286All such lines are ignored.
287.PP
288Parameter settings apply to the section named in the most recent
289setion header.
290Settings appearing before the first section header apply to
291the special section named
292.BR @GLOBAL ,
293just as if a line
294.IP
295.B [@GLOBAL]
296.PP
297appeared at the very top of the file.
298It is permitted (though not usually expected)
299for several section headers to have the same name;
300in this case,
301all of the settings following any of the occurrences are gathered together,
302just as if they'd all appeared under a single header,
303in the same order.
304If the same parameter is assigned more than once,
305then only the
306.I last
307assignment has any effect.
308.PP
309With the exception of the
310.B @GLOBAL
311section,
312each section header should name an NNTP server.
313.PP
314The following server parameters are recognized.
315.TP
316.BI local= host\fR[ : port \fR]
317Sets the NNTP server address which the newsreader command
318expects to connect to.
319This does
320.I not
321have to be an address local to the machine on which
322.B with-authinfo-kludge
323runs.
324It defaults to the
325.I server
326name from the section heading
327(which must therefore be in the appropriate format),
328and may be equal to the
329.I remote
330address (below) without causing difficulty.
838ff5e9
MW
331Note that
332.B with-authinfo-kludge
333will not do anything to encourage the client
334to connect to the right address;
335its caller must arrange to configure the client correctly,
336e.g., by setting the
337.B NNTPSERVER
338environment variable appropriately.
b3370918
MW
339.TP
340.BI nntpauth= "parameter arguments\fR..."
341Set the AUTHINFO GENERIC authentication parameter and arguments
342to use for this server.
343The default is to use the settings from the
344.B NNTPAUTH
345environment variable.
346.TP
347.BI remote= host\fR[ : port \fR]
348Sets the real address of the NNTP server which
349.BR with-authinfo-kludge 's
350proxy (or the SSH tunnel) should connect to.
351It defaults to the
352.I server
353name from the section heading
354(which must therefore be in the appropriate format).
355.TP
356.BI sshbind= host\fR[ : port\fR]
357Change the address and port number
358of the local end of the SSH tunnel
359set up by the
360.B via
361parameter.
362The default is to use
363127.1.0.1:119.
364It is
365.I not
366a problem for multiple servers to use the same address:
367.B with-authinfo-kludge
368uses the
369.BR noip (1)
370library to keep them
371separate.
372.TP
373.BI via= gateway
374Use SSH connection forwarding to reach the server.
375The
376.I gateway
377is passed to
378.BR ssh (1)
379as its hostname parameter,
380so may be a hostname or IP address,
381possibly prefixed by
382.IB user @
383to choose a different login name;
384or it may name a
385.BR ssh_config (1)
386stanza providing detailed configuration.
387Note that the local end of the tunnel will
388.I not
389be exposed to other users of the local machine,
390since this instance of SSH is run under the control of
391.BR noip (1).
392.PP
393The various parameters which take network addresses
394accept a common syntax:
395.IP
396.IR host \c
397.RB [ : \c
398.IR port ]
399.PP
400The
401.I host
402may be a hostname;
403an IPv4 address in dotted-quad notation; or
404an IPv6 address in hex-and-colons notation,
405which must contain at least
406.I two
407colons to be valid.
408Raw IP addresses may be surrounded by square brackets;
409this is necessary to disambiguate a trailing
410.BI : port
411following an IPv6 address because the IPv6 address syntax is stupid.
412.PP
413The
414.B @GLOBAL
415section may set the following parameters.
416.TP
417.BI rundir= dir
418Set the runtime directory to be
419.IR dir .
420This directory (but not its parent directories)
421will be created automatically if necessary.
422The default runtime directory is chosen in a complicated way;
423see below.
424.PP
425The configuration file is found as follows.
426.hP 1.
427If server configurations are provided on the command line,
428then they are used instead of any configuration file.
429.hP 2.
430If a
431.B \-f
432option is given, then it is read as a configuration file.
433A fatal error is reported if the file does not exist,
434or cannot be read for some other reason.
435.hP 3.
436The user's home directory is determined, as follows.
437If the environment variable
438.B HOME
439is set, then its value is used.
b3370918
MW
440Let
441.I home
442be the home directory so determined, if any.
443.hP 4.
444A `configuration home' directory is determined, as follows.
445If the environment variable
446.B XDG_CONFIG_HOME
447is set, then its value is used.
448Otherwise, the configuration home is
449.IB home /.config \fR;
450a fatal error is reported at this point
451if no home directory was determined.
452Let
453.I config-home
454denote the configuration home directory so determined.
455.hP 5.
456A `tag' is chosen, as follows.
457If the
458.B \-t
459option is given, then its value is used;
460otherwise the tag is the basename of the
461.I command
462(i.e., the part following the last
463.RB ` / ',
464if any).
465Let
466.I tag
467denote the tag so chosen.
468.hP 6.
469If
470.IB config-home /with-authinfo-kludge/ tag .conf
471exists, then it is read as a configuration file.
472(If it can't be read, then a fatal error is reported.)
473.hP 7.
474If
475.IB config-home /with-authinfo-kludge/@default.conf
476exists, then it is read as a configuration file.
477(If it can't be read, then a fatal error is reported.)
478.hP 8.
479No configuration file could be found,
480so a default configuration is constructed, as follows.
481Let
482.I nntp-server
afaf8da0 483be the value of the
b3370918
MW
484.B NNTPSERVER
485environment variable;
486if it is not set, then a fatal error is reported.
487The default configuration is as follows.
488.RS
489.IP
490.BI [ nntp-server ]
491.RE
492.
493.SS "The runtime directory"
494(This section is technical, and can safely be skipped by most users.
495It may be useful to know this stuff if
496.B with-authinfo-kludge
497is behaving confusingly and you're trying to understand why.)
498.PP
499The runtime directory is chosen as follows.
500.hP 1.
501If the
502.B \-d
503option is present, then its value is used.
e365c82b
MW
504Otherwise, if the configuration file specifies
505a value for the global
506.B rundir
507parameter then that it used.
b3370918
MW
508.hP 2.
509If the environment variable
510.B XDG_RUNTIME_DIR
511is set, then let
512.I run
513denote its value;
514then
515.IB run /with-authinfo-kludge
516is used as the runtime directory.
d9c763dc 517.hP 3
b3370918
MW
518If the environment variable
519.B TMPDIR
520is set, then let
521.I tmp
522be its value;
523otherwise, let
524.I tmp
525be
526.BR /tmp .
d9c763dc
MW
527Let
528.I uid
529be the current effective uid, in decimal,
530without leading zeroes
531(if the superuser is foolish enough to run this program then
532.I uid
533is
534.BR 0 ).
b3370918 535If
d9c763dc 536.IB tmp/ with-authinfo-kludge- uid
b3370918
MW
537exists,
538is a directory (and not a symbolic link),
539is owned by the current effective uid,
540and has no permissions for group or others;
541or if it does not exist but can be created with the above properties;
542then it is used as the runtime directory.
d9c763dc 543.hP 4.
b3370918
MW
544The user's home directory is determined, as follows.
545If the environment variable
546.B HOME
547is set, then its value is used.
b3370918
MW
548Let
549.I home
550be the home directory so determined, if any.
d9c763dc 551.hP 5.
b3370918
MW
552A `cache home' directory is determined, as follows.
553If the environment variable
554.B XDG_CACHE_HOME
555is set, then its value is used.
556Otherwise, the configuration home is
557.IB home /.cache \fR;
558a fatal error is reported at this point
559if no home directory was determined.
560Let
561.I cache-home
562denote the cache home directory so determined.
563If the cache home directory does not exist,
564then it is created with mode 0777 (as modified by the umask).
d9c763dc 565.hP 6.
b3370918
MW
566Let
567.I hostname
568be the local machine's hostname,
569as reported by
570.BR gethostname (2).
e365c82b 571Then
b3370918 572.IB cache-home /with-authinfo-kludge. hostname
e365c82b
MW
573is used as the runtime directory.
574.PP
575If the directory chosen by the above procedure does not exist,
b3370918
MW
576then it is created as a directory,
577with mode 0700 (and modified by the umask).
b3370918
MW
578(If it exists, but is not in fact a directory,
579then later operations will fail.)
580.PP
581The runtime directory contains a number of other directories,
582named
583.IR tag . pid \fR.
584Each such directory corresponds to a running
585(or failed)
586instance of
587.BR with-authinfo-kludge ;
588the
589.I pid
590is its process-id (possibly useful for diagnostic purposes),
591and the
592.I tag
593is the tag summarizing its purpose
594(as determined in step 5 of the procedure
595for finding a configuration file).
596.PP
597The contents of the instance directory are as follows.
598.TP
599.B client.pid
600The process-id of the client command run by
601.BR with-authinfo-kludge .
602.TP
603.B lock
604An empty file.
605A
606running
607.B with-authinfo-kludge
608process holds a lock on this file.
609It is used simply to tell other processes that
610the directory is still in use and shouldn't be cleaned up.
611.TP
612.B noip/
613A directory containing Unix-domain sockets,
614maintained by the
615.B noip
616library.
617.TP
618.B ssh.pid
619The process-id of the SSH process started to satisfy a
620.B via
621server parameter.
622.
623.\"--------------------------------------------------------------------------
624.SH BUGS
625.
626The program is probably too complicated for many uses,
627but the author finds the various bells and whistles useful.
628.PP
629There isn't a good way to get two or more NNTP clients
630to share the same proxy machinery.
631This is somewhat wasteful.
632Fixing this would necessitate some other way of
633orchestrating the setup and teardown of runtime directories.
b3370918
MW
634.
635.\"--------------------------------------------------------------------------
636.SH SEE ALSO
637.
638.BR authinfo-kludge (1),
639.BR noip (1).
640.PP
641S. Barber,
642.IR "RFC2980, Common NNTP Extensions",
643.if !t \{\
644.br
645\h'5m'\c
646.\}
647.BR "https://www.ietf.org/rfc/rfc2980.txt" .
648.
649.SH AUTHOR
650Mark Wooding,
651<mdw@distorted.org.uk>
652.
653.\"----- That's all, folks --------------------------------------------------