[net.sources] A way to use map data

chris@politik.UUCP (Christopher Seiwald) (12/11/84)

#--------CUT---------CUT---------CUT---------CUT--------#
#########################################################
#                                                       #
# This is a shell archive file.  To extract files:      #
#                                                       #
#    1)	Make a directory for the files.                 #
#    2) Write a file, such as "file.shar", containing   #
#       this archive file into the directory.           #
#    3) Type "sh file.shar".  Do not use csh.           #
#                                                       #
#########################################################
#
#
echo Extracting README:
sed 's/^Z//' >README <<\STUNKYFLUFF
ZINTRODUCTION
Z
ZThis kit provides sites with sendmail and csh a method of automatically
Zrouting uucp mail.  You will need pathalias also.  If you don't have it,
Zcontact me and I can send you a copy.  This package contains six files:
Z
Z	- README, this file
Z	- map.awk, an awk script for converting mod.map.news articles
Z	  into source for pathalias.
Z	- uuxmail, the routing mailer sendmail calls to deliver uucp
Z	  mail.
Z	- makefile, a make file for installing uuxmail and producing
Z	  the routing database.
Z	- sendmail.q+a, help on how to modify your sendmail.cf file.
Z	- article, the article submitted to net.mail.
Z
ZINSTALLATION
Z
ZRun "make install".  This sets uuxmail up as /usr/lib/uucp/uuxmail, and 
Zproduces the first routing database in /usr/lib/uucp/paths.  Pathalias must 
Zbe in the current directory.
Z
ZModify /usr/lib/sendmail.cf to use uuxmail as the UUCP mailer.  See
Zquestion #1 in the file sendmail.q+a.
Z
ZNOTES
Z
ZMap.awk
Z	Map.awk does a very simple transformation on all the maps in
Z	/usr/spool/mod/map/news, assuming that any link listed in the
Z	News: or Mail: fields is a bidirectional mail link with the
Z	default (0) weight.  This is a gross underuse of pathalias's
Z	capability, but until mod.map.uucp is distributed, that is all
Z	I can find.
Z
ZSendmail
Z	Sendmail breaks addresses into three components: HOST, USER,
Z	and DOMAIN.  DOMAIN specifies what mailer (back end mail
Z	delivery program) to use, and HOST and USER are passed as
Z	arguments to the mailer.
Z
Z	Addresses formatted as "USER@HOST.DOMAIN" are parsed as
Z	indicated.
Z
Z	UUCP addresses, formatted as "host1!host2!host3!user", without
Z	the "@", are taken as "host2!host3!user@host1.UUCP".  That is,
Z	the name before the first !, "host1", is the HOST, the
Z	remaining "host2!host3!user" is the USER, and "UUCP" is the
Z	DOMAIN.
Z
ZUuxmail
Z	Uuxmail always tries to find the HOST in the routing database,
Z	for all UUCP addresses, including:
Z
Z		neighbor!user 		(stays the same)
Z		user@neighbor.UUCP	"
Z		axevax!user		(becomes host1!host2!axevax!user)
Z		user@axevax.UUCP	"
Z		axevax!mud!user		(becomes host1!host2!axevax!mud!user)
Z		mud!user@axevax.UUCP	"
Z
Z	If uuxmail cannot find HOST in the routing database, it simply
Z	leaves the orginal address.  In this way, local connections
Z	only UUCP knows about are not broken.
Z
Z	For a good time, try "mail -v address".
STUNKYFLUFF
set `sum README`
if test 39520 != $1
then
echo README: Checksum error. Is: $1, should be: 39520.
fi
#
#
echo Extracting article:
sed 's/^Z//' >article <<\STUNKYFLUFF
ZTHE QUESTION
Z
ZI sent out an inquiry over a month ago asking the question "Is there a
Zright way to use map data?" for mail routing.  That is, how do you
Ztransform the usenet connectivity information distributed in mod.map.news
Zand mod.map.uucp into a system whereby your machine routes mail addressed 
Zto "joe@site.uucp" properly.  The problem breaks into two components:
Z
Z	1) How do you produce routing information from connectivity
Z	   information in the mod.map data?
Z	2) How do you get your mailer to use this routing information?
Z
ZI should add that we are a uucp only 4.2BSD site running sendmail, without
Za source license.
Z
ZPOSSIBLE HELP FROM NETLAND
Z
ZAnswers were posted to the net and mailed to me.  The general answer is
Z"not really."  Specific help is available though:
Z
Zgenerating path data:
Z	(PATHALIAS) Peter Honeyman (down!honey) has pathalias, a
Z	hummdinger of a program which takes connectivity information
Z	and produces a path database.  Its output is either a dbm
Z	pair of files or an ascii file with lines of the format
Z	"xvax        avax!bvax!xvax!%s".  Unfortunately, its input
Z	is *not* mod.map.news (maybe mod.map.uucp?).  A filter helps.
Z
Zrouting mail:
Z	(sendmail) Bruce Israel (umcp-cs!israel) suggests rewriting
Z	sendmail a bit to handle routing as another from address
Z	rewriting, using a path table.  He has done this.  He has
Z	not distributed it.
Z
Z	(mailer) Ray Essick (uiucdcsb!essick) shuns rewriting
Z	sendmail, favoring a special routing mailer which takes
Z	the destination host and supplies a path to the actual
Z	mailer, uux.  This seems like a good idea.  He did not 
Z	post his mailer, but will if asked.
Z
Z	(mailer) Mark Horton (cbosgd!mark) of the UUCP project also
Z	has a routing mailer, called uudom - it understands domains.
Z	He mentions modifying sendmail.
Z
Z	(mailer) Robert Elz (mulga!kre) also has a routing mailer.
Z	He doesn't use it yet, for lack of good map data.
Z
Zall:
Z	(MKCON) Piet Beertema (mcvax!piet) has a complete system
Z	which unbundles the news map files, makes the path table
Z	and does the rerouting.  Unfortunately, it was a little too
Z	complicated for me to use, since implementation included
Z	installing many files, seriously editing sendmail.cf, and
Z	running programs with much site specific information
Z	compiled in.
Z
Z
ZRECOMMENDED SOLUTION
Z
Zo	Run mod.map.news or mod.map.uucp through pathalias to produce 
Z	the routing database.  Since the new mod.map.uucp data is not
Z	out yet, I don't know if pathalias will swallow it whole.  For
Z	sure, you can take the (minimal) connectivity information in
Z	mod.map.news and pass it through a filter.
Z
Zo	Install a routing mailer.   Modify sendmail.cf to use this mailer 
Z	as your uucp mailer.
Z
ZI am posting a package to net.sources to help you do all this.  It includes
Z
Z	-   a simple awk.script to filter mod.map.news for pathalias.
Z	-   a routing mailer.
Z	-   a sendmail.cf question and answer sheet.
Z	-   a makefile to automate building the routing database.
Z
ZThe routing mailer (uuxmail) is a short csh script which takes the
Zhost and user arguments provided by sendmail, looks up host in the
Zrouting database to produce a path, tacks the user name onto that
Zpath, and then hands the result to uux for mailing.  It isn't fancy
Zbut it was easy.
Z
ZIf you need pathalias also, I can send you a copy.
STUNKYFLUFF
set `sum article`
if test 52434 != $1
then
echo article: Checksum error. Is: $1, should be: 52434.
fi
#
#
echo Extracting makefile:
sed 's/^Z//' >makefile <<\STUNKYFLUFF
ZMAP = /usr/spool/news/mod/map/news
ZPATHS = /usr/lib/uucp/paths
ZMAILER = /usr/lib/uucp/uuxmail
Z
Z
Zpaths:	pathalias	# you must have pathalias in this directory
Z	awk -f map.awk ${MAP}/* | pathalias | sort > ${PATHS}
Z# paths must be sorted for uuxmail to work
Z	chmod a=r ${PATHS}
Z
Zinstall: paths
Z	cp uuxmail ${MAILER}
Z	chmod a=rx ${MAILER}
Z	chown uucp ${MAILER}
STUNKYFLUFF
set `sum makefile`
if test 12778 != $1
then
echo makefile: Checksum error. Is: $1, should be: 12778.
fi
#
#
echo Extracting map.awk:
sed 's/^Z//' >map.awk <<\STUNKYFLUFF
Z/^Name:/ { name = $2; }
Z/^Mail:/ || /^News:/ {
Z	for (i=2;$i != "";i++)
Z	{
Z		print name,$i;
Z		print $i,name;
Z	}
Z	cont = 1;
Z	next;
Z}
Z/^	/ && (cont != 0) {
Z	for (i=1;$i != "";i++)
Z	{
Z		print name,$i;
Z		print $i,name;
Z	}
Z	next;
Z}
Z{ cont = 0; }
STUNKYFLUFF
set `sum map.awk`
if test 15771 != $1
then
echo map.awk: Checksum error. Is: $1, should be: 15771.
fi
#
#
echo Extracting sendmail.q+a:
sed 's/^Z//' >sendmail.q+a <<\STUNKYFLUFF
Z		FOUR SENDMAIL.CF QUESTIONS (WITH DIFFS)
Z
Z
ZQ: How can I change my uucp mailer to /usr/lib/uucp/uuxmail?
Z
ZA: Find the two lines that define your uucp mailer (the first begins with
Z   Muucp, and the second begins with a tab), and replace them with:
Z   
Z   Muucp, P=/usr/lib/uucp/uuxmail, F=sDFMhuU, S=13, R=23, M=100000,
Z	A=uuxmail $h $u
Z
Z
Z=======================================================================
Z
Z
ZQ: If ucbvax is my nearest arpa site, how can I get mail addressed as
Z   "joe@smakvax.arpa" automatically routed?
Z
ZA: Add a relay host:
Z
Z
Z		--- 27,32 -----
Z		  # UUCP name
Z		  DU$w
Z		  
Z		+ # relay host
Z		+ DRucbvax
Z		+ 
Z
Z   And add:
Z
Z		--- 263,272 -----
Z		  
Z		  ###############################################
Z		  ###  Machine dependent part of rulset zero  ###
Z		  ###############################################
Z		  
Z		+ # relay .ARPA stuff away 
Z		+ R$+<@$+.ARPA>		$1@$2<@$R.UUCP>
Z		+ 
Z		  # resolve names we can handle locally
Z
Z   This is probably not the intended use of relay hosts.  "joe@smakvax.arpa"
Z   becomes (essentially) ucbvax!"joe@smakvax.arpa", and your uuxmail program
Z   will (hopefully) route the letter to ucbvax properly.
Z	  
Z
Z======================================================================
Z
Z
ZQ: How can I get "joe@smalltime" to be interpreted as "joe@smalltime.uucp"?
Z
ZA: Put in a ruleset 6, if there isn't one already:
Z  
Z	--- 212,216 -----
Z	  R$-=$+			$@$>6$2<@$1.BITNET>		resolve bitnet names
Z  
Z	+ # no domain implies uucp for us poor fools.
Z	+ S6
Z	+ R$+<@$->		$1<@$2.UUCP>		a@b -> a@b.UUCP
Z	  
Z
Z======================================================================
Z
ZQ: Tom, what's the deal on freezing the configuation file?
Z
ZA: Just run "/usr/lib/sendmail -bz" after modifying the sendmail.cf
Z   file.  If you don't, sendmail may use the frozen version instead of
Z   your modified version.  You can always just remove the sendmail.fc
Z   file, and sendmail will always reread sendmail.cf.   Freezing the
Z   configuration improves sendmail performance.
STUNKYFLUFF
set `sum sendmail.q+a`
if test 49508 != $1
then
echo sendmail.q+a: Checksum error. Is: $1, should be: 49508.
fi
#
#
echo Extracting uuxmail:
sed 's/^Z//' >uuxmail <<\STUNKYFLUFF
Z#!/bin/csh -f
Z
Z# usage: uuxmail path user
Z
Zset path = (/bin /usr/bin)
Z
Zif  ($#argv != 2)  exit 64  # usage error
Zset host = $1; echo ...host: $host
Zset user = $2; echo ...user: $user
Z
Zset route = `look "$host	" /usr/lib/uucp/paths`
Zif  ($#route == 2)  then
Z	echo ...path: $route[2]
Z	set dest = `echo $route[2] | sed "s/%s/$user/;s/\\!/ /"`
Z	if  ($#dest != 2)  exit 69  # service unaviable (no !)
Zelse
Z	echo ...$host unknown - kicked to uux
Z	set dest = ($host $user)
Zendif
Z
Zecho ...uux $dest[1]\!rmail "($dest[2])"
Zuux - -r $dest[1]\!rmail "($dest[2])"
Zexit $status
STUNKYFLUFF
set `sum uuxmail`
if test 32870 != $1
then
echo uuxmail: Checksum error. Is: $1, should be: 32870.
fi
echo ALL DONE BUNKY!
exit 0
-- 
Christopher Seiwald
dual!ptsfa!politik!chris