man gag (Commandes) - Gateway alias generator

NAME

gag - Gateway alias generator

SYNOPSIS

gag [ -a ] [ -bbbn_file ] [ -ccnews_file ] [ -iinnnews_file ] [ -nbnews_file ] [ -dmmdf_dir ] [ -ssendmail_file ] [ -tPP_shell ] [ -uPP_user ] [ -b ] [ -p ] [ file ]

DESCRIPTION

Gag reads a control file and builds entries for sendmail(8), BBN, MMDF(8), and PP(8) alias files, as well as Netnews(1) sys file entries. It is an auxiliary program for helping to maintain a mail/news gateway operation. A typical gag file sets up default values for all the parameters, then contains a list of newsgroup-mailing list pairs. Group-specific values can override the defaults.

Gag input is fairly free-form. It ignores C-style comments, and whitespace is allowed anywhere. There are a couple of dozen keywords, and case is significant; most of the keywords are parameters used to control the gatewaying. Quoted strings are written as they are in C, except they may not span lines.

Using the parameters enumerated below, gag can write six different sets of alias files:

BBN	if the ``-b'' flag is used
MMDF	if the ``-m'' flag is used
B News	if the ``-n'' flag is used
C News	if the ``-c'' flag is used
InterNetNews	if the ``-i'' flag is used
Sendmail	if the ``-s'' flag is used
PP shell	If the ``-t'' flag is used
PP user	if the ``-u'' flag is used
Any combination of these flags is allowed. Gag does not edit any existing files; all output blindly overwrites the specified output files. The intent is that you review the output, then manually update the production versions. Doing something like ``gag -n /var/lib/news/sys'' is a sure recipe for disaster! Do something like this, instead:
    sed '/--START-OF-GATEWAY-OUTPUT-/,/--END-OF-GATEWAY-OUTPUT-/d' \
	</var/lib/news/sys >/tmp/sys
    gag -n - <gag.data >>/tmp/sys
    mv /tmp/sys /var/lib/news/sys

Gag normally complains about attempts to gateway groups that are not in the news active file; use the ``-a'' suppresses this check, assuming that all named groups are valid.

BBN-style aliases can't pipe into a command with parameters. For example, sendmail can have an entry like this in /etc/aliases(5):

post-bboard:	"|/usr/bin/mail2news -n bbn.bboard \
	-o 'BBN News/Mail Gateway' \
	-d bbn"
With BBN, it is necessary to create an alias that feeds into a custom script:
bboard-gate:	@mailer.bbn.com { "news|/usr/lib/news/.admin/gate-bboard" }
	bboard-gate@mailer.bbn.com
Gag will also create the utility script invoked by the above alias:
#! /bin/sh
##  This script is on the "bboard" mailing list.
exec /usr/bin/mail2news -n bbn.bboard \
	-o "BBN News/Mail Gateway" \
	-d bbn
To create these scripts, use the ``-d'' flag to name the directory where they should be created; ``-d .'' will create them in the current directory.

MMDF aliases are similar to sendmail's, except that the the scripts are run under a specified user id (see below).

PP uses two files, a shell and user file, whose format is not described here.

Some sites want to create mail aliases that forward into each newsgroup; that is, mail sent to ``comp-foo-bar'' should get posted to the ``comp.foo.bar'' newsgroup. If the ``-p'' flag is used, then each gatewayed group will get such an alias created. The mkmailpost(1L) command can be used to create gag ``mailpost'' commands for all entries in the news active file. Note that using mkmailpost and the ``-p'' flag will almost certainly result in the creation of duplicate aliases.

The parameters that control the gatewaying are:

directory
The directory where the BBN alias scripts are kept. (In the above example, the directory is /usr/lib/news/.admin.)
distributions
A space-separated list of distributions to forward from news to mail. In most cases, this will be the full set of distributions received, but it can be convenient, for example, to not forward regional articles out to a world-wide mailing list. With distributions set to ``world usa na'' then the news sys entry for ``comp.foo'' will have this in the second field:
<site>:\
  world,!world.all,usa,!usa.all,na,!na.all,comp.foo,!comp.foo.all\
  <rest of entry>
inews flags
These are flags to pass on to inews(8) when gatewaying a mail message into netnews. They are put on the news2mail (1) command line, which will pass them along. A common use is to set a default distribution or organization.
mail2news
The full pathname of the mail2news program.
mailcontact
This is the name of the person listed in the ``For more information, contact'' part of the header generated by news2mail.
mailhost
When remote mailing lists are gatewayed into local newsgroups, it can often be convenient to provide a local alias that forwards on to the remote host. For example, if the list ``info-foo'' is maintained at ``vax.host.edu'' then it is possible to create a local alias that just forwards to ``info-foo@vax.host.edu.''
mailinglist
If set to ``true,'' then gag will write aliases that forward on to the list at the current mailhost; if set to ``false'' than no such aliases will be written.
moderator
If set, then the value is put on the mail2news command line with the ``-a'' flag. This is useful for making a semi-moderated one-way gateway.
news2mail
The full pathname of the news2mail program.
organization
If set, then the value is put on the mail2news command line with the ``-o'' flag.
owner
If set, then all sendmail aliases also have an ``owner-'' version, with this value as the recipient, to receive trouble reports.
request_address
Most mailing lists have a ``-request'' address to handle list administration. When gatewaying the list ``info-foo'' if the maintenance address isn't ``info-foo-request'' set this parameter to the proper address.
site
This is the name of the site to use in the news sys file; ``gateway'' is a common choice.
user
When running scripts under MMDF (either normal or with the BBN style) a userid to setuid to must be given.

Note that there is some overlap in these parameters. In particular the ``moderator'' and ``organization'' parameters can really be subsumed by the ``inews flags'' parameter. They are explicitly called out, however, for convenience in specifying the types of gatewaying. For example, while all gatewayed groups might go out with the same distribution, only some might need an Approved: header line.

THE LANGUAGE

A gag file is composed of intermixed parts of three different constructs: defaults, mail/news posting entries, mail/news gateway entries.

Individual groups can override the default parameters. The defaults can be changed at any time, and retain the new value for the rest of the file or until changed again. For example, most mail aliases will be ``owned'' by postmaster, but it might be convenient to set the forwarding address on specific aliases to someone else. For example:

/* Send gateway complaints to postmaster */
default owner = "postmaster";

/* The "animals" list is privately maintained. */ gateway bbn.animals animal-rights owner = "canus-major"; The syntax is explained in more detail, below.

A default parameter assignment looks like one of the following:

default <parameter> = true ;
default <parameter> = false ;
default <parameter> = "string value" ;
default <parameter> = dotify ( "value" ) ;
The last form is used to translate mixed-case strings into the prefix-period form used by mail2news.

A gateway declaration looks like this:

gateway <newsgroup> <mailinglist>
	[ parameter settings ] ;
The parameter settings are like the default settings shown above, except that the word ``default'' is left off, as are all semicolons but the last one.

To set up a simple unidirectional newsgroup/mailing list gateway, use a ``mailpost'' declaration:

mailpost <newsgroup> ;

BUGS AND CAVEATS

Gag doesn't free most of the memory that it allocates; in essence, the entire input must fit into the process space.

In generating news sys file entries, remember that the command is a sprintf(3) format string, and any percent signs (%) must be doubled or they will be taken as a formatting control.

SEE ALSO

AUTHORS

Rich $alz <rsalz@bbn.com>, replacing some m4 scripts that

Erik E. Fair <fair@apple.com> wrote.

Piete Brooks <pb@computer-lab.cambridge.ac.uk> provided the PP support.