.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "avenger.local 8" .TH avenger.local 8 "2018-10-09" "Mail Avenger 0.8.5" "Mail Avenger 0.8.5" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" avenger.local \- deliver mail for a local user .SH "SYNOPSIS" .IX Header "SYNOPSIS" avenger.local [\-f \fIsender\fR] [\-D \fIrecip\fR] [\-a \fIextra\fR] [\-d] \fIuser\fR .SH "DESCRIPTION" .IX Header "DESCRIPTION" avenger.local is a local mail delivery agent that enables users to set up multiple \*(L"extension\*(R" email addresses and process mail differently for each addresses. The popular qmail \s-1MTA\s0 () has a mechanism for processing such extension addresses. avenger.local provides a similar facility for users of other MTAs, such as sendmail. .PP To use avenger.local, you should configure your \s-1MTA\s0 so that it delivers mail to \fIuser\fR\fB+\fR\fIextra\fR\fB@\fR\fIhost\fR by executing \&\fBavenger.local\fR \fB\-D\fR \fIuser\fR\fB+\fR\fIextra\fR\fB@\fR\fIhost\fR \fB\-d\fR \&\fIuser\fR\fB+\fR\fIextra\fR. Alternatively, you can execute \fBavenger.local\fR \&\fB\-a\fR \fIextra\fR \fB\-d\fR \fIuser\fR, but then you lose information about the host. However, the latter syntax has the advantage of being command-line compatible with procmail; thus, if your \s-1MTA\s0 has support for procmail as a local delivery agent, you should be able to use that by simply substituting avenger.local's path for procmail's. .PP Note that either way you invoke it, avenger.local rejects recipients containing the string \f(CW\*(C`..\*(C'\fR in the local part. Such mailbox names are not allowed by \s-1RFC822,\s0 and could potentially lead to security problems if parts of mailbox names are used as file names. Out of paranoia, avenger.local additionally rejects mailbox names containing the \f(CW\*(C`/\*(C'\fR character in the extra portion after the local username. .PP avenger.local is designed to be unobtrusive for users who do not want to take advantage of its functionality. When delivering mail for \&\fIuser\fR, if \fIuser\fR's home directory does not contain a subdirectory \&\fI.avenger\fR, avenger.local simply executes the default mail delivery agent (usually called \fImail.local\fR). .PP For users who do have \fI.avenger\fR directories, mail is delivered according to rule files called \fI.avenger/local*\fR. Mail to \&\fIuser\fR\fB@\fR\fIhost\fR is delivered according to rules in \&\fI.avenger/local\fR. Mail to \fIuser\fR\fB+\fR\fIext1\fR\fB@\fR\fIhost\fR is delivered according to rules in \fI.avenger/local+ext1\fR if such a file exists, or else \fI.avenger/local+default\fR if such a file exists; if neither file exists, the mail is bounced. Addresses containing multiple \f(CW\*(C`+\*(C'\fR characters are handled as expected. Mail to \&\fIuser\fR\fB+\fR\fIext1\fR\fB+\fR\fIext2\fR\fB@\fR\fIhost\fR is governed by, in order of decreasing precedence, \fI.avenger/local+ext1+ext2\fR, \&\fI.avenger/local+ext1+default\fR, or \fI.avenger/local+default\fR; it is bounced if none of those files exist. .PP Local rule files can be in one of two formats. If the first two characters of the file are \f(CW\*(C`#!\*(C'\fR, then the file is simply executed as a script, with the message on standard input. The script's standard input will be read-only, but seekable, so, for example, the message can be delivered to multiple mailboxes using the deliver utility. .PP Otherwise, if the first two characters of a file are not \f(CW\*(C`#!\*(C'\fR, avenger.local uses a syntax similar to (but not identical to) qmail's, where each line is one of the following types, depending on the first character: .IP "\fB#\fR \fIcomment\fR" 4 .IX Item "# comment" Lines starting with \f(CW\*(C`#\*(C'\fR are treated as comments and ignored. The exception is that if the first line begins \f(CW\*(C`#!\*(C'\fR, the file is executed as a script. Note that if the first two characters of a file are \&\f(CW\*(C`#!\*(C'\fR but the file's execute permission bits are not set, then mail sent to that address will be deferred. (This mechanism can be used for intentionally deferring mail while performing maintenance.) .IP "\fI./maildir/\fR" 4 .IX Item "./maildir/" .PD 0 .IP "\fI/path/to/maildir/\fR" 4 .IX Item "/path/to/maildir/" .PD A line starting \f(CW\*(C`.\*(C'\fR or \f(CW\*(C`/\*(C'\fR and ending with a \f(CW\*(C`/\*(C'\fR character is treated as a mail directory. Mail is delivered there using the qmail maildir format. .IP "\fI./file\fR" 4 .IX Item "./file" .PD 0 .IP "\fI/path/to/file\fR" 4 .IX Item "/path/to/file" .PD A line starting \f(CW\*(C`.\*(C'\fR or \f(CW\*(C`/\*(C'\fR and \s-1NOT\s0 ending with a \f(CW\*(C`/\*(C'\fR character specifies an ordinary Unix mbox file into which the message should be delivered. .IP "\fB&\fR\fIaddress\fR" 4 .IX Item "&address" \&\f(CW\*(C`&\*(C'\fR indicates that a copy of the message should be forwarded to \&\fIaddress\fR. You may not place a space between \fB&\fR and address, nor can \fIaddress\fR contain angle brackets, comments, or anything other than an email address with a fully-qualified domain name. .Sp (Note that in qmail, the \fB&\fR character is optional for certain email addresses, while avenger.local always requires the \fB&\fR character.) .Sp Forwarding happens after all other lines in the file are processed. If any other configuration line fails, for instance because a command executed on behalf of a \fB|\fR line exits non-zero, the mail is not forwarded to any of the addresses. (The exception is if a command exits with status 99, in which case mail is forwarded to addresses in all preceding \fB&\fR lines, but subsequent lines are ignored.) .IP "\fB|\fR \fIcommand\fR" 4 .IX Item "| command" Specifies that \fIcommand\fR should be run as a shell command, with the mail message as its standard input. If \fIcommand\fR exits with a status other than 0, processing of the local rule file terminates immediately, with avenger.local's exit status determined by \&\fIcommand\fR's. .Sp If \fIcommand\fR's status is 99, avenger.local exits with status 0, effectively pretending the command just executed was the last line in the \fI.avenger/local*\fR file. If \fIcommand\fR's exit status is between 64 and 78, inclusive, avenger.local exits with the same status as \&\fIcommand\fR. If \fIcommand\fR exits with status 100 or 112, avenger.local exits with status 70. For all other exit values, or if \fIcommand\fR terminates because of a signal, avenger.local exits with status 75. Note that the \fB\-\-qmailexit\fR flag changes this behavior, as described below. .Sp See the file \fI/usr/include/sysexits.h\fR for more information on the meaning of various exit statuses to sendmail. .IP "\fB<\fR\fIaddress\fR" 4 .IX Item ". .SH "BUGS" .IX Header "BUGS" avenger.local doesn't necessarily report problems in a the most useful place when it encounters errors in a \fI.avenger/local*\fR file. It does send some diagnostics to standard error, but these will typically end up in the mail log or in bounce messages returned to the sender. .PP avenger.local should always provide the exact envelope recipient in the \fB\s-1RECIPIENT\s0\fR environment variable. Unfortunately, this information is not available unless it has been supplied with the \&\fB\-D\fR flag. Often the envelope recipient is just "\fB${\s-1USER\s0}${\s-1SEPARATOR\s0}${\s-1EXT\s0}@your.host.name\fR", but it might not be if there are aliases or virtual domains. On servers with virtual hosts, the actual hostname used will be unavailable in the general case (though you may be able to deduce it from \fB\f(CB$USER\fB\fR and \fB\f(CB$EXT\fB\fR if you know your particular setup). Note that it is possible to configure sendmail to supply the full recipient address. Mail avenger comes with example sendmail configuration directives that can be included in your \fIsendmail.mc\fR m4 configuration file; see \&\fI/usr/local/share/avenger/avsendmail.m4\fR. .PP To protect against concurrent accesses to mbox format files, avenger.local uses both \fIflock\fR and dotfiles to lock mailboxes. However, it does not use \fIfcntl\fR/\fIlockf\fR\-style locking by default. Thus, if your mail reader exclusively uses \fIfcntl\fR for locking, there will be race conditions unless you specify the \fB\-\-fcntl\fR option. .SH "AUTHOR" .IX Header "AUTHOR" David Mazie\*`res