GUP(8) | System Manager's Manual | GUP(8) |
gup - A Group Update Program that accepts commands by mail to edit a newsgroup subscription file for subsequent use by news systems such as INN and C-News.
gup [-hvP] -a active_path [-d home_directory] [-l log_path] [-m reply_headers] [-n newsgroups_path] [-s sites_directory] [-M Mail_command]
The sole purpose of gup is to automate the tedious process of editing group selection patterns defined in the news configuration files (eg: ``newsfeeds'' for INN and ``sys'' for C-News).
Gup is of use to news administrators who spend an inordinate amount of time editing their news config files at the behest of the sites they feed. In fact, once gup is installed, it is quite likely that manual edits of your ``newsfeeds'' or ``sys'' file will become a thing of the past.
Gup is designed to be installed as a mail-server program that is fed an inbound mail via stdin. Gup is usually invoked from a .forward file. Eg:
"|/.../bin/gup -options...."
Each site has an entry in the ``config'' file containing password and mail address details and a group selection file called ``groups'', see CONFIG, and GROUPS for more details.
The news administrator of each site mails commands to gup. There are commands to include and exclude group patterns, list the current patterns for that site and list the available newsgroups; see COMMANDS, for more details.
The results are normally mailed back to the site's configured administrator. However under some circumstances, the results are mailed to the originator or the local administrator; see PROCESSING, for further details.
Gup does not directly change the news system's control files (eg, ``newsfeeds'' for INN). Instead a trivial shell script must be run to concatenate all of the changed ``groups'' files together into an appropriately formatted file for your particular news system. (One is provided in the source kit for INN).
Since each site has to be specifically configured in gup's ``config'' file, access can be restricted to administrator's capable of managing their own group patterns.
Options can appear in any order on the command line. The most important point to note is that all of the paths and directories defined will normally be absolute paths unless you are intimately familiar with the way in which gup changes directories as it processes a mail (the possible exception here is the Sites_directory).
Gup scans the body of the mail for commands. Blank lines are ignored and any data after the ``#'' character is considered a comment. No continuation is allowed. Many of the commands accept a pattern as a parameter. This pattern is identical to the format of the wildmat() pattern; see wildmat (3) ). In fact, Gup purposely uses the wildmat routine from INN to ensure that the pattern matching characteristics are identical.
Valid commands are:
Gup has a number of processing stages. The initialization stage consists of changing to the home directory (see the -d option) and opening the logfile (see the -l option). At this time, gup sets the tentative reply-to mail address to the ``backstop'' mail address defined when gup was compiled (typically the local news administrator).
The next stage consists of scanning the inbound mail, noting interesting mail headers. The most interesting ones are "To:" and "Reply-To:". When a "To:" header is found it becomes the tentative reply-to mail address. If a "Reply-To:" header is found it over-rides any "To:" address to become the new tentative reply-to mail address. A few others are noted and logged to help track changes.
After all the headers have been processed, the body of the mail is examined for commands. The first command must be the site command. Any other data results in an error mail sent to the tentative reply-to mail address. If the site command contains a name that matches an entry in the ``config'' file, then the tentative reply-to mail address is replaced with the mail address in the ``config'' file.
The reason for these contortions with tentative reply-to mail addresses is simply to deal with the problem of working out who to send a mail to in the event of an error. Ideally they should all go back to the mail address in the ``config'' file, but that information is not known for quite a significant part of gup's initial processing.
Once a valid site command has been accepted, gup changes to that site's directory in Sites_directory (see the -s option) making the Sites_directory and site's directory as necessary. The site's directory name is the same as the site's name. In the absence of the -s option this will be:
$HOME/sites/$siteWhere $HOME is gup's home directory and $site is the name of the site being processed. Gup locks the site then loads the site's current ``groups'' file and any xclusion list if present (see EXCLUSIONS for more details).
From this point on gup accepts any command in any order until either the end of the mail, a quit command a help command or a serious error during processing. After all commands have been processed, gup update's the site's ``groups'' file if changes have been made. This update includes pruning any superfluous patterns (unless the -P option is used). Gup writes the new patterns to ``groups.new''. It then renames ``groups'' to ``group.old'' and finally renames ``groups.new'' to ``groups''. The result of all this processing is mailed to the site administrator defined in the ``config'' file.
Access to gup is controlled by the ``config'' file in gup's home directory (see the -d option). This file contains one line per site. Each line contains three white-space separated tokens. The site's name, password and mail address of the administrator. Blank lines are allowed and comments follow the ``#'' character. Gup uses a very simple tokenizer, thus no quoting or continuation is allow in this file.
The site name and password are used to check an inbound site command. The password can be crypted or in plain-text so permissions should be carefully set to restrict access. Here's an example of a ``config'' file.
werple Fert5566a__$1 andrew@werple.apana.org.au torps 34fkr_&&11)Zz zaph@torps.apana.org.au uunet R_S_1@@*(A-\ news@uunet.uu.net .test flapper markdHopefully this is intuitively obvious...
Each site has it's own file of patterns. This file is called ``groups'' and is located in the site's own directory below the Sites_directory (see the -s option). This file contains one pattern per line. Exclusion lists have a preceding ``!'' character. Here's an example:
apana.* !apana.lists.* !apana.fido.* !apana.vortex.* alt.bbs.waffle alt.cult-movies alt.galactic-guide alt.sport.bowling aus.* !aus.ai !aus.religion !aus.radio !aus.stats.s ...
Normally this file should only be changed by gup, but assuming you cater for locking, there is no reason why some other process cannot change it too. Whenever gup has to apply changes, it renames this file to ``groups.old'' prior to re-writing the ``groups'' file. This gives you some measure of recovery.
For whatever reason, you may wish to exclude particular groups from a site's selection list. You can do this by creating the file ``exclude'' in the site's directory. This file contains newsgroup patterns, one per line, that are used to filter the ``active'' file when verifying group patterns. The effect of this is that gup believes that such groups do not really exist, therefore a site cannot possibly include them.
All error conditions are record in the log file and possibly the resultant mail - depending on the nature of the error. A particular problem that is hard to detect is when the .forward file invokes gup incorrectly. If gup is not invoked due to such an error, then notification depends on the mailer. This should only be a problem to watch out for when first installing gup.
Gup does not understand ``Distribution patterns''. Any such patterns must be generated and maintained independently of gup.
Gup does not know when the popen(1) fails when Mail_command is invoked. This is a limitation of popen(1). If the Mail_command is bogus, then the error will be pretty obscure and dependent on your mailer. stderr is redirected to the logfile prior to invoking the Mail_Command so hopefully /bin/sh (used by popen) has generated an appropriate message.
Gup Version 0.3, dated 26 July, 1993.
Initially created by Mark Delany <markd@bushwire.apana.org.au>.
Numerous enhancements and optimizations by Andrew Herbert <andrew@werple.apana.org.au>.
Currently maintained by Marco d'Itri <md@linux.it>.
The wildmat.c is taken directly from the INN sources, written by Rich Salz <rsalz@osf.org>.
The rfc822.[ch] parsing routines are taken directly from the newsgates sources, also written by Rich Salz <rsalz@osf.org>.
25 July 1993 |