Date: Mon, 14 Nov 2005 07:40:50 -0700 From: "Mark J. Sommer" <msommer@argotsoft.com> To: "'Hans Nieser'" <hans@nieser.net>, <freebsd-questions@freebsd.org> Subject: RE: How to redirect mail sent to root to external mailbox? Message-ID: <200511141440.jAEEeq6C064503@argotsoft.com> In-Reply-To: <43789742.4070804@nieser.net>
next in thread | previous in thread | raw e-mail | index | archive | help
> -----Original Message----- > From: owner-freebsd-questions@freebsd.org > [mailto:owner-freebsd-questions@freebsd.org] On Behalf Of Hans Nieser > Sent: Monday, November 14, 2005 6:55 AM > To: freebsd-questions@freebsd.org > Subject: How to redirect mail sent to root to external mailbox? > > Hi list, > > I operate several servers, one of which is at home, behind > NAT. The local network is configured to use the domainname > "nieser.local.", which obviously only exists on the local > (forwarding) nameserver. > > To be able to send e-mail from this machine (which would > normally be rejected by any MTA because of the non-existent > 'from' domainname ) I have configured sendmail to masquerade > e-mail sent from the "royen.nieser.local" machine as > "royen.nieser.net" which resolves to the external IP adress > of the DSL gateway device (which has smtp forwarded to the > royen.nieser.local machine). > > The above setup *mostly* (see below) works, e-mail that I > send from the server has it's "royen.nieser.local" hostname > properly substituted with "royen.nieser.net"). > > Now, to make monitoring all the servers I operate easier, I > wanted to forward all mail sent to root (including the > periodic output), by putting > "root: h.nieser@xs4all.nl" in the /etc/mail/aliases file, as > the comments in this file suggested: > > # Pretty much everything else in this file points to "root", > so # you would do well in either reading root's mailbox or > forwarding # root's email from here. > > But here's the weird thing, the periodic mail doesn't get > masqueraded and > therefore gets rejected by the remote MTA. The "rejected" > message which > gets sent back to the root account, however, *does* get > masqueraded properly and subsequently forwarded to the e-mail > I specified in the /etc/mail/aliases file! > > Also, when I ssh to the royen machine and type "periodic > daily" on the commandline, the mail it generates DOES get > masqueraded correctly... > What's going on here? I'm having a real hard time getting my > head around this because of all the redirecting and > forwarding and perhaps lack of in-depth knowledge of > smtp/sendmail... I have my sendmail configuration attached > (also mirrored at http://nieser.net/files/sendmail/1/ ). > > I'd rather keep the nieser.local/nieser.net domainnames > seperate and use masquerading because the whole NAT setup is > confusing enough for me as it is, having the same domainname > resolve to different adresses for the LAN and the Internet > would probably drive me mad. > > Can anyone assist? > > PS: The domainnames used in my problem description above may > not actually resolve as I've tried to simplify my problem by > using more logical names. This is really a sendmail question I believe. Your problem is probably because root doesn't get masqueraded. In your sendmail.cf, is there a line like the following: CEroot or C{E}root If so, comment it out and restart sendmail.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511141440.jAEEeq6C064503>