[comp.mail.sendmail] Sample config files

rsalz@bbn.com (Rich Salz) (11/15/89)

Some people might find the following config files useful.  They're
primarily for a site on the Internet that acts as the mail server to a
group of other workstations and servers.  All mail goes through the major
relay.  No UUCP connections, although that should be pretty easy to add.
(Run smail.)  This runs on a stock sendmail5.61 with bind picked up from
Berkeley.

As you might have guessed from my previous posts here, I've gone to some
trouble to strip out useless stuff (e.g., "HSubject").  I also removed
support for some old syntax, added comments, and reformatted and
restructed the whole file.  I think they're lots easier to read now.  The
final thing of note is that there are two TCP mailers defined, and two
types of host hiding:  mail sent outside of BBN goes out with
"rsalz@bbn.com" but internal mail sees "rsalz@MYHOST.bbn.com"

Since I'm a firm believe in the domain system, the only fake domains are
uucp and bitnet.  If you use these files, change the uucp mailer!

Hope others find these useful.
	/r$

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  sm.master.cf sm.slave.cf
# Wrapped by rsalz@prune.bbn.com on Tue Nov 14 17:40:55 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'sm.master.cf' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sm.master.cf'\"
else
echo shar: Extracting \"'sm.master.cf'\" \(8479 characters\)
sed "s/^X//" >'sm.master.cf' <<'END_OF_FILE'
X###
X###  SENDMAIL CONFIGURATION FILE
X###  This is the sendmail.cf for the mail server directly on the Internet
X###  with no UUCP connections that is part of a larger organization.  We
X###  are also the mail server for a handful of other machines (3/50's, etc).
X###
X
X##
X##  HOSTNAME MACROS AND CLASSES
X##
X
X##  The name we use inside our organization.
XDApineapple.bbn.com
X
X##  The name we use for the outside world.
XDBbbn.com
X
X##  The name of our corporate domain. While this will often be the same as $B,
X##  note that outoing stuff is often written "user@$B" but we check for hosts
X##  of the form "*.$C".
XDCbbn.com
X
X##  Our local domain name, stripped during manipulation.
XDDpineapple.bbn.com
X
X##  Internet address of this host.  If there's more than one, you have to
X##  define different macros for each one and add them to ruleset 0; there's
X##  a bug that doesn't allow this to be a class with multiple members.
XDI[128.11.0.16]
X
X##  List of top-level domains on the Internet
XCIARPA COM EDU GOV IL INT MIL NET ORG
XCIAR AT AU BE BR CA CH CL DE DK ES FI FR GR IE IN
XCIIS IT JP KR MX MY NI NL NO NZ PT SE SG TH UK US
X
X##  The official name of this host.
XDj$w
X
X##  The names of the hosts inside $C that we serve; messages to any of these
X##  machines will be delivered locally rather than forwarded.  Since we hide
X##  behind either the $A or $B name, above, nobody from the outside should
X##  ever see these, anyway.
XCNapricot
XCNassai
XCNcasaba
XCNcitron
XCNcoconut
XCNcronus
XCNcurrant
XCNgrape
XCNguava
XCNjim
XCNken
XCNkiwi
XCNlitchi
XCNmdean
XCNmelon
XCNmentor
XCNpapaya
XCNpeach
XCNpineapple
XCNplum
XCNprune
XCNrebecca-lillian
XCNstrawberry
XCNvulcan
XCNwahoo
X
X##
X##  GENERAL CONFIGURATION INFORMATION
X##  Stuff here is required and reflects some (minor) policy decisions.
X##  The real policy (i.e., how to route some domains) is in ruleset zero.
X
X##  SMTP login message.
XDe$j Sendmail $v/$V ready at $b.
X##  Format of the UNIX from line -- essentially a constant.
XDlFrom $g $d
X##  Name to use for returned mail -- essentially a constant.
XDnMAILER-DAEMON
X##  Token delimeters -- word separators in the rewrite rules below.
XDo.:%@![]
X##  Format of a sender's address; use full name if we've got it.
XDq$?x$x <$g>$|$g$.
X##  Version of this .cf file.
XDVrsalz-13-nov-89
X
X##  How many minutes to wait for the magic "@:@" alias?
XOa30
X##  Location of the alias file.
XOA/usr/lib/aliases
X##  If mailer has "e" (expensive) flag, just queue mail for it?
XOcT
X##  Default delivery mode (one of background, foreground, queue).
XOdbackground
X##  Rebuild alias database if necessary?
XODT
X##  Permissions for any temporary files we create.
XOF0644
X##  Default group id for mailers to run under.
XOg1
X##  Location of the SMTP help file.
XOH/dev/null
X##  Logging level.
XOL9
X##  Send to sender if an alias expansion includes her (a/k/a "me too")?
XOmT
X##  Allow headers to be in old style (i.e., spaces delimit names)?
XOoT
X##  Send a copy of errors someplace?
XOPpostmaster
X##  Location of the queue directory.
XOQ/usr/spool/mqueue
X##  Give up on connections after this long a time period.
XOr2h
X##  Queue up everything before starting transmission?
XOsT
X##  How long message can sit in queue before it's bounced back?
XOT3d
X##  Default user id for mailers to run under.
XOu1
X##  Password to enter wizard/debug mode.
XOW*
X
X##  Message precedences.
XPfirst-class=0
XPspecial-delivery=100
XPbulk=-50
XPjunk=-100
X
X##  Trusted users -- these people can fake headers.
XTroot
X
X##  Format of headers.  All our mailers want these lines -- who wouldn't?
XHReceived: $?sfrom $s $.by $j id <$i@$j>; $b
XHDate: $a
XHFrom: $q
XHMessage-Id: <$t.$i@$j>
XHResent-Date: $a
XHResent-From: $q
XHResent-Message-Id: <$t.$i@$j>
X
X##
X##  REWRITING RULES
X##
X##  These are the rules used for the following fields:
X##	From	3 -> 1 -> 4 -> 3 -> 1 -> S -> 4
X##	To	3 -> 0 -> 4
X##	From:	3 -> 1 -> 5 -> 4
X##	To:	3 -> 2 -> R -> 4
X##  where S and R stand for the mailer-specific rewrite rules named in
X##  the mailer definition.
X
X
X##
X##  RULESET  0 -- Pick a mailer.
XS0
XR$*<$*>$*		$1$2$3			defocus
XR$+			$:$>3$1			make canonical
XR@			$#local$:$n		nothing left, error
X# Delete local host name.
XR$*<$*$=N.LOCAL>$*	$1<$2>$4		thishost.LOCAL
XR$*<$*$=N.ARPA>$*	$1<$2>$4		thishost.ARPA
XR$*<$*$=N.UUCP>$*	$1<$2>$4		thishost.UUCP
XR$*<$*$=N>$*		$1<$2>$4		thishost
XR$*<$*.>$*		$1<$2>$3		drop trailing dot
XR<@>:$*			$@$>0$1			retry after route strip
XR$*<@>			$@$>0$1			strip null trash & retry
XR$*<@$=N.$C>		$1			keep slave host mail
X## Machine dependent part of ruleset 0.
X## Here is where we actually find a mailer to invoke.
XR$*<@$I>		$#local$:$1		u@[128.11.0.16]
X# Route our two fake domains through known gateways.
XR$*<@$*.UUCP>		$#tcprem$@UUCP_RELAY_SITE$:$1<@$2.UUCP>
XR$*<@$*.BITNET>		$#tcprem$@CUNYVM.CUNY.EDU$:$1<@$2.BITNET>
X# Sites local to our cluster.
XR$*<@$*.$C>$*		$#tcploc$@$2.$C$:$1<@$2.$C>$3
XR$*<@$*.BBN.COM>$*	$#tcploc$@$2.BBN.COM$:$1<@$2.BBN.COM>$3
X# Other non-local names will be kicked out.
XR$*<@[$+]>$*		$#tcprem$@[$2]$:$1@[$2]$3	numeric internet spec
XR$*<@$+>$*		$#tcprem$@$2$:$1<@$2>$3
X# Remaining names must be local.
XR$+			$#local$:$1
X
X
X##
X##  RULESET  1 -- From and From: fields.
XS1
X
X
X##
X##  RULESET  2 -- To: field.
XS2
X
X
X##
X##  RULESET  3 -- Basic name canonicalization.
XS3
X# Handle the SMTP "from:<>" as a special case.
XR<>			$@@			turn into magic token
X# Basic textual canonicalization.
XR$*<$+>$*		$2			basic RFC821/822 parsing
XR$*<$*>$*		$1$2$3			in case recursive
XR$*%$*.$*.UUCP@$B	$1@$2.$3		u%s.d.uucp@relay->u@s.d
XR$*%$*.$*@$B		$1@$2.$3		u%s.d@relay->u@s.d
X# Make sure <@a,@b,@c:u@d> syntax is easy to parse -- undone later.
XR@$+,$+			@$1:$2			change all "," to ":"
X# Localize and dispose of domain-based addresses.
XR@$+:$+			$@$>6<@$1>:$2		handle <route-addr>
XR$+:$*;@$+		$@$1:$2;@$3		list syntax
XR$+@$+			$:$1<@$2>		focus on domain
XR$+<$+@$+>		$1$2<@$3>		move gaze right
XR$+<@$+>		$@$>6$1<@$2>		already canonical
XR$+<@$+>		$@$>6$1<@$2>		Call the nameserver
X# Convert old-style addresses to a domain-based address.
XR$+%$+			$@$>6$1<@$2>		u%h
XR$-!$+			$@$>6$2<@$1.UUCP>	resolve uucp names
X
X
X##
X##  RULESET  4 -- Final output rewriting.
XS4
XR@			$@			handle <> error addr
X# Externalize local domain info.
XR$*<$*LOCAL>$*		$1<$2$D>$3		change local info
XR$*<$+>$*		$1$2$3			defocus
XR@$+:$+:$+		@$1,$2:$3		<route-addr> canonical
XR$+@$-.UUCP		$2!$1			u@h.UUCP->h!u
XR$+%$=N@$=N		$1@$3			u%h@h->u@h
X
X
X##
X##  RULESET  5 -- From: field post-processing (just before final).
XS5
X
X
X##
X##  RULESET  6 -- Canonicalize hostname (called from ruleset 3).
XS6
XR$+<@$+.$+.UUCP>	$1<@$2.$3>		u@aaa.bbb.uucp->u@aaa.bbb
XR$*<@$+.$=I>		$:$1<@$[$2.$3$]>	u@f.q.d.n
XR$*<@$->		$:$1<@$[$2$]>		u@something
X
X
X##
X##  RULESET 10 -- From and To: fields for prog and local mailers.
XS10
XR@			$n			errors to mailer-daemon
X
X
X##
X##  RULESET 11 -- From field for tcploc mailer.
XS11
XR<@$+>$*		$@<@$1>$2		resolve <route-addr>
XR$*:$*			$1.$2			map colons to dots
XR$+<@$-.ARPA>		$@$1<@$2.ARPA>		u@h.ARPA
XR$+<@$=N.LOCAL>		$@$1<@$A>		local name to domain form
XR$+<@LOCAL>		$@$1<@$A>		local name to domain form
XR$+<@$+.LOCAL>		$@$1<@$A>		local name to domain form
XR$+<@$+>		$@$1<@$2>		already ok
XR$+<@[$+]>		$@$1<@[$2]>		already ok
XR$+			$@$1<@$A>		u@thishost
X
X
X##
X##  RULESET 12 -- From field for tcprem mailer.
XS12
XR<@$+>$*		$@<@$1>$2		resolve <route-addr>
XR$*:$*			$1.$2			map colons to dots
XR$+<@$-.ARPA>		$@$1<@$2.ARPA>		u@h.ARPA
XR$+<@$=N.LOCAL>		$@$1<@$B>		local name to domain form
XR$+<@LOCAL>		$@$1<@$B>		local name to domain form
XR$+<@$+.LOCAL>		$@$1<@$B>		local name to domain form
XR$+<@$+>		$@$1<@$2>		already ok
XR$+<@[$+]>		$@$1<@[$2]>		already ok
XR$+			$@$1<@$B>		u->u@relay
X
X
X##
X##  RULESET 13 -- To: field for tcploc and tcprem mailers.
XS13
XR<@$+>$*		$@<@$1>$2		resolve <route-addr>
XR$*:$*			$1.$2			map colons to dots
XR$+<@$-.ARPA>		$@$1<@$2.ARPA>		u@h.ARPA
XR$+<@$=N>		$@$1<@$A>		local name to domain form
XR$+<@$=N.$C>		$@$1<@$A>		local name to domain form
XR$+<@LOCAL>		$@$1<@$A>		local name to domain form
XR$+<@$+.LOCAL>		$@$1<@$A>		local name to domain form
XR$+<@$+>		$@$1<@$2>		already ok
XR$+<@[$+]>		$@$1<@[$2]>		already ok
XR$+			$@$1<@$A>		u->u@thishost
X
X
X##
X##  MAILER SPECIFICATIONS
X##
X
X##  local; delivery to a local user.
XMlocal,  P=/bin/mail, F=DFlMmnrSs,  S=10, R=10, A=mail -d $u
X
X##  prog; delivery into a program.
XMprog,   P=/bin/sh,   F=DeFlMs,    S=10, R=10, A=sh -c $u
X
X##  tcploc; connect to SMTP mailer within our organization.
XMtcploc, P=[IPC],     F=DFLMmsuX,  S=11, R=13, A=IPC $h, E=\r\n
X
X##  tcprem; connect to SMTP mailer outside of our organization.
XMtcprem, P=[IPC],     F=DeFLMmsuX, S=12, R=13, A=IPC $h, E=\r\n
END_OF_FILE
# end of 'sm.master.cf'
fi
if test -f 'sm.slave.cf' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sm.slave.cf'\"
else
echo shar: Extracting \"'sm.slave.cf'\" \(5090 characters\)
sed "s/^X//" >'sm.slave.cf' <<'END_OF_FILE'
X###
X###  SENDMAIL CONFIGURATION FILE
X###  This is the sendmail.cf for a client who can make a TCP connection to
X###  a mail relay.  No local mail happens here.  Sendmail is not run in
X###  daemon mode, either, just hourly out of cron to pick up anything
X###  left when the server is not reachable.
X###
X
X##
X##  HOSTNAME MACROS AND CLASSES
X
X##  The name of our corporate domain.
XDCbbn.com
X
X##  The official name of this host (from gethostname(2)).
XDj$w
X
X##  Remove these hosts from the address, treating them as local.  It's only
X##  necessary for a diskless Sun running MMDF that is within our project,
X##  if that.
XCNpebbles
XCNfred
XCNwilma
XCNvax
X
X##  The relay host where everything gets forwarded to.
XDRpineapple.bbn.com
X
X##
X##  GENERAL CONFIGURATION INFORMATION
X##  Stuff here is required and reflects some policy decisions.
X
X# SMTP login message.
XDe$j Sendmail $v/$V ready at $b; how did you get here?
X##  Format of the UNIX from line -- essentially a constant.
XDlFrom $g $d
X##  Name to use for returned mail -- essentially a constant.
XDnMAILER-DAEMON
X##  Token delimeters -- word separators in the rewrite rules below.
XDo.:%@![]
X##  Format of a sender's address; use full name.
XDq$x <$g>
X##  Version of this .cf file.
XDVrsalz-13-nov-89
X
X##  Location of the alias file.
XOA/usr/lib/aliases
X##  Default delivery mode (one of background, foreground, queue).
XOdbackground
X##  Permissions for any temporary files we create.
XOF0644
X##  Default group id for mailers to run under.
XOg1
X##  Location of the SMTP help file.
XOH/dev/null
X##  Logging level.
XOL9
X##  Send to sender if an alias expansion includes her (a/k/a "me too")?
XOmT
X##  Allow headers to be in old style (i.e., spaces delimit names)?
XOoT
X##  Where to send important error messages.
XOPpostmaster
X##  Location of the queue directory.
XOQ/usr/spool/mqueue
X##  Give up on connections after this long a time period.
XOr2h
X##  Queue up everything before starting transmission?
XOsT
X##  How long message can sit in queue before it's bounced back?
XOT3d
X##  Default user id for mailers to run under.
XOu1
X##  Password to enter wizard/debug mode.
XOW*
X
X##  Message precedences.
XPfirst-class=0
XPspecial-delivery=100
XPbulk=-50
XPjunk=-100
X
X##  Trusted users -- these people can fake headers.
XTroot
X
X##  Format of headers.  All our mailers want these lines -- who wouldn't?
XHReceived: $?sfrom $s $.by $j id <$i@$j>; $b
XHDate: $a
XHFrom: $q
XHMessage-Id: <$t.$i@$j>
XHResent-Date: $a
XHResent-From: $q
XHResent-Message-Id: <$t.$i@$j>
X
X##
X##  REWRITING RULES
X##
X##  These are the rules used for the following fields:
X##	 From	3 -> 1 -> 4 -> 3 -> 1 -> S -> 4
X##	 To	3 -> 0 -> 4
X##	 From:	3 -> 1 -> 5 -> 4
X##	 To:	3 -> 2 -> R -> 4
X##  where S and R stand for the mailer-specific rewrite rules named in
X##  the mailer definition.
X
X
X##
X##  RULESET  0 -- Pick a mailer.
XS0
XR$*<$*>$*		$1$2$3			defocus
XR$+			$:$>3$1			make canonical
XR$*<@[$+]>$*		$#tcprla$@[$2]$:$1@[$2]$3	numeric internet spec
XR$+<@$=N.$C>		$1			one of our hosts
XR$+<@$=N>		$1			one of our hosts
XR$*<$*.>$*		$1<$2>$3		drop trailing dot
XR<@>:$*			$@$>0$1			retry after route strip
XR$*<@>			$@$>0$1			strip null trash & retry
X## Machine dependent part of ruleset 0.
X## Here is where we actually find a mailer to invoke.
XR$*			$#tcprla$@$R$:$1	forward everything
X
X
X##
X##  RULESET  1 -- From and From: fields.
XS1
X
X
X##
X##  RULESET  2 -- To: field.
XS2
X
X
X##
X##  RULESET  3 -- Basic name canonicalization.
XS3
X# Handle the SMTP "from:<>" as a special case.
XR<>			$@@			turn into magic token
X# Basic textual canonicalization.
XR$*<$+>$*		$2			basic RFC821/822 parsing
XR$*<$*>$*		$1$2$3			in case recursive
X# Make sure <@a,@b,@c:u@d> syntax is easy to parse -- undone later.
XR@$+,$+			@$1:$2			change all "," to ":"
X# Localize and dispose of domain-based addresses.
XR@$+:$+			$@$>6<@$1>:$2		handle <route-addr>
XR$+:$*;@$+		$@$1:$2;@$3		list syntax
XR$+@$+			$:$1<@$2>		focus on domain
XR$+<$+@$+>		$1$2<@$3>		move gaze right
XR$+<@$+>		$@$>6$1<@$2>		already canonical
X# Convert old-style addresses to a domain-based address.
XR$+%$+			$@$>6$1<@$2>		u%h
XR$-!$+			$@$>6$2<@$1.UUCP>	resolve uucp names
X
X
X##
X##  RULESET  4 -- Final output rewriting.
XS4
XR@			$@			handle <> error addr
X# Externalize local domain info.
XR$*<$*LOCAL>$*		$1<$2$R>$3		change local info
XR$*<$+>$*		$1$2$3			defocus
XR@$+:$+:$+		$@@$1,$2:$3		<route-addr> canonical
XR$+<@$w>		$1			remove our name
XR$+<@$=N.$C>		$1			remove server.domain's name
XR$+<@$=N>		$1			remove server's name
XR$+@$-.UUCP		$2!$1			u@h.UUCP->h!u
X
X
X##
X##  RULESET  5 -- From: field post-processing (just before final).
XS5
X
X
X##
X##  RULESET  6 -- Canonicalize hostname (called from ruleset 3).
XS6
XR$*<@$=N>		$:$1			u@one_of_our_hosts
XR$+<@$+.$+.UUCP>	$1<@$2.$3>		u@h.d.uucp->u@h.d
X
X
X##
X##  RULESET 14 -- All fields for all mailers
XS14
X
X
X##
X##  MAILER SPECIFICATIONS
X##
X
X##  local; an error as we do no mail delivery here
XMlocal, P=/usr/lib/sendmail, F=DFILMmsuX, S=14, R=14, A=sendmail $n
X
X##  prog; an error as we do no mail delivery here
XMprog,  P=/usr/lib/sendmail, F=DFILMmsuX, S=14, R=14, A=sendmail $n
X
X##  tcprla; connect to Sendmail on relay host.
XMtcprla, P=[IPC], F=DFILMmsuX, S=14, R=14, A=IPC $h, E=\r\n
END_OF_FILE
# end of 'sm.slave.cf'
fi
echo shar: End of shell archive.
exit 0
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.