Import ezmlm-idx 0.40
[ezmlm] / ezmlm-cgi.1
CommitLineData
f8beb284
MW
1.TH ezmlm-cgi 1
2.SH NAME
3ezmlm-cgi \- provide WWW access to the list archive
4.SH SYNOPSIS
5.B ezmlm-cgi
6.SH DESCRIPTION
7.B ezmlm-cgi
8is executed by the httpd daemon and generates HTTP/CGI/html 4.0-compliant
9self-referencing output of index pages for threads in a given month,
10messages in a thread, messages by a given author, messages by date,
11and messages themselves with full navigation controls. It uses the
12archive directly, aided by index files created by
13.BR ezmlm-idx(1) ,
14and
15.B ezmlm-send(1)
16as part of normal archive access and digest indexing, and
17by
18.BR ezmlm-archive(1) .
19
20.B ezmlm-cgi
21uses the httpd-supplied variables
22.B PATH_INFO
23to obtain the list number,
24.B QUERY_STRING
25to obtain the command, as well as
26.BR SERVER_NAME ,
27.BR SERVER_PORT ,
28and
29.B SCRIPT_NAME
30to create a self-referencing URL.
31
32When
33.B ezmlm-cgi
34is invoked without a command, it shows the threads for the
35current month.
36If no list number is supplied, the default list is shown (see below).
37.SH CONFIGURATION
38.B ezmlm-cgi
39expects to find configuration info in
40.B /etc/ezmlm/ezcgirc
41when run SUID root, or
42.B .ezcgirc
43otherwise. The entries in this file describe one list per line. Blank lines
44and comments
45starting with a ``#'' in position 1 are allowed and ignored. No extra
46blanks, tab, etc, are allowed. Entries must be
47of the following format:
48
49.EX
50.I listno;uid;listdir;listaddr;buttonbar;charset;style;bannerprog
51.EE
52
53.B where:
54.TP 5
55.I listno
56is the list number using ``0'' for the default list if desired;
57.TP 5
58.I uid
59the user id to switch to if installed SUID root (default invoking user id) and
60if preceded by ``-'' chroot() is suppressed for SUID root installations;
61.TP 5
62.I listdir
63 the absolute path to the list base directory (required);
64.TP 5
65.I listaddr
66the list address as local@host (required) and if preceded by ``-'' the
67``From:'' E-mail address is replaced by the posters name/handle as a
68further precaution against address harvesting;
69.TP 5
70.I buttonbar
71a set of comma-separated fields of the type
72.IR ``[Home]=http://example.com/list.html''.
73The text before the ``='' is the exact text displayed and the subsequent
74text should be the URL linked to that button. Use the braces to make the
75buttons be consistent with preexisting navigation buttons. It is desirable
76to add a ``[Help]'' button with a link to an explanation of the various
77displays generated by
78.BR ezmlm-cgi .
79.TP 5
80.I charset
81the character set used for the main pages (default ``iso-8859-1'');
82.TP 5
83.I style
84the style sheet used (default none, which doesn't look pretty);
85.TP 5
86.I bannerprog
87the path to a banner program which is given
88the name of the script and the list as arguments (default none). The path
89is relative to ``listdir'' and can point anywhere in the file system. However,
90for SUID root installations access is normally restricted via
91.BR chroot(3) .
92(See SECURITY.)
93If
94.I ``bannerprog''
95starts with a less-than character (''<'') it is assumed to
96be a URL which is inserted as is, rather than executed.
97.TP 5
98.I ``;''
99the separator can be any non-numeric character and can be different for
100different
101.I ezcgirc
102lines. There
103is no quoting/escaping mechanism. Thus, choose a character not present in
104any of the arguments. ``bannerprog'' as the last argument is an exception,
105and may contain any characters except LF and NUL.
106.SH OPTIONS
107.TP 5
108If ``uid'' is preceded by a minus sign (``-''),
109.B ezmlm-cgi
110will not call
111.B chroot(3) .
112This potentially decreases security, but may be needed to
113execute ``bannerprog''.
114.TP 5
115If ``listaddr'' is preceded by a minus sign (``-''),
116.B ezmlm-cgi
117will, as a precaution against address harvesting robots,
118remove the sender's E-mail address also in the message view. This is
119already done in all other views. The archive user can still obtain the address
120by requesting the message by E-mail.
121.SH OUTPUT
122.B ezmlm-cgi
123outputs 5 different views.
124.TP
125.I thread index
126shows the threads which have messages in a given month. The subject is
127prefixed with the number of messages in the thread for the given month. When
128.B ezmlm-archive(1)
129is first run against an existing archive, the number is the total number of
130messages in the thread. The subject and author are links to the respective
131thread or author index. The threads are ordered in reverse order of latest
132message, i.e. the thread that last received a message is listed last. When
133.B ezmlm-archive(1)
134is run against an existing archive, the initial sort is in order of the
135first message in the thread.
136
137The subject in the
138.I thread index
139is a link to the last message in the thread.
140.TP
141.I thread
142shows the messages in the respective thread in date order. For each message
143the author is shown linked to the message.
144.TP
145.I author index
146shows the subject of all messages posted from a given address in order of
147arrival at the list. Links are to the messages.
148.TP
149.I message by date
150shows entries in order of arrival of sets of 100 messages. Links are to
151the message and to the author.
152.TP
153.I message
154shows the message itself. The message has links to the previous and next
155message by time, in the thread, or by the same author. There are also links
156to the other views, as well as links to subscribe, or request FAQ,
157the message or the thread by E-mail. The navigation bar is very concise
158to optimize appearance in
159.BR lynx .
160It is self-explanatory to anyone daring to experiment. For others, you may
161wish to supply a ``help'' button.
162The message subject is a
163.I mailto:
164link for a follow-up post to the list.
165.SH "OUTPUT FORMATTING"
166.B ezmlm-cgi
167outputs html 4.0 in a format suitable for
168.I Lynx
169and other text-mode browsers. The format is designed for easy optional
170enhancement
171via CSS1/2 type
172style sheets in the format ``text/css''.
173.B ezmlm-cgi
174is self-documenting in this respect. Simply review the output in the different
175views and the sample style sheet to see the class structure.
176.SH "EXTERNAL LINKS TO MESSAGES"
177.B ezmlm-cgi
178will accept a PATH_INFO of the following format:
179
180.EX
181.I /listno/message
182.EE
183
184.B where:
185.TP 5
186.I listno
187is the list number per config file;
188.TP 5
189.I message
190is the message number.
191
192Thus,
193.B ezmlm-cgi\fI/2/20000
194will return message 20000 from list 2.
195
196.B ezmlm-cgi
197uses a second syntax based on QUERY_STRING for internal links. This
198command set is implemented only as far as required for normal
199.B ezmlm-cgi
200function. Useful are:
201.TP
202.B ezmlm-cgi\fB?listno?ams:message
203which will return in order the list of messages posted by the author of message
204.I message
205on list
206.IR listno ,
207and
208.TP
209.B ezmlm-cgi\fB?listno?sms:message
210which will return in order the list of messages with the same subject as message
211.I message
212.I message
213on list
214.IR listno ,
215i.e. the ``thread''.
216.SH ROBOTS
217There are many possible URLs for the same message.
218To still allow external indexing,
219.B ezmlm-cgi
220supports the command
221.I ezmlm-cgi/index
222which returns a page with links to all lists, except the default list. These
223links indirectly lead exactly once to each message.
224None of the links used contain
225a ``?''. Thus, to index the archives, allow access to scripts in the
226(separate)
227.I directory
228where
229.B ezmlm-cgi
230is installed, but deny access to
231.IR directory\fB/ezmlm-cgi\fI? .
232Any message will have a ``nofollow'' robot META tag, and any view reached by
233a URL based on QUERY_STRING will in addition have a ``noindex'' robot META tag
234to avoid trapping robots in the archive.
235.SH EXECUTION
236.B ezmlm-cgi
237can operate in three modes,
238.IR SUID\ root ,
239.IR SUID\ user ,
240and
241.IR normal .
242
243In
244.I normal
245and
246.I SUID user
247mode,
248.B ezmlm-cgi
249will read the configuration file
250.B .ezcgirc
251from the working directory set by the httpd daemon
252(per
253.B cgi
254definition this should be the same directory as
255.B ezmlm-cgi
256is in), then
257change directory to the list directory. ``uid'' is ignored.
258.I SUID user
259may be required to read the particular archive if it is not owned by the
260httpd user. For user installations or systems where
261the httpd user has access to all the lists,
262.I normal
263mode usually gives sufficient access.
264
265In
266.I SUID\ root
267mode,
268.B ezmlm-cgi
269will read the configuration info from
270.B /etc/ezmlm/ezcgirc
271then change directory to that directory, then
272change root to that directory, then change
273userid to ``uid''. If ``uid'' is not specified, it will change to the
274uid of the process invoking
275.B ezmlm-cgi
276(normally the httpd user). If the archive files are world-readable, but the list
277directory is not, it is safest to leave ``uid'' blank. The httpd user will still
278be able to read the files.
279.SH "EXECUTION OF BANNER PROGRAMS"
280A banner program can be specified in the config file. It is executed
281immediately before the end of the text. The formatting for
282``<BODY>'' is active and the banner program output is encapsulated in
283a ``<DIV class=banner>'' segment to allow additional formatting.
284The banner program is called for all summary views, but not for the message
285view itself.
286
287The banner program is give the list local name as argument 1, and the host
288name as argument 2. It is expected to exit 0 on success. The return code is
289checked, but the archive page (and whatever the banner program has already
290produced) is output even if the banner program fails.
291
292.B chroot(3)
293may make it difficult to run banner programs that depend on e.g. ``sh''
294or ``perl''. For this reason, the chroot call can be suppressed by prefixing
295the ``uid'' with a ``-''.
296.SH SECURITY
297.B ezmlm-cgi
298will refuse to run as root.
299
300.B ezmlm-cgi
301does not write or lock any files.
302
303.B ezmlm-cgi
304has a short well commented segment of code that potentially runs SUID root.
305Read the source to convince yourself that this is safe. If possible, install
306it SUID user, or not SUID at all, if that meets your needs (single list
307user, httpd user is list user, or httpd user has sufficient access to all
308list directories and archives).
309
310.B ezmlm-cgi
311will allow execution of banner programs that are located outside of the list
312directory. These are executed with the privileges of the userid set in the
313config file. If the program is installed SUID root, banner programs outside
314of the list directory are not normally accessible. Even when this is overridden,
315.B ezmlm-cgi
316will never execute the program with root permissions.
317
318Input to the CGI script is not propagated to the banner program.
319.SH BUGS
320.B ezmlm-send(1)
321updates the list message counter once a message is safely archived, but
322before it is accepted by
323.BR qmail(7) .
324Also, the
325.I index
326file is updated before the message is accepted by
327.BR qmail(7) .
328If
329.B qmail(7)
330fails,
331.B ezmlm-send(1)
332resets the counter before terminating. It is possible that in such a situation
333the message would be replaced by a different one.
334If
335.B ezmlm-cgi
336accesses a message that ultimately fails and in that time interval,
337it may expose a message that ultimately is replaced, especially when doing it
338via the ``Messages by date'' view which is based on the
339.I index
340file. In practice, this is relatively harmless. Avoiding it would require
341locking the list with significant implications for security and performance.
342.SH "SEE ALSO"
343ezmlm-archive(1),
344ezmlm-get(1),
345ezmlm-idx(1),
346ezmlm-send(1),
347ezmlm(5),
348qmail(7)
349