[net.mail] UUCP-based sendmail.cf does automatic routing for two hops.

robert@fear.UUCP (Robert Plamondon) (07/02/85)

This is a copy of the sendmail.cf file at WEITEK Corporation's main mail
machine, 'weitek.'  It's derived from Berkeley configuration file, but has a
number of differences which can be useful to uucp-only sites:

1.	It ignores domain names (except for ARPA names for distant sites).
	Our users don't understand domain names or addressing other than
	uucp-style "site1!site2!user." Since all our outside connections
	are via uucp, and all our internal connections are in the same
	domain, this works quite well.

2.	It converts everything (except for ARPA names for distant sites)
	to old-style uucp routing.  This is consistant #1, and is also
	necessary to get mail through some of our neighbors, which choke
	on non-uucp addresses. We can ACCEPT practically any style of
	addressing, but we SEND uucp 'bang' addresses.

3.	It does routing to all adjacent sites, and to sites *TWO* hops
	away.

4.	Any site that isn't the local machine, an adjacent machine, or one
	in the two-hop routing list is sent to the mailhost, which can
	itself be two hops away.

This particular implementation uses uucp and ethernet mailers, though
changing to another mailer is pretty trivial.

To make this work for your site, you have to change the sitenames for the
local, adjacent, and two-hop sites, and the mailhost.  If your mailers are
something other than uucp and ethernet, you can simply replace the "#uucp"
or "#ether" strings at the end of Ruleset 0 to whatever the name of your
mailer it.

While ARPANET addresses are in theory forwarded to the mailhost, I haven't
tested it (and I doubt that our neighbors will forward them correctly
anyway).

A lot of Berkeley-specific stuff was left in because it looked harmless.

Comments and criticism are welcome.

	-- Robert

############################################################
############################################################
#####
#####		SENDMAIL CONFIGURATION FILE
#####			WEITEK Corporation
#####			 site "weitek"
#####
#####		Derived from:
#####		@(#)cad.mc	4.2		8/21/83
#####
############################################################
############################################################

# sendmail for weitek, by Robert Plamondon, 6/20/85
# modified from cad.mc
#
# This file routes to up to four sites adjacent to weitek, and all
# sites connected to these four.
#
# It uses a mailhost ($R) two hops away -- nsc.
#
# Since this is a uucp-only site, most of the modifications have to do 
# with keeping addresses in uucp form.
#
# ARPA addresses are preserved except in weitek and its four satellites,
# (which are known to be non-ARPA sites), so that the ARPANET can be reached
# if the intervening sites don't screw up the addresses
#
# weitek!robert 6/20/85

############################################################
###	local info
############################################################

# internet hostname
Cwweitek

# UUCP name (and three aliases to cover misspellings)
DUweitek
CUweitek wietek wietech weitech

# UUCP hosts that we talk to
CZ turtlevax resonex cae780

#####
# The following uucp sites should be listed in order of frequency of
# connection. DW=most frequently called, DX=middling, DY=least frequently
# called.  The rewriting rules look for paths to distant sites in the
# order W,X,Y, so the best connection should be on W.
###

# One of our uucp connections, and the sites that it talks to.
DWcae780
CWamdcad excelan idi leadsv nsc sunncal ubvax amd hplabs qubix teklds

# another UUCP host
DXturtlevax
CXnsc hplabs amd spar ames megatest mordor sci atd dual sri-tsc seismo

# yet another UUCP host
DYresonex
CYallegra amd amdcad cygnet dual hplabs idi nsc pyrcorp sun

# Note: removed ihnp4 from the list 7/1/85 to force traffic to ihnp4
# to go through our mailhost (nsc), which is a more efficient path.

# Forwarding host -- just like the uucp hosts above, but in our case we
#  use ethernet.
DFfear
CFnoonday setting


#################################################
#
#	General configuration information
#
#	@(#)csbase.m4	4.3		8/21/83
#
#################################################

######################
#   General Macros   #
######################

# our arpanet gateway
DAucbvax
CAucbvax

# local domain names
DDUUCP
CDsun

# major relay host
DRnsc
CRnsc

# host between us and major relay
DQcae780

# my official hostname
Dj$w.UUCP

# known SMTP/ethernet hosts (this domain only)
# includes misspellings.  The hosts in this list need to be able to recognize
# misspellings of their own names.

CSweitek wietek
CSmidnite midnight
CSfear

# known top-level domains
CTLOCAL ARPA UUCP

############################################################
#
#	General configuration information
#
#	This information is basically just "boiler-plate"; it must be
#	there, but is essentially constant.
#
#	Information in this file should be independent of location --
#	i.e., although there are some policy decisions made, they are
#	not specific to Berkeley per se.
#
#		@(#)base.m4	4.3		8/30/83
#
############################################################

#	@(#)version.m4	4.7		8/31/83

DV4.7


##########################
###   Special macros   ###
##########################

# my name
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   ###
###################

# location of alias file
OA/usr/lib/aliases
# default delivery mode (deliver in background)
Odbackground
# (don't) connect to "expensive" mailers
#Oc
# temporary file mode
OF0644
# default GID
Og1
# location of help file
OH/usr/lib/sendmail.hf
# log level
OL9
# default messages to old style
Oo
# queue directory
OQ/usr/spool/mqueue
# read timeout -- violates protocols
Or2h
# status file
OS/usr/lib/sendmail.st
# queue up everything before starting transmission
Os
# default timeout interval
OT3d
# time zone names (V6 only)
OtPST,PDT
# default UID
Ou1
# wizard's password
OWa/FjIfuGKXyc2

###############################
###   Message precedences   ###
###############################

Pfirst-class=0
Pspecial-delivery=100
Pjunk=-100

#########################
###   Trusted users   ###
#########################

Troot
Tdaemon
Tuucp
Tnetwork

#############################
###   Format of headers   ###
#############################

H?P?Return-Path: <$g>
HReceived: $?sfrom $s $.by $j ($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:
# HPosted-Date: $a
# H?l?Received-Date: $b
H?M?Resent-Message-Id: <$t.$i@$j>
H?M?Message-Id: <$t.$i@$j>

###########################
###   Rewriting rules   ###
###########################


################################
#  Sender Field Pre-rewriting  #
################################
S1
#R$*<$*>$*		$1$2$3				defocus

###################################
#  Recipient Field Pre-rewriting  #
###################################
S2
#R$*<$*>$*		$1$2$3				defocus

#################################
#  Final Output Post-rewriting  #
#################################
S4

R@			$@				handle <> error addr

# externalize local domain info
R$*<$*LOCAL>$*		$1<$2$D>$3			change local info
R$*<$+>$*		$1$2$3				defocus
R@$+:$+:$+		$@@$1,$2:$3			<route-addr> canonical

# UUCP must always be presented in old form
R$+@$-.UUCP		$2!$1				u@h.UUCP => h!u

# delete duplicate local names -- mostly for arpaproto.mc
R$+%$=w@$=w		$1@$3				u%UCB@UCB => u@UCB
R$+%$=w@$=w.ARPA	$1@$3.ARPA			u%UCB@UCB => u@UCB

###########################
#  Name Canonicalization  #
###########################
S3

# handle "from:<>" special case
R<>			$@@				turn into magic token

# basic textual canonicalization
R$*<$+>$*		$2				basic RFC821/822 parsing
R$+ at $+		$1@$2				"at" -> "@" for RFC 822
R$*<$*>$*		$1$2$3				in case recursive

# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
R@$+,$+			@$1:$2				change all "," to ":"

# localize and dispose of domain-based addresses
R@$+:$+			$@$>6<@$1>:$2			handle <route-addr>

# more miscellaneous cleanup
R$+			$:$>8$1				host dependent cleanup
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 addresses to a domain-based address
R$+%$+			$@$>6$1<@$2>			user%host
R$-:$+			$@$>6$2<@$1>			host:user
R$-.$+			$@$>6$2<@$1>			host.user
R$+^$+			$1!$2				convert ^ to !
R$-!$+			$@$>6$2<@$1.UUCP>		resolve uucp names
R$-=$+			$@$>6$2<@$1.BITNET>		resolve bitnet names


#######################
#   Rewriting rules   #
#######################

##### special local conversions
S6
R$*<@$*$=D>$*		$1<@$2LOCAL>$4			convert local domain
R$*<@$*$=D.ARPA>$*	$1<@$2LOCAL>$4
R$+%$+<@LOCAL>		$1<@$2.LOCAL>			hack for % syntax
R$*<@$+.$=T.$=T>$*	$1<@$2.$3>$5			make UUCP top level
R$*<@$+.$=T.$=T>$*	$1<@$2.$3>$5			make UUCP top level
R$*<@$*$=C.$=T>$*	$1<@$2$3>$5			adjust CC hosts (ucbvax)
R$*<@$*$=C>$*		$1<@$2$3.CC>$4			adjust CC hosts (ucbvax)

# fix uucp routing that was munged by the 'focus on domain' line in S3
# rdp 6/20/85
R$-!$*<@$->		$2@$3<@$1.UUCP>
R$-!$*<@$-.ARPA>	$2@$3.ARPA<@$1.UUCP>

############################################################
############################################################
#####
#####		Local and Program Mailer specification
#####
#####		@(#)localm.m4	4.1		7/25/83
#####
############################################################
############################################################

Mlocal,	P=/bin/mail, F=rlsDFMmn, S=10, R=20, A=mail -d $u
Mprog,	P=/bin/sh,   F=lsDFMe,   S=10, R=20, A=sh -c $u

S10
R@			MAILER-DAEMON		errors to mailer-daemon

############################################################
############################################################
#####
#####		Ethernet Mailer specification
#####
#####		@(#)etherm.m4	4.1		7/25/83
#####
############################################################
############################################################

Mether,	P=[IPC], F=msDFMuCX, S=11, R=21, A=IPC $h

S11
R$*<@$+>$*		$@$1<@$2>$3			already ok
R$+			$@$1<@$w.$D>			tack on our hostname

S21
R$+			$:$>5$1		make into a uucp-format address


############################################################
############################################################
#####
#####		RULESET ZERO PREAMBLE
#####
#####	The beginning of ruleset zero is constant through all
#####	configurations.
#####
#####		@(#)zerobase.m4	4.1		7/25/83
#####
############################################################
############################################################

S0

# first make canonical
R$*<$*>$*		$1$2$3				defocus
R$+			$:$>3$1				make canonical

# handle special cases.....
R@			$#local$:MAILER-DAEMON		handle <> form
R$*<@[$+]>$*		$#tcp$@[$2]$:$1@[$2]$3		numeric internet spec

# arrange for local names to be fully qualified
R$*<$*$=S>$*		$1<$2$3.LOCAL>$4		user@etherhost
R$*<$*$=Z>$*		$1<$2$3.LOCAL>$4		user@berkhost
R$*<$+.ARPA.LOCAL>$*	$1<$2.ARPA>$3			because ARPA is a host

# now delete the local info
R$*<$*$=w.LOCAL>$*	$1<$2>$4			thishost.LOCAL
R$*<$*$=w.ARPA>$*	$1<$2>$4			thishost.ARPA
R$*<$*$=w.UUCP>$*	$1<$2>$4			thishost.UUCP
R$*<$*$=w>$*		$1<$2>$4			thishost
R$*<$*.>$*		$1<$2>$3			drop trailing dot
R<@>:$*			$@$>0$1				retry after route strip
R$*<@>			$@$>0$1				strip null trash & retry

# forward around hosts with communication problems
#R$*<@$=F.LOCAL>$*	$#ether$@$F$:$1<@$2.LOCAL>$3	reroute message

# route mail for hosts listed in "CF" lines to $F host
R$*<@$=F$*>$*		$#uucp$@$F$:$1<@$2.$D>$4	reroute message

##################################
#  End of ruleset zero preamble  #
##################################


################################################
###  Machine dependent part of ruleset zero  ###
################################################

# resolve names that can go via the ethernet
R$*<@$*$=S.LOCAL>$*	$#ether$@$3$:$1<@$2$3.$D>$4	user@etherhost
R$*<@$*$=S.$*>$*	$#ether$@$3$:$1<@$2$3.$D>$5	user@etherhost
R$*<@$*$=S>$*		$#ether$@$3$:$1<@$2$3.$D>$4	user@etherhost

# resolve names that we can handle locally
#R<@$=W.UUCP>$+		$#uucp$@$1$:$2.UUCP		@host.UUCP: ...
#R$+<@$=W.UUCP>		$#uucp$@$2$:$1.UUCP		user@host.UUCP

#these rules take advantage of the fact that all our neighbors are
# uucp-only -- R.P.

# Send to neighbors who are one hop away.
R<@$=Z$*>$*		$#uucp$@$1$:$3			@host.whatever:user
R$+<@$=Z$*>$*		$#uucp$@$2$:$1			user@host.whatever

# do routing for sites two hops away
# (this can probably be made much smaller, but I don't want to mess with it)
R$+<@$=W.UUCP>$*	$#uucp$@$W$:$2!$1		user@host.UUCP
R$+<@$=W.$*>		$#uucp$@$W$:$1<@$2>$3		user@host.whatever
R<@$=W.UUCP>$+		$#uucp$@$W$:$2<@$1>		@host.UUCP: ...
R<@$=W.$*>$*		$#uucp$@$W$:$2<@$1>$3		@host.whatever: ...
R<@$=W>$+		$#uucp$@$W$:$1!$2		@host: ...
R$+<@$=W>		$#uucp$@$W$:$2!$1		user@host

R$+<@$=X.UUCP>$*	$#uucp$@$X$:$2!$1		user@host.UUCP
R$+<@$=X.$*>		$#uucp$@$X$:$1<@$2>$3		user@host.whatever
R<@$=X.UUCP>$+		$#uucp$@$X$:$2<@$1>		@host.UUCP: ...
R<@$=X.$*>$*		$#uucp$@$X$:$2<@$1>$3		@host.whatever: ...
R<@$=X>$+		$#uucp$@$X$:$1!$2		@host: ...
R$+<@$=X>		$#uucp$@$X$:$2!$1		user@host

R$+<@$=Y.UUCP>$*	$#uucp$@$Y$:$2!$1		user@host.UUCP
R$+<@$=Y.$*>		$#uucp$@$Y$:$1<@$2>$3		user@host.whatever
R<@$=Y.UUCP>$+		$#uucp$@$Y$:$2<@$1>		@host.UUCP: ...
R<@$=Y.$*>$*		$#uucp$@$Y$:$2<@$1>$3		@host.whatever: ...
R<@$=Y>$+		$#uucp$@$Y$:$1!$2		@host: ...
R$+<@$=Y>		$#uucp$@$Y$:$2!$1		user@host

# other non-local names will be kicked upstairs
#R$*<@$+>$*		$#ether$@$R$:$1<@$2>$3		user@some.where

# Use this line to forward to mailhost one hop away.
#R$*<@$+>$*		$#uucp$@$R$:$1<@$2>$3		user@some.where

# these lines forward to a mailhost two hops away (over uucp)
R$*<@$+.UUCP>$*		$#uucp$@$Q$:$R!$2!$1	user@some.where
R$*<@$->		$#uucp$@$Q$:$R!$2!$1	user@some.where
R$*<@$+>$*		$#uucp$@$Q$:$R!$1@$2$3	user@some.where

# remaining names must be local
R$+			$#local$:$1			everything else

############################################################
############################################################
#####
#####		UUCP Mailer specification
#####
#####		@(#)uucpm.m4	4.2		8/30/83
#####
############################################################
############################################################

Muucp,	P=/usr/bin/uux, F=sDFMhuU, S=13, R=23, M=100000,
	A=uux - -r $h!rmail ($u)

# Take the "-r" out of the uux line if you want to initiate calls
# immediately, rather than waiting for cron to run the queue.  It should
# be easy enough to have two mailers for uucp, one which did local
# calls without queuing, and another that did expensive calls with
# queuing. The "fast" mailer would have to be called something other
# than uucp, the "-r" flag would be left out, and the Ruleset Zero
# resolution would call the fast mailer on one or more sets of sites:
# $W, $X, $Y, $T, $F, etc.

#####################################################
#  General code to convert back to old style names  #
#####################################################
S5

# Changed to force to uucp host!user format wherever possible -- R.P. 6/85

#R$+<@$-.LOCAL>		$2:$1				u@h.LOCAL => h:u
R$+<@$-.LOCAL>		$2!$1				u@h.LOCAL => h:u
#R$+<@$-.CC>		$2:$1				u@h.CC => h:u
#R$+<@$=Z>		$@$2:$1				u@bhost => h:u
R$+<@$=Z>		$2!$1				u@bhost => h:u
#R$+<@$=C>		$@$2:$1				u@cchost => h:u
R$+<@$=C>		$2!$1				u@cchost => h:u
R$+<@$-.UUCP>		$2!$1				u@host.UUCP => host!u
#R$+@$+.ARPA		$1@$2			u@host.ARPA => u@host
# may want to change next line back later
R$+@$+.ARPA		$2!$1			u@host.ARPA => u@host

#try to catch misc. stuff here
R$+<@$-$*>		$2!$1			u@host.whatever => host!u


S13
R$+			$:$>5$1			convert to old style
R$=w!$+			$2			strip local name

#R$*<@$=S>$*		$1<@$2.Berkeley.ARPA>$3	resolve abbreviations
#R$*<@$=Z>$*		$1<@$2.$D>$3		resolve abbreviations
#R$*<@$->$*		$1<@$2.ARPA>$3		resolve abbreviations
R$+			$:$U!$1			stick on our host name
R$=w!$=R:$+		$:$1!$3			ucbvax!ucbvax:xxx

S23
R$+			$:$>5$1			convert to old style
#R$*<@$=S>$*		$1<@$2.Berkeley.ARPA>$3	resolve abbreviations
#R$*<@$=Z>$*		$1<@$2.$D>$3		resolve abbreviations
#R$*<@$->$*		$1<@$2.ARPA>$3		resolve abbreviations

-- 
		-- Robert Plamondon
		   {turtlevax, resonex, cae780}!weitek!robert