###################################################################### # # Configuration file for Version 8 Sendmail # Written by Brian Katzung # # This software is provided on a strictly as-is basis. # Use it at your own risk. # # m4 parameters: # ADDLOC add $w to local user names # DNS may be required for DNS lookups # NOUNKNOWN don't verify known/unknown internet hosts # SOL2 use Solaris 2 "mail.local" for delivery # UUXHACK chop off $=w! from $=w!$+@$+ # VIAPCT route local hosts via the % hack define(`UUXHACK', `1')dnl define(`VIAPCT', `1')dnl # # Canonical form = user h [map[.map]:] flags [search] [mailer] # Search = k [map] r # Mailer = [mailer][:[relay][:[new_host]]] # Fflag = (host known) or (host unknown) # Pflag = (processing enabled) or (disabled) # Sflag = (normal syntax) or (route syntax) # # Key to user-type tags and pseudo-domains: # ~ADR Numeric address spec ([a.b.c.d]) # ~EMS Local address with an embedded (non-initial) slash # ~FQD An address with a fully qualified domain name # ~HST An address with an unqualified host # ~INC Local file alias (:include:/$+) # ~LDS Local address with a leading slash (but not X.400) # ~NOH No host part (user part only) # ~PRC Local process (pipe) address (|$+) # ~STA An address that stays here when others get rerouted # ~THH This host, by any name # UUCP A UUCP address in domain syntax # ~VIA A non-local address via here # ~X4 Local address in X.400 syntax (/$+=$*/) # # Version BK-2.3.6 23 Mar 1998 # Added NOUNKNOWN option and envelope aliasing is now separate from # user_aliases. # Version BK-2.3.5 21 Mar 1997 # Fixed xtcp externalization of this host's unqualified names and # added an M4 conditional for the Solaris 2 local mailer # Version BK-2.3.4 28 Oct 1996 # Can deliver for any host locally # Version BK-2.3.3 2 Oct 1996 # Fixed host!host...!user UUCP address parsing and UUXHACK M4 processing # Version BK-2.3.2 28 Aug 1996 # Removed '#m4' prefixes and added user replacement in host aliasing # Version BK-2.3.1 30 Jul 1996 # Removed incorrect U mailer flags for duucp and xduucp mailers # Version BK-2.3 12 - 16 Jun 1996 # Added canonical form with tagged gazes for robustness and rewrote # to avoid redundant mailer-table lookups. Also supports "." no-change # indicator in user and host aliases. # Version BK-2.2 30 May - 12 Jun 1996 # Generalized user aliasing. # Version BK-2.1 24 - 30 May 1996 # Rewrote .~DIR/.~IND stuff as .~THH to .~NOH transition. # Version BK-2.0 5 Aug 1994 - 15 May 1996 # Table-driven V8 configuration. V5 DVBK-2.3.6 # Primary short host name Dwkatsun # Interchangeable short host names Cw$w # My UUCP host name DU$w # Primary domain name Dmchi.il.us # Interchangeable domain names Cm$m # Primary qualified host name # (This is used for message tracking and UUCP return routes.) Dj$w.$m # Fully qualified host names not covered by $=w.$=m Cj$j $w.UUCP katzung.pr.mcs.net localhost # Is this host the domain ($m), or is it inside the domain ($j)? # (This is used for qualifying local addresses.) #DJ$m DJ$j # Default local mailer DLtcp # Local mailers CLhere local tcp duucp # Default remote mailer DRxtcp # Neighboring UUCP hosts FU/etc/mail/uucp_names # Users to assign the ~STA user-type CSroot postmaster hostmaster mailer-daemon # location of alias file OA/etc/mail/aliases # location of help file OH/etc/mail/sendmail.hf # queue directory #OQ/tmp OQ/usr/spool/mqueue # status file OS/etc/mail/sendmail.st # name used for error messages DnMailer-Daemon # UNIX header format DlFrom $g $d # delimiter (operator) characters Do.:%@!^=/[]| # format of a total name Dq$g$?x ($x)$. # SMTP login message De$j Sendmail $v/$V ready at $b # default UID Ounobody # default GID Ognogroup # default delivery mode (deliver in background) Odbackground # rebuild the alias file automagically OD # temporary file mode -- 0600 for secure mail, 0644 for permissive OF0600 ifelse(DNS, `1', ` OI ')dnl # log level OL9 # default messages to old style Oo # Cc my postmaster on error replies I generate OPPostmaster # queue up everything before starting transmission, for safety Os # return queued mail after this long OT3d # Cache (four) machine connections (for two minutes) Ok4 OK120 ### Message precedences Pfirst-class=0 Pspecial-delivery=100 Pbulk=-60 Pjunk=-100 ### Format of headers H?P?Return-Path: <$g> HReceived: $?sfrom $s $.by $j$?r with $r$. ($v/$V) id $i; $b H?D?Resent-Date: $a H?D?Date: $a H?F?Resent-From: $q H?F?From: $q H?x?Full-Name: $x HSubject: H?M?Resent-Message-Id: <$t.$i@$j> H?M?Message-Id: <$t.$i@$j> HErrors-To: ###################################################################### # "Built-ins" rule sets #===================================================================== # Host aliasing built-ins # R$*kflag>k$*r$* $@ $1k$2r$3 # R$*kflag>k$*r$* $@ $1k$2r$3 # R$*kflag>k$*r$* $@ $1k$2r$3 S15 #===================================================================== # Mailer and relay selection built-ins # R$*kflag>k$*r$* $@ $1k$2r$3 S17 ###################################################################### ## Main rewriting rules # Indirect address delimiters CA@ % ! # "Here" and "via here" pseudo-domains CH~THH ~NOH ~VIA # Special map lookup tags CM~ADR ~FQD ~HST # User-type tags CP~STA ~INC ~PRC ~LDS ~EMS ~X4 ~REG #===================================================================== # Address canonicalization S03 R!$+! $: $>4 $1 Recanonicalize our form R$+! $@ $1! Leave envelope addresses alone # ifelse(UUXHACK, `1', ` R$=w!$+@$+ $2@$3 Clean up uux(qt) stupidity R$U!$+@$+ $1@$2 ')dnl # # RFC-822 parsing and host focussing. Rewrite in the form # @user for user@host or :user for @host:user. # # The next line comes from John Halleck, nahaj@cc.utah.edu. R$*<$*<$*>$*>$* <$3>$5 Extract RFC-822 address R$*<$+>$* $2 R$*<>$* $: $n Special case "From: <>" R$+,$+:$+ $1:$2:$3 Make routes easy to parse R$+ $: !$1 A processing enable flag R!@$+:$+ $: $2h Route syntax R!$+@$+ $: !$1@<$2> Focus on host R!$+<$+@$+> !$1$2@<$3> Tighten focus R!$+@<$+> $: $1h Normal syntax R!$+!$+ $: !<$1>!$2 !user R!<$+!$+>!$+ !<$1>!$2!$3 !host...!user R!<$+.$+>!$+ $: $3h host.dom!user R!<$+>!$+ $: $2h host!user R!$+%$+ $@ $>3 $1@$2 Retry user%host as user@host R!$+ $: $1h No host part # R$+h$* $: $>11 $1h$3k Cleanup host and tags R$+h$*k $: $1h$3 R$+h$* $: $1h$4 This host is known R$*$=A$*h$* $@ $1$2$3h$5 Fix ~THH & stop if really ~VIA # # Analyze user type for addresses that are here R$=Sh$* $@ $1h$4 "Stay here" user ` R:include:$+h$* $@ :include:$1h$4 File (include) alias 'dnl R|$+h$* $@ |$1h$4 Process (pipe) alias R/$+=$*/h$* $@ /$1=$2/h$5 X.400 address R/$*h$* $@ /$1h$4 Leading slash R$+/$*h$* $@ $1/$2h$5 Embedded slash R$+h$* $@ $1h$4 Everything else # R$+h$* $: $>12 $1h$3k Tag unknown hosts R$+h$*kr $: $1h$3 #===================================================================== # Sender rewriting S01 R$*|$* $: $>3 $n Disallow command as sender R$+h$*$* $: $>14 $1h$3$5$4>k Host aliasing R$+r $: $1r Select sender fork R$+r $: $1 Requested no change R$+r $: $>3 $2 Recanonicalize after alias R$+r $: $>3 $2@$3 R$+h$*r $: $>3 !$1h$3! R$+h$* $: $>20 $1h ua:$3 User aliasing #===================================================================== # Recipient rewriting S02 R$+! $@ $1! Leave envelope addresses alone R$+h$*$* $: $>14 $1h$3$5$4>k Host aliasing R$+r $: $1r Select recipient fork R$+r $: $1r Discard envelope fork R$+r $: $1 Requested no change R$+r $: $>3 $2 Recanonicalize after alias R$+r $: $>3 $2@$3 R$+h$*r $: $>3 !$1h$3! R$+h$* $: $>20 $1h ua:$3 User aliasing #===================================================================== # Final address cleanup S04 R$+h$* $: $1h$3 Drop local tags R$+h$* $: $1h$3 Drop user type R$+h$* $: $1 User only R$+h$* $: $2!$1 Convert to UUCP syntax R$+h$*$* $: @$2:$1 Rewrite to route form R$+h$* $: $1@$2 Rewrite to standard form R$+:$+:$+ $1,$2:$3 @a:@b:u -> @a,@b:u #===================================================================== # Map domain literal # Input: $*kflag>k$* # Output: $1k$2 [if mapping fails] # $1kflag>k$2 [if mapping succeeds] S10 R$*$->k$* $: $1$4>kr$5 Try to map it R$*$->kr$* $@ $1$4>k$6 Failed R$*$->kr$* $: $1k$6 Succeeded R$+ $: $>11 $1 Retag the host R$+ $: $>12 $1 Check for unknown host R$*kr$* $: $1$3>k$4 #===================================================================== # Host tag canonicalization # Input: $*k$* # Output: $1k$2 S11 # R$*k$* $1k$5 Strip mapping tags R$*k$* $1k$5 R$*k$* $1k$5 Strip user type R$*k$* $1k$3 Strip trailing dots R$*k$* $@ $1k$2 Retag "no host" R$*k$* $@ $1k$3 Retag this host R$*k$* $@ $1k$3 R$*k$* $@ $1k$4 #===================================================================== # Tag unknown hosts Kkh host -a.~KH S12 R$*k$* $@ $1kr$4 This host is always known R$*k$* $@ $1kr$3 Known UUCP host R$*k$* $@ $1kr$3 Unknown UUCP host ifelse(NOUNKNOWN, `1', ` R$*k$* $@ $1kr$3 Assume known host ',` R$*k$* $: $1kr$3 R$*r$* $@ $1r$3 Found it - known host R$*kr$* $: $1kr$5 R$*r$* $@ $1r$3 Found it - known host R$*r$* $@ $1r$3 Unknown host ')dnl #===================================================================== # Look for an entry for the double-focussed host in a map. # Input: $*kflag>k mapr # Output: $*:$-$-k$+ [if scan is incomplete] # $*.$-$-k mapr$* [match found] # $*.$-$-k mapr$* [no match found] S13 # Check , , or <~typ.~NOH> R$*$->k$-r$* $: $1$3>k$4r$5 # Check R$*:>k$-r$* $: $1:>k$4r$5 # # Look for a matching (super-)domain entry: # Check unknown_host R$*.>k$-r$* $: $1.>k$4r$5 # Check [th.is.ho.st]<~ADR.~typ.~THH> R$*:>k$-r$* $: $1:>k$4r$5 # Check [th.is.ho.st]<~ADR.~THH> R$*:>k$-r$* $: $1:>k$4r$5 # Check host<.domain>, thishost<.domain.~typ.~THH>, or ~typ<.~NOH> R$*$->k$-r$* $: $1$4>k$5r$6 # Check thishost<.domain.~THH> R$*:>k$-r$* $: $1:>k$5r$6 # Last chance host aliasing without UUCP (ie, try after x) R$*$->k har$* $: $1$3>k har$4 # R$*$*k$-r$* $@ $1$2k$4r$6 Stop on match # # Figure out what, if anything, to try next. R$+$->k$* $@ $1$3>k$4 Check .~ADR default # R$*$->k$+ $@ $1$4>k$5 Try domain R$*$->k$+ $@ $1$5>k$6 Try super-domain # R$*$*$->k$+ $@ $1$2$5>k$6 Nothing else to try R$*$*:>k$+ $@ $1$2:>k$5 R$*$*$->k$+ $@ $1$2$4>k$5 # # Check .~FQD or .~HST default R$*$->k$* $@ $1$4>k$5 R$*$->k$* $@ $1$3>k$4 #===================================================================== # Host aliasing # Input: $*kflag>k$* # Output: $1$2 [if host was not rewritten] # $1r$3 [if host was rewritten] # $1r$3 # $1r$3 # New "host" is a new host (host), a new user (user@), a new user at # a new host (user@host), or no change (.). Kha dbm -o /etc/mail/host_aliases S14 R$*k$* $: $>15 $1k har$3 Host alias; check b.i. R$+h$*r$* $: $1h$3r$4 Enable if no match yet R$*$*r$* $>13 $1$2r$3 Iterate over sub-domains R$*$* $: $1$2 Remove processing flag R$*k$-r$* $: $1kr$5 Remove map name R$*k$* $: $1$3 Remove key R$*r$* $: $1$2 Remove result if empty #===================================================================== # Mailer and relay selection # Input: $*kflag>k$* # Output: $1$2error:message # $1$2mailer:[relay]:[newhost] Kmt dbm -o /etc/mail/mailer_table S16 R$*k$*$* $@ $1$3$4 Already present R$*$->k$* $: $>10 $1$4>k$5 Try to map literal R$*k$* $: $>17 $1k mtr$3 Mailer table; check b.i. R$+h$*r$* $: $1h$3r$4 Enable if no match yet R$*$*r$* $>13 $1$2r$3 Iterate over sub-domains R$*$* $: $1$2 Remove processing flag R$*k$-r$* $: $1kr$5 Remove map name R$*$->kr$* $: $1r$4 Host is default relay R$*k$* $: $1$3 Remove key R$*r$* $@ $1$3error$2 Return immediately for error R$*r$* $: $1r$3 Canonical syntax R$*r$* $: $1r$6 R$*r$* $: $1kr$5 Tag relay R$*kr$* $: $1r$6 R$*r$* $@ $1$6here::$5 Sending to ourself R$*r$* $@ $1$5$L:$2.$3:$4 Assume it's a local host R$*r$* $@ $1$5$R:$2.$3:$4 Assume it's a remote host R$*r$* $@ $1$4$L:$2:$3 Assume it's a local host R$*r$* $@ $1$3$2 #===================================================================== # Mail routing and envelope address rewriting S00 ifelse(0, ` # Choke if the file has not been pre-processed by m4 R$+ $# error $: Configuration error: not m4 pre-processed ')dnl R$+h$* $: $>10 $1h.>k$4 Try to map literal R$+h$->k$* $: $1h$5 Failed R$+h$->k$* $: $>3 !$1h$4! Succeeded; recanonicalize # R$+h$*$* $: $>14 $1h$3$5$4>k Host aliasing R$+r $1r Select envelope fork R$+r $: $1 Requested no change R$+r $: $>3 $2 Recanonicalize after alias R$+r $: $>3 $2@$3 R$+h$*r $: $>3 !$1h$3! R$+h$* $: $>20 $1h ea:$3 User envelope aliasing R$+ $@ $>18 $1 Common processing #--------------------------------------------------------------------- # Common mail routing S18 R$+h$*$* $: $>16 $1h$3$4>k$5 Mailer & relay R$+h$*error:$+ $# error $: $4 \ [$1@$2] # R$+h$*here:$*:$+ $@ $>19 !$1h$3! Start all over R$+h$*local:$*:$+ $@ $>19 !$1h$3! # R$+h$*$+:$*:$+ $: $>11 $1h$3k$4:$5:$6 Tag new host R$+h$*k$+ $: $1h$2$4 Plug in new host # # Delivery via UUCP transport R$+duucp:$+:$* $# duucp $@ $2 $: $1! R$+xduucp:$+:$* $# xduucp $@ $2 $: $1! R$+h$*uucp:$+:$* $# uucp $@ $4 $: $1! # ifelse(DNS, `1', ` R$+$*:$+:$* $: $1$2:$3.:$4 Anchor relay host name ')dnl # Delivery via TCP transport R$+h$*tcp:$+:$* $# tcp $@ $5 $: $1! R$+tcp:$+:$* $# tcp $@ $2 $: $1! R$+h$*xtcp:$+:$* $# xtcp $@ $5 $: $1! R$+xtcp:$+:$* $# xtcp $@ $2 $: $1! # # Local delivery R$+h$*local:$* $# local $: $1! Local delivery requested R$+h$*here:$* $# local $: $1! Nothing more to try R$+local:$* $: $1 Not sufficiently parsed! R$+here:$* $: $1 Try something else # R$+$*$*:$*:$* $# error $: Invalid mailer or relay: $4/$5 [$1@$2] # R$+h$* $@ $>18 $1h$4 Retry local type as "no host" R$+$* $@ $>19 $1 Reparse user without local host # R$+ $# error $: Configuration error [$1] #--------------------------------------------------------------------- # Reparse after local host elimination S19 R$+ $: $>3 $1 Recanonicalize R$+ $@ $>0 $1 Reprocesses #===================================================================== # User name aliasing # (Rewrite the entire user name including host part) # Input: userh all_map.local_map:$* # userh map:$* # Output: userh $1 # Use map "-" to bypass the "all" or "local" lookup pass. # Kea dbm -o /etc/mail/envelope_aliases Kua dbm -o /etc/mail/user_aliases Kxa dbm -o /etc/mail/external_aliases # S20 # Try to alias user@host (and user@~tag if host is tagged) R$+h$+:$* $@ $1h$4 Ignore indirects R$+h$+:$* $: $1h$3:>k$4 Copy address R$+>k$+ $: $1$4 Skip this lookup if ~NOH R$+>k$+ $: $1>k$6 Remove host tag if ~THH R$+>k$+ $: $>21 $1k$4 Try to alias (if there's a host) R$*r$* $@ $1$2 Requested no change R$*r$* $@ $>3 $2 Canonicalize & stop if aliased R$+h$+:$* $: $>21 $1h$5:k$6 ~THH/~NOH R$*r$* $@ $1$2 Requested no change R$*r$* $@ $>3 $2 Canonicalize & stop if aliased # Try to alias user if user@host is local R$+h$-.$+:$+ $: $1h$4:$5 Drop the first map name if > 1 R$+h-$*:$+ $@ $1h$4 Bypass local lookup R$+h$*$* $: $>16 $1h$3$4>k$5 Mailer & relay R$+h$+:$*$=L$* $: $>21 $1h$3:k$4$5$6 User only R$*r$* $@ $1$2 Requested no change R$*r$* $@ $>3 $2 Canonicalize & stop if aliased R$+h$+:$* $: $1h$4 Remove map names #--------------------------------------------------------------------- # Perform one user alias lookup # Input: userh map$*:k$* # Output: userh map$1:$2 [no match] # userh map$1:r$2 [matched] S21 R$+h-$+k$* $@ $1h-$3$4 Skip if map is empty # Do the lookup. %1 = user; %2 = host; %3 = $J R$+h$-$+k$* $: $1h$3$4r$6 R$+r$* $: $1$2 Remove empty result ###################################################################### # Mailer specifications and rule sets #===================================================================== # Local and program mailers ifelse(SOL2, `1', ` Mlocal, P=/usr/lib/mail.local, F=flsSDFMmnP, S=30, R=30, A=mail.local -d $u ', ` Mlocal, P=/bin/mail, F=rlsDFMmnP, S=30, R=30, A=mail -d $u ')dnl Mprog, P=/bin/sh, F=lsDFMeuP, S=30, R=30, A=sh -c $u # S30 R$+! $@ $1 Strip envelope flag and return #===================================================================== # TCP mailers #--------------------------------------------------------------------- # Internal Mtcp, P=[TCP], F=msDFMuX, S=31, R=31, A=TCP $h # S31 R$+! $@ $1 Strip envelope flag and return R$+h$* $@ $2!$1h$3 Transition from UUCP "domain" ifelse(ADDLOC, `1', ` R$+h$* $: $1h$3 Include local host name ')dnl #--------------------------------------------------------------------- # External Mxtcp, P=[TCP], F=msDFMuX, S=32, R=32, A=TCP $h # S32 R$+! $@ $1 Strip envelope flag and return R$+h$* $: $>20 $1h xa:$3 External aliasing R$+h$* $@ $2!$1h$3 Transition from UUCP "domain" R$+h$* $@ $1h$3 Include host or domain R$+h$* $@ $1h$5 Already qualified R$+h$* $@ $1h$4 Replace our unqualified name R$+h$* $@ $1h$4 Already qualified ifelse(VIAPCT, `1', ` R$+h$* $@ $1%$2h$3 Via here using % hack ', ` R$+h$* $@ $1h$3 Qualify host with our domain ')dnl #===================================================================== # UUCP mailers #--------------------------------------------------------------------- # UUCP-style addresses Muucp, P=/usr/bin/uux, F=msDFMhuU, S=40, R=40, A=uux - -a$f -gC $h!rmail ($u) # S40 R/$+! $@ %/$1 X.400 envelope R$+! $@ $1 regular envelope R$+h$* $: $>20 $1h xa:$3 External aliasing R$+h$* $: $2!$1 user@h.uucp -> h!user R$+h$* $: $1 user@here -> user R$+h$* $: $2!$1 user@h.d -> h.d!user R$+ $@ $U!$1 prepend UUCP host name #--------------------------------------------------------------------- # Internal domain-style addresses Mduucp, P=/usr/bin/uux, F=msDFMhu, S=41, R=41, A=uux - -a$f -gC $h!rmail ($u) # S41 R/$+! $@ %/$1 X.400 envelope R$+! $@ $1 regular envelope R$+ $@ $>31 $1 use internal TCP rules #--------------------------------------------------------------------- # External domain-style addresses Mxduucp, P=/usr/bin/uux, F=msDFMhu, S=42, R=42, A=uux - -a$f -gC $h!rmail ($u) # S42 R/$+! $@ %/$1 X.400 envelope R$+! $@ $1 regular envelope R$+ $@ $>32 $1 use external TCP rules