From owner-freebsd-questions@FreeBSD.ORG Mon Nov 14 15:00:28 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9011616A426 for ; Mon, 14 Nov 2005 15:00:28 +0000 (GMT) (envelope-from nalists@scls.lib.wi.us) Received: from mail.scls.lib.wi.us (mail.scls.lib.wi.us [198.150.40.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id D647443D6E for ; Mon, 14 Nov 2005 15:00:09 +0000 (GMT) (envelope-from nalists@scls.lib.wi.us) Received: from [172.26.2.238] ([172.26.2.238]) by mail.scls.lib.wi.us (8.12.9p2/8.12.9) with ESMTP id jAEF08G1013956; Mon, 14 Nov 2005 09:00:08 -0600 (CST) (envelope-from nalists@scls.lib.wi.us) Message-ID: <4378A678.8040400@scls.lib.wi.us> Date: Mon, 14 Nov 2005 09:00:08 -0600 From: Greg Barniskis User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Hans Nieser References: <43789742.4070804@nieser.net> In-Reply-To: <43789742.4070804@nieser.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: How to redirect mail sent to root to external mailbox? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Nov 2005 15:00:28 -0000 Hans Nieser wrote: > 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! Mail originating from the root account is usually not masqueraded. In sendmailese, root is "Class E", so your sendmail.cf probably shows "CE root". You can probably override this by putting an appropriate entry in your .mc file and then making a new config file from it, but offhand I don't know what mc syntax you'd use. Your bounces get masqueraded because the outside envelope is not "From root" anymore, it is From your mailer daemon. -- Greg Barniskis, Computer Systems Integrator South Central Library System (SCLS) Library Interchange Network (LINK) , (608) 266-6348