++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++ sendmail-envelope-revaliases-FAQ.txt ++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Date: Tue, 14 May 1996 18:32:11 +0200 (MET DST) From: Leif Erlingsson To: Mark Subject: What I did yesterday: Sorry, nothing for You (though the feature might be used for some customer one day), but rather for myself. I had *one* remaining and irritating problem with my home sendmail setup; Return-Path: The Return-Path: was leif@localhost.swip.net or something like that because the only IP number I can rely on is the loopback interface: 127.0.0.1 localhost elijah.swip.net \ elijah.swipnet.se elijah With all other headers, masquerading and reverse aliasing fixed the return addresses nicely, but with envelope-masquerading, all I got was Return-Path: leif@mailbox.swipnet.se, rather than Return-Path: leif@localhost.swip.net and neither one of them is any good! I believe this header is used by other sendmails to send back error and status reports (when it is present). I have my box configured to believe it is in domain swip.net, and most of the time it believes it is named elijah. But since the first entry after 127.0.0.1 is localhost, I guess sendmail thinks the envelope should be localhost.swip.net if there is no envelope-masquerading. But not even envelope-masquerading could save me, as `leif' is not a valid user at mailbox.swipnet.se. So in order to be absolutely sure that no bounces etc was lost to me, I worked all night and finally had a new feature: If xaliasing is activated in the m4 / mc - sendmail configuration files, and if envelope-masquerading is also enabled, then the envelope will instead be reverse-aliased, rather than masqueraded! Here's the changes to proto.m4 as of tonight --- and they work with earlier changes to the same file in S93. The current changes are to S94: S94 define(`X', ifdef(`_XALIASES_', ifdef(`_MASQUERADE_ENVELOPE_', `', `#'), `#'))dnl X`'R$* < @ *LOCAL* > $* $: $(generics $1@$j $: $1 < @ *LOCAL* > $2 $) X`'R$* < @ *LOCAL* > $* $: $(generics $1@$k.$m $: $1 < @ *LOCAL* > $2 $) X`'R$+ < @ $+ > $* $@ $>93 $1 < @ $2 > $3 already canonical X`'R$* < @ > $* $@ $>93 $1 < @ > $2 already canonical X`'R$+ @ $+ $: $1 < @ $2 > focus on domain X`'R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right X`'R$+ < @ $+ > $: $>96 $1 < @ $2 > already canonical undefine(`X')dnl ifdef(`_MASQUERADE_ENVELOPE_', `', `#')dnl R$+ $@ $>93 $1 ifdef(`_MASQUERADE_ENVELOPE_', `#', `')dnl R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2 The original code was the last 4 lines. Plus `S94' of course. The cruical line is this line: X`'R$* < @ *LOCAL* > $* $: $(generics $1@$k.$m $: $1 < @ *LOCAL* > $2 $) When X is *not* equal to `#', this line matches a local sender and looks up sender@$k.$m in the database, where $k in my case is elijah, as defined by the `hostname` program, and $m is swip.net, defined by /etc/resolv.conf. The first line is useless as $j for reasons not fully clear to me at this piont has the value localhost.swip.net, whereas it in other rules and places in the configuration it has the value elijah.swip.net. Sendmail is in control over this value. If I didn't add the second line, I would have to have double reverse aliases for every person, one with the `elijah' value and one with the `localhost' value. I did this when testing this solution out. (It is absolutely neccessary for other reasons to have localhost first on that /etc/hosts line.) As it now is, my sendmail is in total control, and all headers that make any difference is properly masqueraded on my home system - look & see! I have not activated envelope-masquerading on dispatch, but it is very easy to do so, if You want to satisfy a customer who wants mail sent out from his user on dispatch (a mailbot running as someuser@hisdomain.com) to hide the fact that hisdomain.com is not the canonical domain name for the host. But I doubt anyone will care. What *is* nice is that this solution is very well suited for us dial-up-internet guys with dynamically assigned IP numbers. I actually have my elijah's sendmail believe (through Cw lege.com) that lege.com is MX'd to itself. I can still send mail to the real lege.com thanks to virtual domains! This allows me to test things locally. And to mail local users using user@lege.com without going out on the internet! Cool! Soon I'll have to present it all on the webb! [And *that* sure took it's time ;-) -- but now it's all out there, and you need to get the latest cf/m4/proto.m4 patches from http://www.lege.com/proto.html. As of this writing, 18 Nov 1997, the following versions of sendmail are supported: sendmail-8.8.8, sendmail-8.8.7, sendmail-8.8.6, sendmail-8.8.5, sendmail-8.8.4 and sendmail-8.7.3. It is also highly recommended that you obtain http://www.lege.com/xaliases-2.0.tar.gz.bin for the xalparse and xaliases programs and configuration files.] Here's the previously hacked S93: S93 R$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed R$=E < @ $=M . > $@ $1 < @ $2 . > # don't masquerade for domains that are mentioned in xaliases (reverse aliases) ifdef(`_LIMITED_MASQUERADE_XALIASES_', `', `#')dnl R$=E < @ $=N . > $@ $1 < @ $2 . > probably xalias ifdef(`_LIMITED_MASQUERADE_', `#')dnl R$=E < @ $=w . > $@ $1 < @ $2 . > R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms # don't masquerade for domains that are mentioned in xaliases (reverse aliases) ifdef(`_LIMITED_MASQUERADE_XALIASES_', `', `#')dnl R$* < @ $=N . > $* $: $1 < @ $2 . @ $2 > $3 probably xalias ifdef(`_LIMITED_MASQUERADE_', `#')dnl R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3 R$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2 R$* < @ $+ @ > $* $@ $1 < @ $2 > $3 $M is null R$* < @ $+ @ $+ > $* $@ $1 < @ $3 . > $4 $M is not null My additions (from before, for virtual domains reverse aliasing) is these lines: # don't masquerade for domains that are mentioned in xaliases (reverse aliases) ifdef(`_LIMITED_MASQUERADE_XALIASES_', `', `#')dnl R$=E < @ $=N . > $@ $1 < @ $2 . > probably xalias and # don't masquerade for domains that are mentioned in xaliases (reverse aliases) ifdef(`_LIMITED_MASQUERADE_XALIASES_', `', `#')dnl R$* < @ $=N . > $* $: $1 < @ $2 . @ $2 > $3 probably xalias inserted above, look 2 see! __________________________________________________________________ Leif Erlingsson Tel +46 8 604-0995 DATA LEGE Fax +46 8 605-2551 Glavagatan 33 URL http://www.lege.com 123 71 Farsta, Sweden Email mailto:leif@lege.com __________________________________________________________________ I remember the past. I am not doomed to buy Microsoft products. Date: Fri, 17 Apr 1998 07:03:32 +0200 (MET DST) From: Leif Erlingsson To: James David Rich Cc: fetchmail-friends@ccil.org Subject: Detailed response Re: domainname on outgoing mail Let it first be said, to use the below advice you must have a sendmail configuration tree in place. It is distributed with every source-distribution of sendmail, so if you don't have it, get it -- e.g. from ftp://ftp.sendmail.org. On Thu, 16 Apr 1998, James David Rich wrote: > Hi everyone, > This isn't a problem with fetchmail (I think) but I believe that a lot > of people on this list are doing the same thing I'm trying to do so I > hope to find an answer. > I'm running a standalone host (linux 2.1.95) at home and use fetchmail > release 4.0.8 to get my email from my ISP. It works great and has been > for a long time, thanks to everyone's hard work. But many sites bounce > email I send to them because the domainname I have assigned to my host > is not a valid domainname. I did this because I just have a dynamic > dial-up connection to the internet. That means that email is sent out > (using pine) with the domainname I made up. I need to change this so > that the mail I send has the domainname of my email address so that > things don't bounce. I don't want to change the domainname I have > assigned to my host. I have sendmail 8.8.7. How can I do this? Envelope header masquerading. There is at least two HOWTO's/ Mini-HOWTO's that touch on this -- one specifically is about how to set up sendmail with a dynamic dial-up connection to the internet. If that doesn't help -- I assure you my setup works, and you can study it in on the URL http://www.lege.com/proto.html, if you download the "patch" for sendmail-8.8.8, this is the files: 76069 Nov 13 23:46 README 3014 Nov 13 23:47 README-patch-8.8.8 74740 Sep 23 17:42 README.orig 10570 Aug 16 22:24 cf/elijah.smtp.mc 130 Dec 13 1996 cf/make_elijah 120 Jun 27 1997 cf/make_ruth 38748 Jan 13 23:11 cf/obj/elijah.smtp.cf 14382 Jan 13 23:11 cf/obj/ruth.smtp.cf 4391 Aug 16 22:30 cf/ruth.smtp.mc 13962 Mar 18 1997 domain/elijah.m4 4099 Jul 30 01:14 domain/ruth.m4 1903 Jan 14 00:18 m4/patch-8.8.8-2.04-README 22 Jan 13 22:59 m4/proto-patch-8.8.8 -> \ proto-patch-8.8.8-2.04 12176 Nov 13 23:55 m4/proto-patch-8.8.8-2.03 12466 Jan 13 22:35 m4/proto-patch-8.8.8-2.04 39219 Jan 13 22:54 m4/proto.m4 38942 Nov 13 23:54 m4/proto.m4-2.03 31529 Aug 1 02:26 m4/proto.m4.orig 3484 Nov 14 00:03 ostype/linux.m4 1953 Apr 7 1997 ostype/linux.m4.orig 2006 Nov 14 00:03 ostype/linux.patch 1903 Jan 14 00:18 patch-8.8.8-2.04-README I call my computer "elijah", so check out all files with the "elijah" somewhere in it's name. "elijah" is not really in DNS, but pretends to be on "elijah.swip.net". The header masquerading says MASQUERADE_AS(`mailbox.swipnet.se')dnl in my case -- and as my mailbox name is Leif.Erlingsson@mailbox.swipnet.se I'd also have to "reverse alias" using my /etc/xaliases stuff (see same URL!). About the *ruth* files: This is a "null client" setup for second home PC. Since it has /home NFS-mounted on "elijah" it doesn't need to get any mail, just to be able to send out mail. About why my envelope says leif@lege.com and not Leif.Erlingsson@mailbox.swipnet.se the way I explained above: __________________________________________________________________ You may wonder why my MASQUERADE_AS(`mailbox.swipnet.se') domain and my Leif.Erlingsson@mailbox.swipnet.se xalias don't show up in my From address... That is because I am doing one more thing... On top of having MASQUERADE_AS(`mailbox.swipnet.se') configured in my domain/elijah.m4 file, I have something called _virtual domains_ configured. Not the way Eric Allman want's it to work, but the way I want it to work. That is part of what the patch above does. It patches Eric's proto.m4. Part of the patch is so that virtual domains work regardless if the domain is local or not. In my case, "LEGE.COM" is *not* a local domain with my home computer (and it is not even in class w at the site hosting LEGE.COM on the 'net), but I have still these /etc/virtuals and /etc/xaliases entries: /etc/virtuals: __________________________________________________________________ lege.com leif@elijah.swip.net leif@lege.com leif@elijah.swip.net __________________________________________________________________ /etc/xaliases: __________________________________________________________________ # Reverse Aliases: #leif@elijah.swip.net: