Re: cron output direct to mbox without smtpd?

2019-11-24 Thread chohag
Andrew Kanaber writes:
> Hi,
>
> I'm setting up an embedded machine that won't be able to send mail to
> the internet and it seems excessive to leave smtpd running just so root
> can receive cron job output, but I can't see a way to cut smtpd out of
> the delivery chain because mail.local doesn't implement sendmail-style
> command-line options (in particular it doesn't have the -t option to
> extract the recipient from the message headers) so I can't use it in
> place of smtpctl in /etc/mailer.conf.

It may seem that way but consider: in order to write to the file a
sequence is going to be followed by whatever cron kicks off which
is incredibly similar to that which is already being done by smtpd,
only it's one you're going to have to write and manage yourself
instead of being "just there" from day one and kept up to date by
a bunch of developers who weirdly want to just produce safe, stable
code for free. Why balk?

> Is there some other way to do this? Is there a reason I've missed that
> this is actually just a bad idea?

I recommend doing nothing; that way this problem will solve itself
by virtue of having already been solved and you can do something
interesting, ie. literally anything other than email. Do you really
need the extra few bytes of memory that a dud process takes up?

Matthew



Re: cron output direct to mbox without smtpd?

2019-11-24 Thread gilles
November 24, 2019 4:34 PM, "Andrew Kanaber"  
wrote:

> Hi,
> 
> I'm setting up an embedded machine that won't be able to send mail to
> the internet and it seems excessive to leave smtpd running just so root
> can receive cron job output, but I can't see a way to cut smtpd out of
> the delivery chain because mail.local doesn't implement sendmail-style
> command-line options (in particular it doesn't have the -t option to
> extract the recipient from the message headers) so I can't use it in
> place of smtpctl in /etc/mailer.conf.
> 
> I could probably get cron to mail.local delivery working by editing and
> recompiling cron to change the popen arguments but that seems like more
> trouble than it's worth in the long run.
> 

or simpler, you can write a wrapper to mail.local and use that wrapper in
the mailwrapper config, but bear in mind that mail.local requires root as
it writes to /var/mail, so your wrapper must either be restricted to root
crontab or be setuid with all that implies.


> Is there some other way to do this? Is there a reason I've missed that
> this is actually just a bad idea?
> 

I'd use a wrapper... but I'd also leave smtpd because it's idle when not
in work so the cost of running it vs hacking a work-around is not too in
favor of the work-around as far as I'm concerned.



cron output direct to mbox without smtpd?

2019-11-24 Thread Andrew Kanaber
Hi,

I'm setting up an embedded machine that won't be able to send mail to
the internet and it seems excessive to leave smtpd running just so root
can receive cron job output, but I can't see a way to cut smtpd out of
the delivery chain because mail.local doesn't implement sendmail-style
command-line options (in particular it doesn't have the -t option to
extract the recipient from the message headers) so I can't use it in
place of smtpctl in /etc/mailer.conf.

I could probably get cron to mail.local delivery working by editing and
recompiling cron to change the popen arguments but that seems like more
trouble than it's worth in the long run.

Is there some other way to do this? Is there a reason I've missed that
this is actually just a bad idea?

Thanks for your help,

-- 
Andrew Kanaber