[comp.mail.sendmail] inverted alias lookup?

steve@mrc-apu.cam.ac.uk (Steve Platt) (10/25/90)

Has anyone experience with getting UK-sendmail's multihost configuaration to
turn unix usernames into "official" aliases in outgoing "From:"  lines?

The SUN-supplied sendmail.cf does something with the YP map "mail.byaddr"
which can be used with aliases like :-

 a.n.other: guest@mailserver
 guest:     a.n.other

The YP "make" builds mail.byaddr from this so you can get sendmail
to translate "guest@mailserver" into "a.n.other@domain", whereas I
think uk-sendmail currently produces "guest@domain".

What we want is to have our outgoing From lines free of usernames.

Steve Platt
Tempus Fugitive
MRC Applied Psychology Unit
15 Chaucer Road
Cambridge CB2 2EF

R.Thirlby@lut.ac.uk (Rob Thirlby) (10/25/90)

We use a script wrapped around the hhcp mailer to achieve this.  It
both edits the from type lines and also kills any spurious via lines
which betray the identity of the individual nodes in the cluster.

rob Thirlby

A.Macpherson@stl.stc.co.uk (10/26/90)

Steve, and anyone else who wants to use a standard Sun sendmail, rather
than the IDA versions.  (Available from Brunel and STL)

This is one for your localise.sh

Define a map eg Y for the reverse YP

DYmail.byaddr

Then as the first line in ruleset 4

R$-@$*		$:${Y$1@$2$}

This will only affect headers, since transport addresses are still in <>
and will fix up for every delivery channel

There is a possible "catch" in that it is usual in uk-sendmail for the
domain component to be the cannonical domain by this stage --- you might
need to load up:

id: id@host
f.u.llname: id@domain

to get the (reverse) mapping you want to achieve.  You can check by running
test mode, for rules 3,1,20,4 and looking at what is passed in to 4

Short plug:  I have explicit rules in a modified uk-sendmail, both for this
and for MX based routing, with a default if no MX record is found.  FTAM or
Niftp to stl, ANON/guest login, file sendmail.cf/UK2.1.stc.tar.Z
-- 
A.Macpherson@stl.stc.co.uk     - or -      Post@stl.stc.co.uk
"Quot homines, tot sententiae"

per@erix.ericsson.se (Per Hedeland) (10/31/90)

In article <8019.9010252245@helios.cs.hw.ac.uk>, A.Macpherson@stl.stc.co.uk
writes:
|> Define a map eg Y for the reverse YP
|> 
|> DYmail.byaddr
|> 
|> Then as the first line in ruleset 4
|> 
|> R$-@$*		$:${Y$1@$2$}

This works, but not too well, if you use the Sun-supplied way of building
the mail.byaddr map, i.e. essentially just reversing the mail.aliases map.
Problems:

- With several aliases pointing to the same userid, there's really no
  telling which of them will be the one selected for the reverse mapping -
  experiments indicate that it is the last one in the aliases file, but I
  certainly wouldn't rely on it and risk having all my mail go out with
  'postmaster' or something as the sender.

- There's no sensible way to have several addresses (e.g. on different
  hosts) map to the same reverse alias.

- The reverse alias will always be all-lowercase, which some would consider
  unaesthetic in a username like Mr Macpherson's above.

If for some reason you don't want to run the IDA setup, at least get the
xalparse program that comes with it, and use it to generate both forward and
reverse aliases. Below is a diff to the yp Makefile in SunOS 4.0.3 that
accomplishes just that, picking the xalparse input from /etc/xaliases and
putting the reversed aliases in the mail.revaliases map (which then goes in
the DY definition as above, I thought it best to use another name than
mail.byaddr for various reasons).

--Per Hedeland
per@erix.ericsson.se  or
per%erix.ericsson.se@uunet.uu.net  or
...uunet!erix.ericsson.se!per


*** /var/yp/Makefile.orig	Tue Apr 25 02:26:50 1989
--- /var/yp/Makefile	Mon Jan  8 10:23:18 1990
***************
*** 4,10 ****
--- 4,12 ----
  DIR =/etc
  DOM = `domainname`
  NOPUSH = ""
+ XALIASES = /etc/xaliases
  ALIASES = /etc/aliases
+ REVALIASES = /etc/revaliases
  YPDIR=/usr/etc/yp
  YPDBDIR=/var/yp
  YPPUSH=$(YPDIR)/yppush
***************
*** 209,225 ****
  		echo "couldn't find $(DIR)/bootparams"; \
  	fi
  
! aliases.time: $(ALIASES)
! 	-@if [ -f $(ALIASES) ]; then \
  		cp $(ALIASES) $(YPDBDIR)/$(DOM)/mail.aliases; \
  		/usr/lib/sendmail -bi -oA$(YPDBDIR)/$(DOM)/mail.aliases; \
  		$(MKALIAS) $(YPDBDIR)/$(DOM)/mail.aliases $(YPDBDIR)/$(DOM)/mail.byaddr; \
  		rm $(YPDBDIR)/$(DOM)/mail.aliases; \
  		touch aliases.time; \
  		echo "updated aliases"; \
  		if [ ! $(NOPUSH) ]; then \
  			$(YPPUSH) mail.aliases; \
  			$(YPPUSH) mail.byaddr; \
  			echo "pushed aliases"; \
  		else \
  			: ; \
--- 211,231 ----
  		echo "couldn't find $(DIR)/bootparams"; \
  	fi
  
! aliases.time: $(ALIASES) $(REVALIASES)
! 	-@if [ -f $(ALIASES) -a -f $(REVALIASES) ]; then \
  		cp $(ALIASES) $(YPDBDIR)/$(DOM)/mail.aliases; \
  		/usr/lib/sendmail -bi -oA$(YPDBDIR)/$(DOM)/mail.aliases; \
  		$(MKALIAS) $(YPDBDIR)/$(DOM)/mail.aliases $(YPDBDIR)/$(DOM)/mail.byaddr; \
  		rm $(YPDBDIR)/$(DOM)/mail.aliases; \
+ 		awk 'BEGIN { OFS="\t"; } {for (i = 2; i <= NF; i++) print $$i, $$1}' \
+ 		    $(REVALIASES) | \
+ 		    $(MAKEDBM) -l - $(YPDBDIR)/$(DOM)/mail.revaliases; \
  		touch aliases.time; \
  		echo "updated aliases"; \
  		if [ ! $(NOPUSH) ]; then \
  			$(YPPUSH) mail.aliases; \
  			$(YPPUSH) mail.byaddr; \
+ 			$(YPPUSH) mail.revaliases; \
  			echo "pushed aliases"; \
  		else \
  			: ; \
***************
*** 348,352 ****
  $(DIR)/netid:
  $(DIR)/security/passwd.adjunct:
  $(DIR)/security/group.adjunct:
! $(ALIASES):
  $(DIR)/netmasks:
--- 354,362 ----
  $(DIR)/netid:
  $(DIR)/security/passwd.adjunct:
  $(DIR)/security/group.adjunct:
! $(ALIASES) $(REVALIASES): $(XALIASES)
! 	/usr/local/bin/xalparse $(XALIASES) $(ALIASES).tmp $(REVALIASES)
! 	echo "### Do not edit this file, it is generated automatically from $(XALIASES)" > $(ALIASES)
! 	cat $(ALIASES).tmp >> $(ALIASES)
! 	rm -f $(ALIASES).tmp
  $(DIR)/netmasks: