.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" 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 turned on, 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 "aliascheck 1" .TH aliascheck 1 "2013-07-13" "Mail Avenger 0.8.4" "Mail Avenger 0.8.4" .\" 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" aliascheck \- check for existence of mail alias .SH "SYNOPSIS" .IX Header "SYNOPSIS" aliascheck [\-\-nopwd] \fIname\fR [\fIalias-file\fR] .PP aliascheck \-\-map [\-\-case] \fIname\fR \fImap-file\fR .PP aliascheck \-\-qmail [\-\-nopwd] \fIname\fR [\fIalias-user\fR] .SH "DESCRIPTION" .IX Header "DESCRIPTION" aliascheck checks whether \fIname\fR is a valid email alias or a user in the password file. It converts \fIname\fR to lower-case before performing any of the checks. If the alias or user exists, aliascheck exits with status 0 and outputs what the address resolves to. If the alias does not exist, aliascheck exits with status 1. If aliascheck cannot determine the validity of \fIname\fR because of some system error, it exits with status 2. .PP aliascheck can run in three different modes\*(--sendmail alias mode (the default), sendmail map mode, and qmail mode. In sendmail alias mode the second argument, \fIalias-file\fR, is the name of the sendmail alias file, typically \fI/etc/mail/aliases.db\fR. If no second argument is supplied, aliascheck first checks for the existence of \&\fI/etc/mail/aliases.db\fR, then for the existence of \fI/etc/aliases.db\fR, then finally exits with status 2 if neither file exists. When an alias is found, aliascheck outputs the value of that alias in the alias database. .PP When aliascheck is invoked with \fB\-\-map\fR, it looks up \fIname\fR in \&\fImap-file\fR, which should be a database created with sendmail's \&\fImakemap\fR\|(8) utility. Note that maps have a slightly different and incompatible format from that of alias files. Use the \&\fB\-\-case\fR argument to prevent \fIname\fR from being folded to lower-case before it is looked up in the database. Note that \fB\-\-map\fR implies the \fB\-\-nopwd\fR option. .PP When aliascheck is given the argument \fB\-\-qmail\fR, it runs in qmail mode. In this case, the second argument, \fIalias-user\fR, specifies the user under which qmail processes mail aliases. aliascheck will check this user's home directory for files named \fI.qmail\-XXX\fR for various appropriate suffixes \fI\s-1XXX\s0\fR. On success, it outputs the full pathname of the appropriate file. .PP If aliascheck cannot find an alias, it also checks the password file, and exits 0 if it can find \fIname\fR there. If \fIname\fR is found, aliascheck also outputs \fIname\fR (in lower-case) to standard output before exiting. (This is useful for Mail Avenger, because asmtpd does not recognize users with invalid shells or \s-1UID 0,\s0 while MTAs typically do.) To suppress password file checking, supply the \fB\-\-nopwd\fR argument to aliascheck. .SH "EXAMPLES" .IX Header "EXAMPLES" If you are using Mail Avenger in conjunction with a sendmail installation, you might want to put the following code in your \&\fI/etc/avenger/unknown\fR file to reject mail for unknown users who do not show up in the alias file. .PP .Vb 10 \& aliascheck "$RECIPIENT_LOCAL" /etc/mail/aliases.db > /dev/null \& case "$?" in \& 0) \& # Fall through to default checks \& ;; \& 1) \& reject unknown user \& ;; \& *) \& # Probably safest to do nothing, but could also \& # defer the mail with the following command: \& # \& #defer Temporary error processing alias file \& ;; \& esac .Ve .PP If you have qmail instead of sendmail, assuming the qmail \fIalias\fR user is called \f(CW\*(C`alias\*(C'\fR, you would change the first line in the previous example to: .PP .Vb 1 \& aliascheck \-\-qmail "$RECIPIENT_LOCAL" alias > /dev/null .Ve .SH "FILES" .IX Header "FILES" .IP "\fI/etc/avenger/unknown\fR" 4 .IX Item "/etc/avenger/unknown" Mail Avenger rules for local email addresses that do not correspond to local users, or correspond to local users without valid shells, or local users with uid 0 (i.e., root). Note the location may be different if you set \fBEtcDir\fR in your \fIasmtpd.conf\fR file. .IP "\fI/etc/mail/aliases.db\fR" 4 .IX Item "/etc/mail/aliases.db" .PD 0 .IP "\fI/etc/aliases.db\fR" 4 .IX Item "/etc/aliases.db" .PD Default locations of sendmail alias file .IP "\fI/etc/mail/virtusertable.db\fR" 4 .IX Item "/etc/mail/virtusertable.db" Default location of the sendmail virtual user table map, when this feature is in use. .IP "\fI~alias/.qmail\-*\fR" 4 .IX Item "~alias/.qmail-*" Default locations of qmail alias files .IP "\fI/etc/password\fR" 4 .IX Item "/etc/password" System password file. (Note, however, that aliascheck uses the \&\fIgetpwnam\fR function, and will thus be compatible with schemes such as \&\s-1NIS\s0 that do not keep all users in the local password file.) .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIavenger\fR\|(1), \&\fIasmtpd.conf\fR\|(5), \&\fImakemap\fR\|(8), .PP The Mail Avenger home page: . .SH "BUGS" .IX Header "BUGS" aliascheck doesn't necessarily know how to parse the particular database format your sendmail installation uses for aliases. Make sure you test it before using it in an avenger script. .PP In some sendmail installations, the alias database is not world readable, which can obviously prevent aliascheck from working properly if run under the wrong user identity (such as the \fBAvengerUser\fR). .PP It is quite possible for aliascheck to return a system error (exit code 2), particularly if you run it while you are rebuilding a large alias database. (aliascheck checks for the existence of special key \&\f(CW\*(C`@\*(C'\fR in the database.) Make sure you differentiate between error code 1 (no user) and error code 2 (system error). .PP aliascheck may not do the right thing if you installed qmail with \&\fIconf-break\fR set to a character other than \f(CW\*(C`\-\*(C'\fR. .PP Remember that aliascheck does not read your qmail \fIusers/assign\fR or \&\fIusers/cdb\fR files\*(--it only checks for \fI.qmail\fR files in the alias user's home directory. .SH "AUTHOR" .IX Header "AUTHOR" David Mazie\*`res