########################################################### # # SENDMAIL CONFIGURATION FILE # # This software is provided on a strictly as-is basis. # Use it at your own risk. # # In addition to the parameters defined at the top of the file, search # for '#?' to locate rules that may need to be enabled or disabled or # use m4 to configure. # # m4 parameters (sed 's/^#m4//' generic | m4 hostdefs -): # SMV8 sendmail V8 # DNS use DNS lookups # DOLBR SunOS/compatible ${M$K$} syntax # PCTY SunOS/compatible $%y syntax # ADDLOC add $w to local user names # NSDIR numeric spec direct delivery # # The file was originally based on Sun's sendmail.subsidiary.cf, # but has been extensively rewritten by Brian Katzung. # It assumes that you are using a version of sendmail that supports # multi-token class matching. #m4define(`SMV8', `1')dnl # The default domain is the system domain name without the first component. # Use Dm to override it. This is used on internal out-going mail. #Dm # Official, qualified hostname # (This is used for message tracking and UUCP return routes.) Dj$w.$m # Is this host the domain ($m), or is it inside the domain ($j)? # (This is used for qualifying local addresses.) DJ$m #DJ$j # Interchangeable domains (in-coming) Cm$m # Interchangable hostnames Cw # Fully qualified hostnames not covered by $=w.$=m Cj$w.uucp # My UUCP name DU$w # Neighboring UUCP sites #FU/etc/sendmail/hosts.uucp CU # Internal Smart UUCP sites #FV/etc/sendmail/hosts.intsuucp CV # External Smart UUCP sites #FW/etc/sendmail/hosts.extsuucp CW # External TCP hosts #FX/etc/sendmail/hosts.exttcp CX # Internal TCP hosts (use this if you're not running NIS) #FY/etc/sendmail/hosts.inttcp CY # Hosts we impersonate (typically TCP LAN gateways for UUCP hosts) CI # Internal relay host DRmailhost # Internal relay mailer DMtcp # Domains that go to the internal relay CD # External relay host DXmailhost # External relay mailer DYxsuucp # Domain for external mail DE$m # Domains that cannot be resolved by DNS and must go # through the external relay CE.bitnet # Version number of configuration file DVBK-1.14 # SunOS NIS map names (these need not be commented out if you are not # running NIS or the maps are not defined) DAmail.aliases DHhostmap DZalias.byname #m4ifelse(SMV8, `1', ` # V8 maps using NIS #? Comment out this section if you are not using V8 sendmail. #Kma nis -o mail.aliases # mail aliases map Kma dbm -o /etc/mail/user.aliases # user mail aliases map Kfn nis -o alias.byname # login -> full name map Khm nis -o hostmap # host mapping table Kih nis -m -o -a.~INT hosts.byname # internal hosts (like SunOS $%y) #m4')dnl ################################################# ## General configuration information ################################################# ### Standard macros # 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 ############### ### Options ############### #? Select option R if appropriate for your version of sendmail # SunOS: Remote mode - send through server if mailbox directory is mounted # V8: Route stripping #OR # location of alias file OA/etc/aliases #m4ifelse(SMV8, `1', ` OAnis:mail.aliases #m4')dnl # default delivery mode (deliver in background) Odbackground # rebuild the alias file automagically OD # temporary file mode -- 0600 for secure mail, 0644 for permissive OF0600 #m4ifelse(DNS, `1', ` #? Disable the next line if you are not using DNS OI #m4')dnl # default UID Ou65534 # default GID Og65534 # location of help file OH/usr/lib/sendmail.hf # log level OL9 # default messages to old style Oo # Cc my postmaster on error replies I generate OPPostmaster # queue directory OQ/usr/spool/mqueue # read timeout for SMTP protocols (not in V8) Or15m # status file OS/etc/sendmail.st # queue up everything before starting transmission, for safety Os # return queued mail after this long OT3d ### Message precedences Pfirst-class=0 Pspecial-delivery=100 Pbulk=-60 Pjunk=-100 ### Trusted users T root daemon uucp ### 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: ########################### ### Rewriting rules ### ########################### ################################## ## Sender Field Pre-rewriting ## ################################## S1 R$*|$* $@ $n sender may not be a command R$+ $: $>7 $1 ##################################### ## Recipient Field Pre-rewriting ## ##################################### S2 #m4ifelse(SMV8, `1', `', ` #? Disable the next line if you are using V8; it cannot handle it. R$#$+$:$+ $: $2 reduce to user for debugging #m4')dnl R.!$+ $@ .!$1 leave envelope addresses alone R$+ $: $>7 $1 ############################ ## Name Canonicalization ## ############################ # Internal format of names within the rewriting rules is: # anything<@host.domain.domain...>anything # We try to get every kind of name into this format, except for local # names, which have no host part. The reason for the "<>" stuff is # that the relevant host name could be on the front of the name (for # source routing), or on the back (normal form). We enclose the one that # we want to route on in the "<>"s to make it easy to find. # S3 # Leave envelope addresses alone R.!$+ $@ .!$1 # handle "from:<>" special case R$*<>$* $@ @ turn into magic token # basic textual canonicalization # (kudos to John Halleck, nahaj@cc.utah.edu) R$*<$*<$*>$*>$* <$3>$5 strip left sides R$*<$+>$* $2 basic RFC822 parsing R/$* $: %/$1 prevent "/" addresses such as R@$+:/$* $: @$1:%/$2 X.400 from matching paths # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later R@$+,$+:$+ @$1:$2:$3 change all "," to ":" R@$+:$+ $@ $>6 <@$1>:$2 src route canonical R$+:$*;@$+ $@ $1:$2;@$3 list syntax R$+@$+ $: $1<@$2> focus on domain R$+<$+@$+> $1$2<@$3> move gaze right R$+<@$+> $@ $>6 $1<@$2> already canonical # convert old-style names to domain-based names # All old-style names parse from left to right, without precedence. R$+!$+ $: <$1>!$2 R<$+.$+>!$+ $@ $>6 $3<@$1.$2> host.domain!user R<$+>!$+ $@ $>6 $2<@$1.UUCP> uucphost!user R$+%$+ $@ $>3 $1@$2 user%host R$+ $@ $>6 $1 ################################### ## Final Output Post-rewriting ## ################################### S4 R$*<@$+.>$* $1<@$2>$3 strip trailing dot R$*<@$+.~>$* $1<@$2>$3 strip quote R$*<@$+.~INT>$* $1<@$2>$3 strip internal flag R$+<@$+.UUCP> $2!$1 u@h.uucp => h!u R$+ $: $>9 $1 Clean up addr R$*<$+>$* $1$2$3 defocus ##################################################################### ## Clean up a name for passing to a mailer (but leave it focused) ## ##################################################################### S9 R$=w!@ $@ $n R@ $@ $n handle <> error addr R<@$+>$*:$+:$+ <@$1>$2,$3:$4 canonical ################################# ## Special local conversions ## ################################# # Local conversions for all addresses (S3) S6 R$*<@[$+]>$* $: $1<@$[[$2]$]>$3 canonicalize known hosts R$*<@$+.>$* $1<@$2>$3 strip trailing dot R$=w!$*@$+ $2@$3 clean up uux(qt) stupidity #m4ifelse(SMV8, `1', ` #? V8/compatible host name mapping R$*<@$+>$* $: $1<@$(hm $2 $)>$3 #m4', DOLBR, `1', ` #? SunOS/compatible host name mapping R$*<@$+>$* $: $1<@${H$2$}>$3 #m4')dnl # Normalize to preferred host names and domains R$*<@$=I>$* $@ $1<@$2>$3 leave impersonations alone R$*<@$=I.$=m>$* $@ $1<@$2>$4 but short R$*<@$=j>$* $@ $1<@$2>$3 leave our explicit names alone R$*<@$=w.$=m>$* $@ $1<@$J>$4 preferred interchangeable host R$*<@$=m>$* $@ $1<@$m>$3 use preferred domain R$*<@$+.$=m>$* $@ $1<@$2.$m>$4 R$*<@$=w>$* $@ $1<@$w>$3 local host # Local conversions for S1/S2 (not S0/S3) S7 R$*<@$*>$* $@ $1<@$2>$3 done if host is present #m4ifelse(ADDLOC, `1', ` #? Enable the following rule if internal hosts require our short # host name to deliver replies. This is not necessary if aliases # or remote mode direct mail to the proper server for each user. R$+ $@ $1<@$w> add local host to user name #m4')dnl ##################################################### # Flag internal host names for login name expansion # ##################################################### S21 R$*<@$+.~INT>$* $@ $1<@$2.~INT>$3 already flagged R$*<@$=I>$* $: $1<@$2.~>$3 quote impersonated hosts R$*<@$=I.$=m>$* $: $1<@$2.$3.~>$4 R$*<@$=j>$* $@ $1<@$2.~INT>$3 our explicit names are internal R$*<@$=w.$=m>$* $@ $1<@$2.$3.~INT>$4 our interchangeable names R$*<@$=w>$* $@ $1<@$2.~INT>$3 R$*<@$=m>$* $@ $1<@$2.~INT>$3 our domains are internal R$*<@$+.~>$* $: $1<@$2>$3 strip impersonation flag # Categorize enumerated external hosts as external. R$*<@$=U>$* $@ $1<@$2>$3 assumed external host R$*<@$=U.UUCP>$* $@ $1<@$2.UUCP>$3 assumed external host R$*<@$=W>$* $@ $1<@$2>$3 known external host R$*<@$=W.UUCP>$* $@ $1<@$2.UUCP>$3 known external host R$*<@$=X>$* $@ $1<@$2>$3 known external host # Categorize enumerated internal hosts, and hosts from the NIS passwd map # that have not been enumerated as external, as internal. R$*<@$=V>$* $@ $1<@$2.~INT>$3 known internal host R$*<@$=V.UUCP>$* $@ $1<@$2.UUCP.~INT>$3 known internal host R$*<@$=Y>$* $@ $1<@$2.~INT>$3 known internal host #m4ifelse(DNS, `1', `', PCTY, `1', ` #? Disable the next two lines if you are not using SunOS or you are using DNS R$*<@$%y>$* $@ $1<@$2.~INT>$3 known internal host R$*<@$%y.$=m>$* $@ $1<@$2.$3.~INT>$4 known internal host #m4')ifelse(SMV8, `1', ` #? Disable the next two lines if you are not using V8 R$*<@$+.$=m>$* $: $1<@$(ih $2 $).$3>$4 known internal host R$*<@$+>$* $: $1<@$(ih $2 $)>$3 known internal host #m4')dnl R$*<@$+.~INT.$+>$* $: $1<@$2.$3.~INT>$4 reposition flag ############################################################ ## Local and Program Mailer specification ############################################################ Mlocal, P=/bin/mail, F=rlsDFMmnP, S=10, R=10, A=mail -d $u Mprog, P=/bin/sh, F=lsDFMeuP, S=10, R=10, A=sh -c $u S10 R.!$+ $@ $1 strip envelope flag and return ############################################################ ## TCP Mailer specifications ############################################################ ## ## Internal ## Mtcp, P=[TCP], F=msDFMuX, S=11, R=11, A=TCP $h S11 R.!$+ $@ $1 strip envelope flag and return R$+<@$+.UUCP> $@ $2!$1<@$j> transition from UUCP "domain" ## ## External ## Mxtcp, P=[TCP], F=msDFMuX, S=12, R=12, A=TCP $h S12 R.!$+ $@ $1 strip envelope flag and return R%/$+ $: /$1 remove safety R$+:%/$+ $: $1:/$2 R$+ $: $1<@$J.~INT> guarantee a domain R$*<@$*>$*<@$J.~INT> $: $1<@$2>$3 undo if too many now R$+ $: $>21 $1 flag if internal #m4ifelse(SMV8, `1', ` #? V8/compatible R$+<@$+.~INT> $: $(fn $1 $)<@$2> strip flag; expand name #m4', DOLBR, `1', ` #? SunOS/compatible R$+<@$+.~INT> $: ${Z$1$}<@$2> strip flag; expand name #m4')dnl R$*<@$+.~INT>$* $: $1<@$2>$3 strip flag R$+<@$+.UUCP> $: $2!$1<@$j.~> transition from UUCP "domain" R$*<@$=I>$* $: $1<@$2.~>$3 quote impersonated hosts R$*<@$=I.$=m>$* $: $1<@$2.~>$4 quote impersonated hosts R$*<@$=w>$* $: $1<@$J>$3 use domain R$*<@$+.~>$* $: $1<@$2>$3 strip quote R$*<@$+>$* $: $1<<@$2>>$3 R$*<<@$+.$+>>$* $: $1<@$2.$3>$4 already has a domain R$*<<@$+>>$* $: $1<@$2.$m>$3 add domain R$*<@$*$E>$* $@ $1<@$2$E>$3 already external R$*<@$*$=m>$* $@ $1<@$2$E>$4 change to external domain ############################################################ # General code to convert back to old style UUCP names ############################################################ S5 R$+<@$=w> $@ $U!$1 name@here => mach!name R$+<@$+.$=m> $@ $2!$1 u@h.here => h!u R$+<@$+.UUCP> $@ $2!$1 u@h.uucp => h!u R$+<@$*> $@ $2!$1 u@h => h!u # Route-addrs do not work here. Punt til UUCP-mail comes up with something. R<@$+>$* $@ @$1$2 just defocus and punt R$*<$*>$* $@ $1$2$3 Defocus strange stuff ############################################################ ## UUCP Mailer specifications ############################################################ ## ## Plain ## Muucp, P=/usr/bin/uux, F=msDFMhuU, S=13, R=13, A=uux - -a$f -gC $h!rmail ($u) # It is assumed that plain UUCP hosts are external. Therefore, # login names are expanded if the $Z/fn map is present. S13 R.!$+ $@ $1 strip envelope flag and return R%/$+ $: /$1 remove safety R$+:%/$+ $: $1:/$2 R$+ $: $1<@$w.~INT> guarantee a host R$*<@$*>$*<@$w.~INT> $: $1<@$2>$3 undo if too many now R$+ $: $>21 $1 #m4ifelse(SMV8, `1', ` #? V8/compatible R$+<@$+.~INT> $: $(fn $1 $)<@$2> strip flag; expand name #m4', DOLBR, `1', ` #? SunOS/compatible R$+<@$+.~INT> $: ${Z$1$}<@$2> strip flag; expand name #m4')dnl R$*<@$+.~INT>$* $: $1<@$2>$3 strip flag R$+ $: $>5 $1 convert to old style R$=w!$+ $2 strip local name(s) R$+ $: $U!$1 prepend UUCP host name ## ## Smart (for hosts that understand @ addressing) ## Msuucp, P=/usr/bin/uux, F=msDFMhu, S=11, R=11, A=uux - -a$f -gC $h!rmail ($u) # See tcp rewriting rule set S11. ## ## External smart ## Mxsuucp, P=/usr/bin/uux, F=msDFMhu, S=14, R=14, A=uux - -a$f -gC $h!rmail ($u) S14 R.!$+ $@ $1 strip envelope flag and return R$+ $: $>12 $1 start with xtcp rewriting R/$* $: %/$1 restore safety # In case the external domain is UUCP... R$+<@$+.UUCP> $: $1!$2 revert to old style if UUCP ############################# ## RULESET ZERO PREAMBLE ## ############################# # Ruleset 30 just calls rulesets 3 then 0. S30 R$* $: $>3 $1 First canonicalize R$* $@ $>0 $1 Then rerun ruleset 0 #################### ## RULESET ZERO ## #################### S0 # On entry, the address has been canonicalized and focused by ruleset 3. # Handle special cases..... R@ $# local $: $n handle <> form # delete redundant local info R$*<@$=I>$* $: $1<@$2.~>$3 quote impersonated hosts R$*<@$=I.$=m>$* $: $1<@$2.~>$4 quote impersonated hosts R$*<$*@$=w.$=m>$* $1<$2>$5 mynames.mydomains R$*<$*@$=j>$* $1<$2>$4 myother.names R$*<$*@$=w>$* $1<$2>$4 thishost R$*<@$+.~>$* $: $1<@$2>$3 strip quote R<>:$+ $@ $>30 $1 retry after route strip R$+<> $@ $>30 $1 strip null trash & retry R$+ $: $>9 $1 clean up # Special mail forwarders # (Re)flag UUCP connections by category R$*<@$=V>$* $: $1<@$2.~INTSU>$3 internal smart R$*<@$=V.UUCP>$* $: $1<@$2.~INTSU>$3 internal smart R$*<@$=W>$* $: $1<@$2.~EXTSU>$3 external smart R$*<@$=W.UUCP>$* $: $1<@$2.~EXTSU>$3 external smart R$*<@$=U>$* $: $1<@$2.UUCP>$3 regular # Smart UUCP neighbors (internal) R<@$+.$+.~INTSU>$-$+ $# suucp $@ $1 $: .!$4<@$1.$2> @host[.domain].uucp:... R<@$+.~INTSU>$-$+ $# suucp $@ $1 $: .!$3<@$1> @host[.domain].uucp:... R$+<@$+.$+.~INTSU> $# suucp $@ $2 $: .!$1<@$2.$3> user@host[.domain].uucp R$+<@$+.~INTSU> $# suucp $@ $2 $: .!$1<@$2> user@host[.domain].uucp # (external) R<@$+.$+.~EXTSU>$-$+ $# xsuucp $@ $1 $: .!$4<@$1.$2> @host[.domain].uucp:... R<@$+.~EXTSU>$-$+ $# xsuucp $@ $1 $: .!$3<@$1> @host[.domain].uucp:... R$+<@$+.$+.~EXTSU> $# xsuucp $@ $2 $: .!$1<@$2.$3> user@host[.domain].uucp R$+<@$+.~EXTSU> $# xsuucp $@ $2 $: .!$1<@$2> user@host[.domain].uucp # Regular UUCP neighbors R<@$+.$+.UUCP>$-$+ $# uucp $@ $1 $: .!$4 @host[.domain].uucp:... R<@$+.UUCP>$-$+ $# uucp $@ $1 $: .!$3 @host[.domain].uucp:... R$+<@$+.$+.UUCP> $# uucp $@ $2 $: .!$1 user@host[.domain].uucp R$+<@$+.UUCP> $# uucp $@ $2 $: .!$1 user@host[.domain].uucp # Optimize names of known tcpnet hosts R$*<@$=X>$* $# xtcp $@ $2 $: $1<@$2>$3 user@ExtHost.there #m4ifelse(SMV8, `1', ` #? Disable the next three lines if you are not using V8 R$*<@$+.$=m>$* $: $1<@$(ih $2 $).$3>$4 user@NIShost.here R$*<@$+>$* $: $1<@$(ih $2 $)>$3 user@NIShost R$*<@$+.$+.~INT$*>$* $: $1<@$2.$3$4>$5 R$*<@$+.~INT$*>$* $# tcp $@ $2 $: $1<@$2>$4 #m4', DNS, `1', `', PCTY, `1', ` #? Disable the next two lines if you are not using SunOS or you are using DNS R$*<@$%y>$* $# tcp $@ $2 $: $1<@$2>$3 user@NIShost R$*<@$%y.$=m>$* $# tcp $@ $2 $: $1<@$2>$4 user@NIShost.here #m4')dnl R$*<@$=Y>$* $# tcp $@ $2 $: $1<@$2>$3 user@IntHost R$*<@$=Y.$=m>$* $# tcp $@ $2 $: $1<@$2>$4 user@IntHost.here # Domains the internal relay understands R$*<@$*$=D>$* $# $M $@ $R $: $1<@$2$3>$4 #m4ifelse(DNS, `1', ` #? Enable the following two rules if you are using DNS R$*<@$*$=E>$* $# $Y $@ $X. $: $1<@$2$3>$4 anything unfit for DNS R$*<@$+>$* $# xtcp $@ $2. $: $1<@$2>$3 #m4')dnl #m4ifelse(NSDIR, `1', ` # Enable the following two rules if you want to deliver to unknown numeric # spec hosts directly instead of going through an external relay (the spec # is dropped from the address in case the host fails to recognize itself) R$*<@[$+]> $# xtcp $@ [$2] $: .!$1 R<@[$+]>:$* $# xtcp $@ [$1] $: .!$2 #m4')dnl # Non-local things go to the external relay R$+ $: $>9 $1 Clean up, keep <> R$*<@$+>$* $# $Y $@ $X $: $1<@$2>$3 user@some.where R$*@$* $# $Y $@ $X $: $1<@$2> strangeness with @ # Local names with % are really not local! R$+%$+ $@ $>30 $1@$2 turn % => @, retry R%/$+ $# local $: .!/$1 local file paths #R|$+ $# local $: .!|$1 local program #R:include:$+ $# local $: .!:include:$1 local include R$+ $# local $: .!$1 local names