Managing cron and similar E-Mails from headless systems

Robert Heller heller at deepsoft.com
Fri Feb 17 21:11:50 UTC 2017


At Fri, 17 Feb 2017 18:13:10 +0000 "Ubuntu user technical support,  not for general discussions" <ubuntu-users at lists.ubuntu.com> wrote:

> 
> On Fri, Feb 17, 2017 at 01:06:13PM -0500, Robert Heller wrote:
> > At Fri, 17 Feb 2017 11:00:16 -0500 "Ubuntu user technical support, not 
> > for general discussions" <ubuntu-users at lists.ubuntu.com> wrote: 
> > 
> > > 
> > > On Friday 17 February 2017 06:14:01 Chris Green wrote:
> > > 
> > > > I have several headless systems doing useful work around the place:-
> > > >
> > > >     A Raspberry Pi providing local DNS and DHCP
> > > >
> > > >     A Beaglebone Black on our boat monitoring temperatures and
> > > > batteries
> > > >
> > > >     An old desktop doing backups in the garage
> > > >
> > > >     etc.
> > > >
> > > >
> > > > Most of these have one or more cron jobs running periodic rsync
> > > > backups, copying data, etc.  If the cron job has an error then it
> > > > sends E-Mail to the owner of the job ('chris' in most cases, might be
> > > > root in a couple).
> > > >
> > > > It's (moderately) easy to set up an MTA and /etc/aliases so that the
> > > > messages are sent to my normal E-Mail.  However I can't come up with a
> > > > straightforward way of indicating where the messsage is *from*.
> > > >
> > > > You can't just invent a domain name for the headless system because
> > > > that gets the E-Mail rejected by intermediate systems that try and
> > > > look up the sender host name.  Cron doesn't seem to have any mechanism
> > > > for setting the sender's name, cron errors just come from 'root@'.
> > > >
> > > > Can anyone suggest a neat way of handling this so that I know where
> > > > the errors are coming from?
> > > >
> > > > --
> > > > Chris Green
> > > 
> > > A hosts file based home network should suffice to fix that. I did have it 
> > 
> > The OP is already running a DNS server, so he really does not need to bother 
> > with a hosts file.
> > 
> > I expect the problem is that he is sending these E-Mails off the local LAN to 
> > some E-Mail address "in the cloud" and spam filters are going to reject them 
> > because the From: header will be wonky (like root at rpi3.my.local.domain).
> > 
> That's exactly the problem.  
> 
> > What he needs to do is set up a "gateway" system -- one of the machines on the
> > LAN needs to be set up as an outbound SMTP server for the LAN and needs to
> > Masqurade the addresses (eg rewrite the From: header) to something sane, like
> > his personal E-Mail address and add an X-Orig-From: headr line with the
> > original From: header. Or else set up a procmail recipe (on of the machines on
> > the LAN) that forwards the messages from his personal address.
> > 
> The headless computers which send the messages are not all on one LAN,
> one is just connected via a marina WiFi link.

OK, the ones on the main LAN can use a Masqurading outbound SMTP server. The
"oddball" headless computer connected via a marina WiFi link, is going to have
to be its own Masqurading outbound SMTP server. It should something
simple/stupid: redirect root to some local user that has a procmail recipe
that fiddles the "From:" header (or just forwards the message and inserts a
"spoofed" From: header (containing a legit E-Mail address).  If they are all 
one-of's, then they all need to do something like use procmail to fiddle the 
messages.

> 

-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller at deepsoft.com       -- Webhosting Services
                                                                     



More information about the ubuntu-users mailing list