UK-1.1 Sendmail Configuration Package. Part 3 of 3

sources-request at genrad.UUCP sources-request at genrad.UUCP
Wed May 15 22:17:26 AEST 1985


I've had a number of requests for this, since I announced it in net.mail

So, I'm sending it in 3 shar archives to mod.sources.  One warning:
Some of the shell scripts I use are BSD specific.  (E.g. I use "cat -n"
and "fmt" in places.)  I assumed that most people who have sendmail
are running 4.xBSD.

    Jim Crammond
    jim at hwcs.uucp
    uck!hwcs!jim
    jim at cs.hw.ac.uk    (soon)

------------- cut here --------------
#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar:	Shell Archiver
#	Run the following text with /bin/sh to create:
#	chn
# This archive created: Fri May 10 14:42:50 1985
echo shar: creating directory chn
mkdir chn
chdir chn
echo shar: extracting MAKE '(6663 characters)'
cat << \SHAR_EOF > MAKE
#!/bin/sh
#
#  shell script to generate a sendmail <host>.chn file containing all
#  the routing information for this host from a set of per-mailer channel
#  files containing in this directory.
#

if [ $# -le 1 ]
then	echo	usage: make host files...
	exit
fi

host=$1
shift
rm -f $host.chn

echo -n > chn.classes
echo -n > S9

#
# sort out which files refer to which mailers
#
rm -f $$.ether $$.luucp $$.uucp $$.janet $$.bitnet $$.top

for i in $*
do
	case $i in
	*ether.chn)	cat $i >> $$.ether
			;;
	*luucp.chn)	cat $i >> $$.luucp
			;;
	*uucp.chn)	cat $i >> $$.uucp
			;;
	*janet.chn)	cat $i >> $$.janet
			;;
	*bitnet.chn)	cat $i >> $$.bitnet
			;;
	*top.chn)	cat $i >> $$.top
			;;
	esac
done

#
#  Standard format channel tables
#
for chnf in $$.ether $$.luucp
do
	if [ -f $chnf ]
	then
		awk '
BEGIN	{
	mailer=substr(FILENAME, index(FILENAME,".")+1)
	MINCLSIZE = 3
	if (mailer == "ether")
	{	print "# Ethernet"	>>"S9"
		classes = "PQR"
	}
	else if (mailer == "luucp")
	{	print "# Local UUCP"	>>"S9"
		classes = "LMN"
	}
	c = 1
	}

/^#/	{	break	}

/^\*/	{
	$1 = substr($1, 2)
	$2 = sprintf($2, "$2")
	printf "R$+@$+%s\t\t$@<$1>%s.%s\n", $1, $2, mailer	>>"S9"
	break
	}

	{
	i = index($1, ".")
	subdom = substr($1,1,i-1)
	restdom = substr($1,i+1)
	
	if (subdom == $2)
		direct[restdom] = direct[restdom] " " subdom
	else
		printf "R$+@%s\t\t$@<$1@%s>%s.%s\n", $1, $1, $2, mailer	>>"S9"
	}

END	{
	for (i in direct)
	{	n = split(direct[i], sub, " ")
		if (n >= MINCLSIZE && c <= length(classes))
		{	C = substr(classes, c, 1)
			c++
			printf "C%s%s\n", C , direct[i]	>>"chn.classes"
			printf "R$+@$=%s.%s\t\t$@<$1>$2.%s\n",C,i,mailer >>"S9"
		}
		else
		{	for (j=1; j<=n; j++)
				printf "R$+@%s.%s\t\t$@<$1>%s.%s\n", \
					sub[j], i, sub[j], mailer	>>"S9"
		}
	}
	print ""	>>"chn.classes"
	print ""	>>"S9"
	}
' $chnf

	fi
done

#
#  The Bitnet channel (bitnet links)
#
if [ -f $$.bitnet ]
then
	awk '
BEGIN	{
	print "# Bitnet sites"
	print "R$+@$+.bitnet		$@<$1>$2.bitnet"
	}

/^#/	{  break  }

	{  printf "R$+@%s\t\t$:<$1>%s.bitnet\n", $1, $2  }

END	{
	print ""
	}
' $$.bitnet >>S9

fi

#
#   The UUCP channel
#
if [ -f $$.uucp ]
then
	sed -e '/^#/d' -e '/^$/d' $$.uucp | (sort +1; echo 'x.y z!x!%s') |
	awk '
BEGIN	{
	MINCLSIZE = 3
	classes = "UVWXYZ"
	c = 1
	m = 0
	print "# UUCP sites"						>>"S9"
	print "# convert to uucp addresses and try to find a match"	>>"S9"
	print "R$+@$+			$:$>13$1@$2"			>>"S9"
	print ""							>>"S9"
	}

	{
	i = index($1, ".")
	subdom = substr($1,1,i-1)
	restdom = substr($1,i+1)
	
	p = index($2, subdom)
	ps = subdom "!%s"

	if (p == 1 && $2 == ps)
		direct[restdom] = direct[restdom] " " subdom
	else if (p > 1 && substr($2, p) == ps)
	{	path = substr($2, 1, p-1)
		if (path != lastpath || restdom != lastrest)
		{	if (m >= MINCLSIZE && c <= length(classes))
			{	j = index(lastpath, "!")
				host = substr(lastpath,1,j-1)
				addr = substr(lastpath,j+1)

				rclass = ""
				for (j=1; j<=m; j++)
					rclass = rclass " " sub[j]

				C = substr(classes, c, 1)
				c++
				printf "C%s%s\n", C, rclass	>>"chn.classes"
				printf "R$=%s.%s!$+\t\t$@<%s$1!$2>%s.uucp\n", \
					C, lastrest, addr, host		>>"S9.2"
			}
			else
			{	for (i=1; i<=m; i++)
				{	j = index(lastpath, "!")
					host = substr(lastpath,1,j-1)
					addr = substr(lastpath,j+1) sub[i]
					printf "R%s.%s!$+\t\t$@<%s!$1>%s.uucp\n",\
					  sub[i], lastrest, addr, host	>>"S9.2"
				}
			}
			lastpath = path
			lastrest = restdom
			m = 0
		}
		sub[++m] = subdom
	}
	else
	{	i = index($2, "!")
		host = substr($2,1,i-1)
		addr = substr($2,i+1)
		addr = sprintf(addr,"$1")
		printf "R%s!$+\t\t$@<%s>%s.uucp\n", $1, addr, host	>>"S9.2"
	}
	}

END	{
	for (i in direct)
	{	n = split(direct[i],sub," ")
		if (n >= MINCLSIZE && c <= length(classes))
		{	C = substr(classes, c, 1)
			c++
			printf "C%s%s\n", C , direct[i]	>>"chn.classes"
			printf "R$=%s.%s!$+\t\t$@<$2>$1.uucp\n", C, i	>>"S9"
		}
		else
		{	for (j=1; j<=n; j++)
				printf "R%s.%s!$+\t\t$@<$1>%s.uucp\n", \
					sub[j], i, sub[j]		>>"S9"
		}
	}
	print ""	>>"chn.classes"
	print ""	>>"S9.2"
	print "# no match in uucp - change back to domain style"	>>"S9.2"
	print "R$+!$+			$:$>12$1!$2"			>>"S9.2"
	print ""	>>"S9.2"
	}
'
	cat S9.2 >> S9
	rm -f S9.2
fi

#
#   The Janet channel
#
if [ -f $$.janet ]
then
	awk '
BEGIN	{
	print "# Janet sites"						>>"S9"
	print "# convert domain order to NRS style"			>>"S9"
	print "R$+@$+			$:$>14$1@$2"			>>"S9"
	print ""							>>"S9"
	}

/^#/	{	break	}

	{
	if ( $1 == "uk.ac." $2 )	#  general rule will catch this
		break

	if ( $1 == "uk.co." $2 )	#  general rule will catch this
		break

	printf "R$+@%s\t\t$@<$1>%s.janet\n", $1, $2			>>"S9"
	}

END	{
	print ""	>>"chn.classes"
	print ""							>>"S9"
	print "# pass all other uk addresses to hhmail to route"	>>"S9"
	print "R$+ at uk.ac.$+\t\t$@<$1>$2.janet"				>>"S9"
	print "R$+ at uk.co.$+\t\t$@<$1>$2.janet"				>>"S9"
	print ""							>>"S9"
	print "# convert domain order back to 822 style"		>>"S9"
	print "R$+@$+			$:$>14$1@$2"			>>"S9"
	print ""							>>"S9"
	}
' $$.janet

fi

#
#   The Bitnet channel (arpa and uucp relaying)
#
if [ -f $$.bitnet ]
then
	cat >>S9 <<'EOF'
# arpa and uucp relays via Bitnet
R$+@$+.arpa		$@<$1@$2.arpa>smtpuser at wiscvm.barpa
R$+@$+.uucp		$@<$1@$2.uucp>uucp at psuvax1.buucp

EOF
fi

#
#   Top Level Domain relaying
#
awk '
BEGIN	{
	print "#"
	print "# top level domain - relaying sites"
	print "#"
	print "# This is a list of default relaying sites for"
	print "# addresses that dont match anything above."
	print "#"
	print ""
	}

/^#/	{  break  }

	{
	if (length($1) < 4)
		tabs = "\t\t\t"
	else
		tabs = "\t\t"
	printf "R$+.%s%s$:$1.%s@%s\n", $1, tabs, $1, $2
	}
' $$.top >> S9

#
#  The header
#
cat > $host.chn <<EOF
###############################################################################
###############################################################################
#####
#####	@(#)$host.chn	UK-1.1 sendmail configuration		22/4/85
#####
#####	The mailer selection and routing
#####
###############################################################################
###############################################################################

# classes
EOF

#
#  the classes
#
while read class group
do
	echo "$group" | fmt | sed "s/^/$class/"
done < chn.classes >> $host.chn

#
#  the rules
#
cat - S9 >> $host.chn <<'EOF'

############################
#  Ruleset 9  --  routing  #
############################

#
#  This rule takes a full domain address and returns a
#  "address at host.network" triple.
#

S9
EOF

cat >> $host.chn <<'EOF'

R$+@$+@$+		$1%$2@$3		address cleanup
R$+			$@$>9$1			retry

EOF

rm -f chn.classes S9 $$.*

echo $host.chn made
exit
SHAR_EOF
if test 6663 -ne "`wc -c MAKE`"
then
echo shar: error transmitting MAKE '(should have been 6663 characters)'
fi
echo shar: extracting README '(2671 characters)'
cat << \SHAR_EOF > README
General
-------
This directory contains per-mailer channel (routing) tables from which
the <host>.chn file can be generated.

In general, these files have a list of domain names on the LHS and
the "host to send to" on the RHS, e.g:

	usc.ac.uk		vax1

which specifies that addresses of the form "user at usc.ac.uk" should
be send to the host "vax1"

However, the actual format of the channel tables depends on the mailer,
(see below) and is determined by the file name.

For example, any file whose name ends with "janet.chn" is assumed to be
a janet mailer channel table.


Channel Table Formats
---------------------
ether.chn  and  luucp.chn:
	These have the format described above; a domain name on the LHS
	and a hostname to send/relay to on the RHS.

uucp.chn:
	This has a slightly different RHS syntax which the same as that
	produced by pathalias(1), e.g.:

		usc.ac.uk		vax2!vax1!%s

	where %s is the user part of the address (converted to uucp form).

janet.chn:
	The LHS domain name is in big-endian form in this table.
	The RHS is a "hostname" to send to.
	If a janet channel table is specified, then by default
	all uk.ac.<name> domains are assumed to be routed to <name>.

bitnet.chn:
	This has the same format as the ether and luucp channel tables.
	If a bitnet channel table is specified, then by default all
	<name>.bitnet domains are routed to <name> (actual routing is done
	by the bitnet mailer).

top.chn:
	This has a domain name on the RHS, for example.:

		ac.uk			ukc.ac.uk

	which states that any address that ends in "ac.uk", which did not
	match a domain name in one of the mailer channel tables, is sent to
	ukc.ac.uk.


Examples
--------
The archive Examples.a contains sample mailer channel files.


How to make the <host>.chn file
-------------------------------
1. Create a mailer channel file for each mailer you have.
   This is best done by extracting sample channel files from Examples.a
   and editing them to contain the relevent data for this host.

2. Run "MAKE host file1 file2... " to create the <host>.chn file. 
   	e.g.   MAKE hwcs luucp.chn ukuucp.chn

   This shell script does a lot of work so be prepared to wait!


Supported Mailers
-----------------
MAKE looks for tables for the following mailers:

	ether.chn	(ethernet)
	luucp.chn	(local uucp)
	uucp.chn	(uucp)
	janet.chn	(janet)
	bitnet.chn	(bitnet)
	top.chn		(top level relaying)

If you have other mailers not listed here, then you will need to add
some code the the MAKE shell script. Good Luck!


Note
----
Make sure that the domains on the RHS of the relaying rules (in top.chn)
eventually match some domain on the LHS of a rule in one of the mailer
channel tables.
SHAR_EOF
if test 2671 -ne "`wc -c README`"
then
echo shar: error transmitting README '(should have been 2671 characters)'
fi
echo shar: extracting Examples.a '(8558 characters)'
cat << \SHAR_EOF > Examples.a
!<arch>
ether.chn       483094477   217   10    100644  170       `
#
# Ethernet channel table
#  The domain name on the LHS is routed to the host on the RHS.
#	
bina.wisdom.bitnet	bina
haskel.wisdom.bitnet	haskel
deya.wisdom.bitnet	deya
luucp.chn       483094477   217   10    100644  170       `
#
# Local UUCP channel table
#  The domain name on the LHS is routed to the host on the RHS.
#	
ra.hwcs.uucp		ra
jove.hwcs.uucp		ra
odin.hwcs.uucp		ra
zeus.hwcs.uucp		ra
uucp.chn        483094477   217   10    100644  1043      `
# UUCP Channel Table
#  The domain name on the LHS is mapped to a path on the RHS.
#  If "%s" is included in the RHS then the user part goes here
#  e.g. jim at hwcs.ac.uk ->  hwcs!%s  -> hwcs!jim
#
cstvax.ed.ac.uk		cstvax!%s
cs.ucl.ac.uk		cstvax!ucl-cs!%s
glasgow.uucp		cstvax!glasgow!%s
paisley.uucp		cstvax!glasgow!paisley!%s
csbstand.uucp		cstvax!glasgow!csbstand!%s
glpsycho.uucp		cstvax!glasgow!glpsycho!%s
glhocus.uucp		cstvax!glasgow!glhocus!%s
dice.uucp		dice!%s
edcaad.uucp		edcaad!%s
gilles.uucp		edcaad!gilles!%s
kcl-cs.uucp		kcl-cs!%s
west44.uucp		kcl-cs!%s
ukc.ac.uk		kcl-cs!ukc!%s
westf.uucp		kcl-cs!westf!%s
mpgraph.uucp		kcl-cs!mpgraph!%s
camjenny.uucp		kcl-cs!camjenny!%s
root44.uucp		kcl-cs!root44!%s
rootis.uucp		kcl-cs!root44!rootis!%s
rootcl.uucp		kcl-cs!root44!rootcl!%s
hirst1.uucp		kcl-cs!hirst1!%s
camsteve.uucp		kcl-cs!camjenny!camsteve!%s
cuedvax.uucp		kcl-cs!camjenny!camsteve!cuedvax!%s
qmc-cs.uucp		kcl-cs!root44!qmc-cs!%s
spider.uucp		spider!%s
ulcs.uucp		ulcs!%s
# everything else goes to ukc for further routing

janet.chn       483094477   217   10    100644  6071      `
#
# Janet channel table
#   The domain name on the LHS is routed to the "host" on the RHS.
#   Note that the domain names on the LHS are in big-endian form.
#
#   Inclusion of this file automatically includes the following default rule:
#	uk.ac.<name>	->	<name>
#	uk.co.<name>	->	<name>
#
#   So, only mappings of, say, sitenames to actual hosts is really necessary
#   (and then only if the mapping is not provided in the NRS directory)
#   e.g.   uk.ac.york		york.minster
#
#   The rest is `optional'.
#
uk.ac.desy.dy.ga           desy.dy.ga
uk.ac.desy.dy.vb           desy.dy.vb
uk.ac.abdn                 abdn
uk.ac.aber.v               aber.v
uk.ac.aston.vaxa           aston.vaxa
uk.ac.aston.vaxb           aston.vaxb
uk.ac.aucc                 aucc
uk.ac.bedford              bedford
uk.ac.bbk.cs               bbk.cs
uk.ac.bbk.cu               bbk.cu
uk.ac.bham.phva            bham.phva
uk.ac.brad.cdc             brad.cdc
uk.ac.brad.comp            brad.comp
uk.ac.brad.eeng            brad.eeng
uk.ac.bris.csa             bris.csa
uk.ac.bris.esa             bris.esa
uk.ac.bris.gsa             bris.gsa
uk.ac.bris.msa             bris.msa
uk.ac.bris.pva             bris.pva
uk.ac.bris.qga             bris.qga
uk.ac.bris.qva             bris.qva
uk.ac.bris.qvb             bris.qvb
uk.ac.bris.qvc             bris.qvc
uk.ac.cam.cl               cam.cl
uk.ac.cam.cl-alvey         cam.cl-alvey
uk.ac.cam.cl-jenny         cam.cl-jenny
uk.ac.cam.cl-ring          cam.cl-ring
uk.ac.cam.cl-steve         cam.cl-steve
uk.ac.cam.cltripos         cam.cltripos
uk.ac.cam.eng-dsl          cam.eng-dsl
uk.ac.cam.eng-icf          cam.eng-icf
uk.ac.cam.eng-44           cam.eng-44
uk.ac.cam.jenny            cam.jenny
uk.ac.cam.phx              cam.phx
uk.ac.cran.cdga            cran.cdga
uk.ac.cran.cdvb            cran.cdvb
uk.ac.cran.cdva            cran.cdva
uk.ac.dund                 dund
uk.ac.dund.duns            dund.duns
uk.ac.uea.cpc.vax          uea.cpc.vax
uk.ac.uea.csa.vax          uea.csa.vax
uk.ac.uea.proteus          uea.proteus
uk.ac.uea.sp               uea.sp
uk.ac.ed                   ed
uk.ac.ed.aigr		   aigr
uk.ac.ed.aiva		   aiva
uk.ac.ed.bush              bush
uk.ac.ed.cstvax            cstvax
uk.ac.ed.ecsvax            ecsvax
uk.ac.ed.edai		   edai
uk.ac.ed.edee              edee
uk.ac.ed.edgr		   edgr
uk.ac.ed.edmrc		   edmrc
uk.ac.ed.edxa		   edxa
uk.ac.ed.emas              emas
uk.ac.ed.epistemi	   epistemi
uk.ac.ed.ercvax            ercvax
uk.ac.ed.eusip		   eusip
uk.ac.ed.geovax            geovax
uk.ac.ed.mcsu              mcsu
uk.ac.ed.mrcvax            mrcvax
uk.ac.ed.phyvax            phyvax
uk.ac.ex.da                ex.da
uk.ac.hull.cs.perq         hull.cs.perq
uk.ac.janet.news           janet.news
uk.ac.janet.nmu            janet.nmu
uk.ac.lancs.vax1           lancs.vax1
uk.ac.lancs.comp           lancs.comp
uk.ac.lancs.eng            lancs.eng
uk.ac.le.sabre             le.sabre
uk.ac.le.star              le.star
uk.ac.lon.arch.cu          lon.arch.cu
uk.ac.lon.educ.cu          lon.educ.cu
uk.ac.lon.neur.cu          lon.neur.cu
uk.ac.lon.pharm.cu         lon.pharm.cu
uk.ac.lon.rvc.cu           lon.rvc.cu
uk.ac.lut.multics          lut.multics
uk.ac.lse.vax1             lse.vax1
uk.ac.lse.vax2             lse.vax2
uk.ac.man.cgu              man.cgu
uk.ac.man.psy              man.psy
uk.ac.nott.vaxa            nott.vaxa
uk.ac.nott.icf             nott.icf
uk.ac.nott.hcig            nott.hcig
uk.ac.ox.prg               ox.prg
uk.ac.ox.prgg              ox.prgg
uk.ac.ox.prgv              ox.prgv
uk.ac.ox.vax1              ox.vax1
uk.ac.ox.vax2              ox.vax2
uk.ac.ox.vax3              ox.vax3
uk.ac.plym.a               plym.a
uk.ac.plym.b               plym.b
uk.ac.plym.d               plym.d
uk.ac.qec.cu               qec.cu
uk.ac.qmc                  qmc
uk.ac.qmc.cs               qmc.cs
uk.ac.rdg.am.cms           rdg.am.cms
uk.ac.rdg.am.uts           rdg.am.uts
uk.ac.rdg.cs               rdg.cs
uk.ac.rdg.micro            rdg.micro
uk.ac.rdg.psych            rdg.psych
uk.ac.rhc.vax              rhc.vax
uk.ac.rl.gb                rl.gb
uk.ac.rl.gd                rl.gd
uk.ac.rl.ge                rl.ge
uk.ac.rl.gf                rl.gf
uk.ac.rl.gk                rl.gk
uk.ac.rl.gm                rl.gm
uk.ac.rl.gr                rl.gr
uk.ac.rl.ib                rl.ib
uk.ac.rl.ic                rl.ic
uk.ac.rl.id                rl.id
uk.ac.rl.qb                rl.qb
uk.ac.rl.pa                rl.pa
uk.ac.rl.pb                rl.pb
uk.ac.rl.pc                rl.pc
uk.ac.rl.pd                rl.pd
uk.ac.rl.pe                rl.pe
uk.ac.rl.pf                rl.pf
uk.ac.rl.pg                rl.pg
uk.ac.rl.ph                rl.ph
uk.ac.rl.va                rl.va
uk.ac.rl.vb                rl.vb
uk.ac.rl.vc                rl.vc
uk.ac.rl.vd                rl.vd
uk.ac.rl.ve                rl.ve
uk.ac.rl.vf                rl.vf
uk.ac.rl.vg                rl.vg
uk.ac.rl.vi                rl.vi
uk.ac.rl.vs                rl.vs
uk.ac.salf.r-d             salf.r-d
uk.ac.salf.r-d-32          salf.r-d-32
uk.ac.co.ga                co.ga
uk.ac.soton.elprq1         soton.elprq1
uk.ac.st-and               st-and
uk.ac.stir.cs              stir.cs
uk.ac.stir.vaxa            stir.vaxa
uk.ac.stir.vaxb            stir.vaxb
uk.ac.swan.cv              swan.cv
uk.ac.swan.cs              swan.cs
uk.ac.ucl.brtl             ucl.brtl
uk.ac.ucl.cs               ucl.cs
uk.ac.ucl.tsperq           ucl.tsperq
uk.ac.ukc		   ukc
uk.ac.uwist.vaxa           uwist.vaxa
uk.ac.uwist.vaxb           uwist.vaxb
uk.ac.uwist.vaxc           uwist.vaxc
uk.ac.uwist.vaxd           uwist.vaxd
uk.ac.uwist.vaxdev         uwist.vaxdev
uk.ac.warwk.daisy          warwk.daisy
uk.ac.warwk.ga             warwk.ga
uk.ac.warwk.pa             warwk.pa
uk.ac.warwk.ubu            warwk.ubu
uk.ac.york                 york.minster
uk.ac.york.abbot           york.abbot
uk.ac.york.canon           york.canon
uk.ac.york.deacon          york.deacon
uk.ac.york.minster         york.minster
uk.ac.york.novice          york.novice

bitnet.chn      483094477   217   10    100644  402       `
#
# Bitnet channel table
#  Actual routing is done by the bitnet mailer itself.
#  Existance of this file automatically includes the following mappings:
#	<any>.bitnet   ->   <any>
#	<any>.arpa     ->   smtpuser at wiscvm   (see bitnetm.m4)
#	<any>.uucp     ->   uucp at psuvax1      (see bitnetm.m4)
#
#  So, only bitnet sites with other domain names should be included here
#  e.g.   ucbjade.cc		ucbjade
#
top.chn         483094477   217   10    100644  331       `
#  Top level domains
#  if address hasn't matched a domain name in any other table then
#  it should match something here. The RHS is a domain which specifies
#  where the message should be relayed for further routing.
#
uk		cs.ucl.ac.uk
uucp		ukc.ac.uk
arpa		ukc.ac.uk
csnet		csnet-relay.arpa
bitnet		wiscvm.arpa
dec		decwrl.arpa

SHAR_EOF
if test 8558 -ne "`wc -c Examples.a`"
then
echo shar: error transmitting Examples.a '(should have been 8558 characters)'
fi
echo shar: done with directory chn
chdir ..
#	End of shell archive
exit 0



More information about the Mod.sources mailing list