Path: seismo!harvard!talcott!panda!Jim Crammond From: sources-request@panda.UUCP Newsgroups: mod.sources Subject: Sendmail UK-1.4 part 2 of 5 Message-ID: <1638@panda.UUCP> Date: 10 Apr 86 23:04:37 GMT Sender: jpn@panda.UUCP Lines: 725 Approved: jpn@panda.UUCP Mod.sources: Volume 4, Issue 57 Submitted by: Jim Crammond # 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: # dom # This archive created: Fri Feb 28 13:10:19 1986 echo shar: creating directory dom mkdir dom cd dom echo shar: extracting Examples.a '(7914 characters)' cat << \SHAR_EOF > Examples.a ! local.dom 508607788 217 4 100644 239 ` # # Local (hw.cs) domain # brahma brahma.cs.hw.ac.uk jove jove.cs.hw.ac.uk odin odin.cs.hw.ac.uk ra ra.cs.hw.ac.uk zeus zeus.cs.hw.ac.uk # # Heriot-Watt domain # cs cs.hw.ac.uk ee ee.hw.ac.uk aimmi aimmi.hw.ac.uk ga ga.hw.ac.uk uk.dom 508608328 217 4 100644 4563 ` # # UK Domain Table. Generated: Wed Feb 12 13:42:52 GMT 1986 # # Standard form names # aberdeen aberdeen.ac.uk aberystwyth aberystwyth.ac.uk afrc-computing-centre afrc-computing-centre.ac.uk aston aston.ac.uk aucc aucc.ac.uk bangor bangor.ac.uk bath bath.ac.uk birkbeck birkbeck.ac.uk birmingham birmingham.ac.uk bradford bradford.ac.uk bristol bristol.ac.uk brunel brunel.ac.uk bt-research-labs bt-research-labs.co.uk cambridge cambridge.ac.uk cardiff cardiff.ac.uk city city.ac.uk cranfield cranfield.ac.uk daresbury daresbury.ac.uk dundee dundee.ac.uk dundee-tech dundee-tech.ac.uk durham durham.ac.uk east-anglia east-anglia.ac.uk edinburgh edinburgh.ac.uk essex essex.ac.uk exeter exeter.ac.uk glasgow glasgow.ac.uk hatfield hatfield.ac.uk heriot-watt heriot-watt.ac.uk hull hull.ac.uk imperial imperial.ac.uk janet janet.ac.uk kcl kcl.ac.uk keele keele.ac.uk lancashire-poly lancashire-poly.ac.uk lancaster lancaster.ac.uk leeds leeds.ac.uk leicester leicester.ac.uk liverpool liverpool.ac.uk lon lon.ac.uk loughborough loughborough.ac.uk lse lse.ac.uk manchester manchester.ac.uk nerc-bangor nerc-bangor.ac.uk nerc-bidston nerc-bidston.ac.uk nerc-holbrook nerc-holbrook.ac.uk nerc-imer nerc-imer.ac.uk nerc-keyworth nerc-keyworth.ac.uk nerc-murchison nerc-murchison.ac.uk nerc-wallingford nerc-wallingford.ac.uk nerc-wormley nerc-wormley.ac.uk newcastle newcastle.ac.uk nottingham nottingham.ac.uk nrs nrs.ac.uk open open.ac.uk oxford oxford.ac.uk paisley paisley.ac.uk plymouth plymouth.ac.uk poly-central-london poly-central-london.ac.uk qec qec.ac.uk qmc qmc.ac.uk queens-belfast queens-belfast.ac.uk reading reading.ac.uk rhbnc rhbnc.ac.uk rutherford rutherford.ac.uk salford salford.ac.uk serc-central-office serc-central-office.ac.uk sheffield sheffield.ac.uk southampton southampton.ac.uk st-andrews st-andrews.ac.uk stirling stirling.ac.uk strathclyde strathclyde.ac.uk surrey surrey.ac.uk sussex sussex.ac.uk swansea swansea.ac.uk tees-poly tees-poly.ac.uk ucl ucl.ac.uk ukc ukc.ac.uk ulster ulster.ac.uk umist umist.ac.uk umrcc umrcc.ac.uk uwist uwist.ac.uk warwick warwick.ac.uk westfield westfield.ac.uk york york.ac.uk # # Abbreviated form names # abdn abdn.ac.uk aber aber.ac.uk afrc afrc.ac.uk bbk bbk.ac.uk bham bham.ac.uk brad brad.ac.uk bris bris.ac.uk btrl btrl.co.uk cam cam.ac.uk cf cf.ac.uk #co co.ac.uk cran cran.ac.uk dct dct.ac.uk dl dl.ac.uk dund dund.ac.uk dur dur.ac.uk ed ed.ac.uk ex ex.ac.uk gla gla.ac.uk hatfld hatfld.ac.uk hw hw.ac.uk ic ic.ac.uk kl kl.ac.uk lancs lancs.ac.uk lancsp lancsp.ac.uk le le.ac.uk liv liv.ac.uk lut lut.ac.uk man man.ac.uk nbi nbi.ac.uk ncl ncl.ac.uk nkw nkw.ac.uk nme nme.ac.uk nmh nmh.ac.uk nns nns.ac.uk nott nott.ac.uk ntb ntb.ac.uk nwl nwl.ac.uk nwo nwo.ac.uk ou ou.ac.uk ox ox.ac.uk pcl pcl.ac.uk plym plym.ac.uk qub qub.ac.uk rdg rdg.ac.uk rl rl.ac.uk salf salf.ac.uk shef shef.ac.uk soton soton.ac.uk st-and st-and.ac.uk stir stir.ac.uk strath strath.ac.uk surr surr.ac.uk susx susx.ac.uk swan swan.ac.uk sx sx.ac.uk tp tp.ac.uk uea uea.ac.uk ulst ulst.ac.uk warwk warwk.ac.uk ukuucp.dom 508608086 217 4 100644 363 ` # # UUCP names to NRS names. # # Where appropriate uucp hostname are mapped to NRS domain names. # cstvax cstvax.ed.ac.uk edcaad edcaad.ed.ac.uk hwee ee.hw.ac.uk icdoc doc.ic.ac.uk kcl-cs cs.kcl.ac.uk spider spider.co.uk stl stl.stc.co.uk ukc ukc.ac.uk ulcs dcs.leeds.ac.uk mcvax mcvax.uucp bitnet.dom 508607579 217 4 100644 845 ` # # The Bitnet domain. (Mar 1985) # Data extracted from /usr/lib/rscs/SYSNAMES by: # awk '{print $1}' SYSNAMES | tr '[A-Z]' '[a-z]' | \ # awk '{printf "%-20s %s.bitnet\n", $1, $1 }' # wisdom wisdom.bitnet weizmann weizmann.bitnet remote remote.bitnet wisvms wisvms.bitnet ucbjade ucbjade.bitnet wiscvm wiscvm.bitnet psuvms1 psuvms1.bitnet taurus taurus.bitnet taunivm taunivm.bitnet hujics hujics.bitnet hbunos hbunos.bitnet barilan barilan.bitnet psuvax1 psuvax1.bitnet psuvm psuvm.bitnet cunyvm cunyvm.bitnet earnet earnet.bitnet rockvax rockvax.bitnet israearn israearn.bitnet # .... and so on ed.local.dom 508607661 217 4 100644 427 ` # local.dom for Edinburgh sites aigr aigr.ed.ac.uk aiva aiva.ed.ac.uk bush bush.ed.ac.uk cstvax cstvax.ed.ac.uk ecsvax ecsvax.ed.ac.uk edai edai.ed.ac.uk edee edee.ed.ac.uk edgr edgr.ed.ac.uk edmrc edmrc.ed.ac.uk edxa edxa.ed.ac.uk emas emas.ed.ac.uk epistemi epistemi.ed.ac.uk ercvax ercvax.ed.ac.uk eusip eusip.ed.ac.uk geovax geovax.ed.ac.uk mcsu mcsu.ed.ac.uk mrcvax mrcvax.ed.ac.uk phyvax phyvax.ed.ac.uk top.dom 508607579 217 4 100644 467 ` # 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 cstvax.ed.ac.uk uucp ukc.ac.uk arpa cs.ucl.ac.uk com cs.ucl.ac.uk edu cs.ucl.ac.uk gov cs.ucl.ac.uk mil cs.ucl.ac.uk org cs.ucl.ac.uk oz ukc.ac.uk csnet csnet-relay.arpa bitnet wiscvm.arpa mailnet mit-multics.arpa dec decwrl.arpa csnet.dom 508608201 217 4 100644 576 ` # # The Csnet domain (Feb 86) # Generated from unix/pmdf CSNET table with # the following command: "sed 's/,.*//' | tr '[A-Z]' '[a-z]'" # csnet-relay csnet-relay.csnet csnet-sh csnet-sh.csnet csnet-cic csnet-sh.csnet albany albany.csnet sunya albany.csnet suny-a albany.csnet alcoa-atc alcoa-atc.csnet alcoa-sei alcoa-sei.csnet alcoa alcoa-sei.csnet sei-alcoa alcoa-sei.csnet apple apple.csnet arizona arizona.csnet az arizona.csnet asu asu.csnet arizona-state asu.csnet asu-vax asu.csnet asuvax asu.csnet australia australia.csnet bbn-rvax bbn-rvax.csnet # .... and so on SHAR_EOF if test 7914 -ne "`wc -c Examples.a`" then echo shar: error transmitting Examples.a '(should have been 7914 characters)' fi echo shar: extracting MAKE '(4274 characters)' cat << \SHAR_EOF > MAKE #!/bin/sh # # shell script to generate a sendmail .dom file containing all # the domain information for this site from a set of domain database # files contained in this directory. # if [ $# -le 1 ] then echo usage: MAKE site files... exit fi site=$1 shift rm -f $site.dom top= rest= for i in $* do case $i in *top.dom) top="$top $i" ;; *) rest="$rest $i" ;; esac done sed -e '/^#/d' -e '/^$/d' $rest | awk ' { n = split($2, domains, ".") if ($1 != domains[1]) printf "R$*%s\t\t$1%s\n", $1, $2 >"S10" else { for (i=n; i>1; i--) print domains[i] " " domains[i-1] } } ' | sort | uniq > $site awk ' BEGIN { MINCLSIZE = 2 classes = "ABCDEFGH" c = 1; d = 0 } { domain[$1] = domain[$1] " " $2 } END { for (i in domain) { domain[i] = domain[i] " " sort[++d] = i } for (i=1; i<=d; i++) { for (j=1; j 0) { t = sort[i] for (k=i; k>j; k--) sort[k] = sort[k-1] sort[j] = t } } for (j=i+1; j<=d; j++) { m = " " sort[j] " " if (index(domain[sort[i]], m) > 0) { t = sort[j] for (k=j; k>i; k--) sort[k] = sort[k-1] sort[i] = t } } } for (i=1; i<=d; i++) { n = split(domain[sort[i]], subdoms, " ") if (n >= MINCLSIZE && c <= length(classes)) { C = substr(classes, c, 1) c++ print "" >"dom.classes" printf "D%s%s\n", C, sort[i] >"dom.classes" printf "C%s%s\n", C, domain[sort[i]] >"dom.classes" printf "R$*$=%s\t\t\t$1$2.$%s\t\tu@d -> u@d.%s\n", \ C, C, sort[i] >"S11" printf "R$*$=%s.$%s\t\t$1$2\t\tu@d.%s -> u@d\n", \ C, C, sort[i] >"S12" printf "R$*@$=%s.$+\t\t$@$>9$1@$2.$3\n", C >"S13" printf "R$*$=%s\t\t\t$@$1$2\n", C >"S13" } else { for (m=1; m<=n; m++) { printf "R$*%s\t\t$1%s.%s\n", subdoms[m], \ subdoms[m], sort[i] >"S11" printf "R$*%s.%s\t\t$1%s\n", subdoms[m], \ sort[i], subdoms[m] >"S12" printf "R$*@%s.$+\t\t$@$>9$1@%s.$2\n", \ subdoms[m], subdoms[m] >"S13" printf "R$*%s\t\t\t$@$1%s\n", \ subdoms[m], subdoms[m] >"S13" } } } } ' $site rm -f $site # # The header # cat >$site.dom <> $site.dom rm -f dom.classes # # generate top level domains. If no file is specified hardwire some in. # cat >> $site.dom <<'EOF' # top level domains EOF if [ -n "$top" ] then sed -e '/^#/d' -e 's/[ ].*//' $top | fmt | sed 's/^/CT/' >> $site.dom else echo Warning: no top.dom specified echo 'CTuk arpa com edu gov mil org us net uucp oz csnet bitnet mailnet dec' >> $site.dom fi # # Ruleset 10 # cat >> $site.dom <<'EOF' ########################################## # Ruleset 10 -- domain name aliasing # ########################################## S10 EOF if [ -f S10 ] then cat S10 >> $site.dom rm -f S10 fi # # Ruleset 11 # cat >> $site.dom <<'EOF' ######################################################## # Ruleset 11 -- Expand address to full domain name # ######################################################## S11 EOF cat S11 >> $site.dom rm -f S11 # # Ruleset 12 # cat >> $site.dom <<'EOF' ############################################################ # Ruleset 12 -- Strip full domain name to minimum part # ############################################################ S12 EOF tail -r S12 >> $site.dom rm -f S12 cat >> $site.dom <<'EOF' ifdef(`NRSFORMAT',` ############################################################### # Ruleset 13 -- Convert domains in NRS order to 822 order # ############################################################### S13 R$*$=T $@$1$2 R$*@$=T.$+ $@$>9$1@$2.$3 EOF tail -r S13 >> $site.dom rm -f S13 echo "')" >> $site.dom echo $site.dom made exit SHAR_EOF if test 4274 -ne "`wc -c MAKE`" then echo shar: error transmitting MAKE '(should have been 4274 characters)' else chmod a+x MAKE fi echo shar: extracting Namecheck '(743 characters)' cat << \SHAR_EOF > Namecheck #!/bin/sh # # Shell script to find possible name conflicts in the domain # information given in a set of sendmail domain database files. # Returns the number of name conflicts found. # jim@hw.cs 9/85 # if [ $# -lt 1 ] then echo usage: Namecheck files... exit fi awk ' /^#/ { break } { n = split($2, domains, ".") if ($1 == domains[1]) { full = domains[n] for (i=n-1; i>0; i--) { full = domains[i] "." full print domains[i] " " full } } } ' $* | sort | uniq | awk ' BEGIN { prev1 = "" prev2 = "" errorval = 0 } { if (prev1 == $1) { if (errorval == 0) print "Name conflicts:" printf "\t\"%s\" in \"%s\" and \"%s\"\n", $1, prev2, $2 errorval++ } prev1 = $1 prev2 = $2 } END { exit errorval } ' SHAR_EOF if test 743 -ne "`wc -c Namecheck`" then echo shar: error transmitting Namecheck '(should have been 743 characters)' else chmod a+x Namecheck fi echo shar: extracting README '(4324 characters)' cat << \SHAR_EOF > README General ------- It is recommended that you have some idea of what domains are before you start. RFC819 (supplied with the sendmail documentation) is a good starting point for this. The domain tables provide the information that allows sendmail to expand host/site names or abbreviated domain names to fully qualified domain names. The tables consist of rules (1 per line) which consist of two strings seperated by white space. Essentially, any address whose domain part ends in the string given on the LHS of a rule will be expanded to the string given on the RHS. For example, if the following entry was in the domain tables hw hw.ac.uk then a user can give the address jim@hw and sendmail will expand this to the fully qualified name jim@hw.ac.uk. Also, this will expand jim@cs.hw to jim@cs.hw.ac.uk. Note that the names in the domain tables must be given in RFC822 (little-endian) form with the most general part rightmost. e.g. hw.ac.uk. Probably the minimum information you need to specify in the domain tables is a mapping from your host name to your domain name, e.g vax6 vax6.cs.hw.ac.uk This would mean users would have to give fully qualified addresses to send mail elsewhere. In theory, the maximum information you should specify should be the list of all siblings of the subdomains that make up your domain name, e.g. all subdomains of "uk", "ac", "hw" and "cs" for vax6.cs.hw.ac.uk. You can add further information, for example, you may wish to specify all the subdomains of "co.uk" as well as "ac.uk", but beware of naming conflicts. There maybe a domain "ucs" in both "co.uk" and "ac.uk"; if so, you must only specify one. If the following entries were in the domain tables: ucs ucs.ac.uk co co.uk then users would be able to mail "jim@ucs" for "ucs.ac.uk", and "jim@ucs.co" for "ucs.co.uk". Some domains contain a very large number of subdomains (e.g. arpa, uucp). It is probably unwise to attempt to include all these names in such cases as sendmail loads all this information in at startup time, and will thus take longer. Usually a more regional scheme is recommended like "all uucp sites in the uk" for the uucp domain. (Domains containing more than a 1000 subdomains will probably break the MAKE script anyway!) Again, this just means users specify a fully qualified addresses for sites not included in the domain tables. Hostname or domain name aliases can also be included in these files; so for example, an entry such as: oldname.uucp newname.ac.uk means addresses like jim@oldname.uucp will be converted to jim@newname.ac.uk. Lines beginning with "#" in the tables are treated as comments. Top Level Domains ----------------- Domain tables whose name ends with "top.dom" are treated specially. These files are assumed to contain a list of top level domain names. The format of these tables is the same as for the "top.chn" channel tables: a top level domain name on the LHS and a relaying domain on the RHS, e.g. uk ukc.ac.uk Thus you can link the top.chn and top.dom files, if you wish. If no "top.dom" file is supplied, a default list of top level domains will be generated by the MAKE script which contains the following domain names: uk arpa com edu gov mil org us net uucp oz csnet bitnet mailnet dec Examples -------- The archive Examples.a contains sample domain tables. How to compile the domain tables -------------------------------- 1. Create some files containing the domain table information. This is best done by extracting sample domain files from Examples.a and editing them, if necessary, to contain the relevent data for this site. Uk users should be able to use uk.dom as is. 2. Run "MAKE site file1 file2..." This generates the sendmail classes and rules for domain expansion in a file .dom. e.g. MAKE hwcs local.dom uk.dom top.dom You may see messages such as "direct is not an array" produced by the MAKE script; ignore these! This shell script does a lot of work so be prepared to wait! Checking for name clashes ------------------------- The program Namecheck will warn you of any name clashes you have in your domain tables. Run "Namecheck file1 file2...", where the arguments are the domain tables used in the above MAKE command (except top.dom). e.g. Namecheck local.dom uk.dom SHAR_EOF if test 4324 -ne "`wc -c README`" then echo shar: error transmitting README '(should have been 4324 characters)' else chmod a+x MAKE fi echo shar: done with directory dom cd .. # End of shell archive exit 0