Sendmail Masqurading and root mails
Danny Carroll
fbsd at dannysplace.net
Mon Aug 3 02:01:42 UTC 2009
I have a situation that I've come across from time to time that I have
never found a good fix for.
Sometimes I'll install a freebsd box at a site with private addresses
(RFC 1918). Most of the time these sites also have local DNS setups.
I'll take my home network as an example. My FreeBSD box (7.2) does:
- File serving
- PPP/Routing/NATd for the local network
- WWW
- Local DNS
Nothing special.
The network is a 192.168 network and the local domain is .lan
The problem is when I try to forward periodic output to my real email
address. My email box see's the EHLO from beastie.lan and rejects the
message based on the fact that root at beastie.lan is an unroutable address.
There are a few solutions I've used in the past.
- Replace sendmail with exim and configure the SMTP domain.
- Put beastie.lan in my email servers hosts file.
Neither of these are what I am looking for. I'd like to make sendmail
re-write all outgoing emails (envelope as well as message) as
*@some.real.domain instead of *@beastie.lan.
I have a simple sendmail submit setup. (sendmail=no in rc.conf)
I've added the following to the default sendmail mc file:
MASQUERADE_AS(`mypublicdomain.com')dnl
FEATURE(masquerade_envelope)dnl
MASQUERADE_DOMAIN(beasie.lan)dnl
Recompiled the cf files and restarted sendmail.
Here is the kicker. If I log in as a normal user it masquerades just
fine.
If I simply "su -" to root, the masquerading works fine and the mail is
sent as the original logged in user.
But if I log in as root via the console then it does not alter the messages.
Apart from ditching sendmail for another MTA, does anyone know how I
might coerce sendmail into rewriting root's messages as well?
More information about the freebsd-questions
mailing list