Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#898177: cron doesn't support MAILFROM

311 views
Skip to first unread message

Laurent Combe

unread,
May 8, 2018, 6:40:03 AM5/8/18
to
Package: cron
Version: 3.0pl1-128+deb9u1

Debian/Ubuntu's cron version doesn't support setting MAILFROM to set the "From:" header of cron generated emails. This feature would be nice to have and bring parity with RHEL/CentOS which has it since RHEL 6:

$ cat /etc/redhat-release CentOS release 6.6 (Final)

$ man 5 crontab | grep -1 FROM doesn´t do aliasing, and UUCP usually doesn´t read its mail. If MAIL-
FROM is defined (and non-empty), it will be used as the envelope sender
address, otherwise, ‘‘root’’ will be used.

This bug was created first under ubuntu launchpad, but as the package is maintained in Debian project i open this bug issue.
for Ubuntu the report and comments is here:
https://bugs.launchpad.net/ubuntu/+source/cron/+bug/1750051
a patch has been submitted too
https://launchpadlibrarian.net/369246026/patch_v2.txt
this patch is heavily inspired by the cronie project
https://github.com/cronie-crond/cronie/blob/master/src/do_command.c


Tomas Pospisek

unread,
Feb 16, 2021, 6:20:03 AM2/16/21
to
Hi all,

configuring a Debian system so that cron emails get correctly sent
seems like *major rocket science*. There are innumerable postings on the
internet wondering how to set up the system to receive cron's emails. I
spent this whole morning trying to figure it out.

A major problem is that cron is sending email as "root (Cron Daemon)". Of
course many a MTA will - IMO correctly - refuse an email with such a
sender. One can try to set /etc/mailname as is suggested in many places on
the internet, but Debian's cron will ignore that setting...

So the local sendmail needs to come to the rescue and start replacing and
correcting the sender (and the recipient) that cron gives them with
something that makes sense for the receiving end. Unless the local MTA
is not feature richt enough to be able to do it, such as my local sendmail
which is msmtp, but other small local sendmails have similar pains
(nullmailer, dragonmailer, etc. - I did not check them all) and so
still, mails from cron end up in /dev/null.

Unless it *would* be possible to correctly set the sender (MAILTO) and the
receiver (MAILFROM) in cron itself. Which actually many cron daemons
are capable of. And which is the advice in many a helpful HOWTOs and
stackoverflow answers ... except that Debian's cron doesn't support
MAILFROM.

Until now that is. Maybe. I hope.

So that was the long rant and rationale and the plea to please allow to
set MAILFROM in Debian's cron.

I think Laurent Combe's patch fixes that nicely (it's missing the mailfrom
variable declaration, but that's fixed below). So without more ado,
please, please, pretty please add MAILFROM to cron. The attached patch
should do. I am successfully running cron with that patch here.

You should only need to tweak the changelog entry Christian and that
should be it.

Thanks a lot for keeping cron going Christian, and Javier in the past and
Laurent for the patch and cronie for blasting the path. Greetings,
*t
interdiff.patch

Tomas Pospisek

unread,
Feb 16, 2021, 9:10:03 AM2/16/21
to
Related feature request: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929959
aka "please support /etc/mailname".

Laurent Combe

unread,
Feb 21, 2021, 10:00:03 AM2/21/21
to
near 3 years i report this issue
i joined a patch
and after all that time nothing, not even a "confirmed" tag.

very disappointing. What can I do to help this issue be accepted more quickly ?

Tomas Pospisek

unread,
Feb 22, 2021, 4:20:04 PM2/22/21
to
Hi Laurent,

let me start by saying the gentlemen above are probably working on cron in
their free time. They do not owe anybody anything. So I think you can be
disapointed, but saying so will probably not have a positive impact. Maybe
it will on the contrary drain them.

That said, thanks for your offer for help.

I want to explore a bit how you (or I?) could help. After I've seen
your email I visited the package page:

https://packages.debian.org/search?keywords=cron

and I've noticed, that the `cron` in experimental is in fact `cronie`
(coming from RH/Fedora) which reminded that the plan was to replace cron
in Debian with cronie, since cron is not maintained upstream any more. You
can read about it here:

https://wiki.debian.org/cron

So I think the following things would be helpful:

* port features that Debian's cron has, but cronie is missing from
cron to cronie. Since both Debian's cron and cronie are forks of the
original cron, the should be somewhat compatible. Also Debian cron has
now split off its diff from the original cron into patches under
debian/patches. So the theory would be that you can take one patch after
the other, see what feature it implements and port it over to cronie.

Once the port is done you could submit that patch upstream with the
accompanying rationale that this feature is needed for Debian in order
to be able to migrate to cronie.

Also you could fork Debian's cronie repo and submin pull requests, so
Debian can integrate the missing features into cronie.

* you could install cronie on your systems and see what's missing or if
its working how it should and submit error or success reports to the
Samba repo (I guess).

* you could go through cron's bugs page

https://bugs.debian.org/cron

and see which of those bugs is fixed in cronie and comment inside the
bug. Maybe the maintainers would like to add a tag
"implemented-in-cronie" or such, so that they can see at a glance, which
bugs would be automatically closed by cronie.

What do you think?
*t

Tomas Pospisek

unread,
Feb 22, 2021, 4:30:03 PM2/22/21
to
Greets all.

I've added those suggestions to the cron wiki page
(https://wiki.debian.org/cron) in the hope that people that would like to
help to move cron in Debian move forward can jump in and do things that
are possible and useful.

I hope that's fine with you guys!
*t

Christian Kastner

unread,
Feb 22, 2021, 5:00:03 PM2/22/21
to
Hi all,
I can't speak for Javier, but in the meantime, I myself have mostly
given up on cron, in the sense that I consider systemd timers a superior
solution.

I think we can integrate this patch still in time for bullseye, it's
small enough.

However, it is missing a crucial feature: the validation of the contents
of MAILFROM, just as MAILTO is validated. This is a security issue, as
the contents of this variable are passed to /usr/bin/sendmail, and it
shouldn't contain eg: options to modify the latter's working.

The cronie code has a safe_p function to validate this; it is more
sophisticated than our own function. I'll import that.

Best,
Christian

Tomas Pospisek

unread,
Feb 23, 2021, 3:10:02 AM2/23/21
to
On Mon, 22 Feb 2021, Christian Kastner wrote:

> On 21.02.21 15:46, Laurent Combe wrote:
>> near 3 years i report this issue
>> i joined a patch
>> and after all that time nothing, not even a "confirmed" tag.
>>
>> very disappointing. What can I do to help this issue be accepted more quickly ?
>
> I can't speak for Javier, but in the meantime, I myself have mostly
> given up on cron, in the sense that I consider systemd timers a superior
> solution.

Oh, this is news indeed. I think Javier hasn't been working on for the
last 3 years [1]? So I'd say you Christian have been cron's defacto
maintainer?

So if the plan to migrate Debian's cron to cronie has been abandoned (by
you) and instead the plan is to drop cron and instead use systemd timers
as the default "cron" mechanism in Debian then I think this defacto
decision should be communicated clearly.

As you might have seen I have added some suggestions on how people could
help with the migration from cron to cronie on cron's Debian wiki page
[2]. If the plan to migrate to cronie has been abandoned then such
initiatives do not make sense any more...?

It'd be very nice if you Christian and Javier could clarify the situation.

Greetings & thanks for your work on cron!
*t

[1] https://metadata.ftp-master.debian.org/changelogs//main/c/cron/cron_3.0pl1-137_changelog
[2] https://wiki.debian.org/cron?action=diff&rev1=9&rev2=10

Christian Kastner

unread,
Feb 23, 2021, 2:20:03 PM2/23/21
to
On 2021-02-23 09:03, Tomas Pospisek wrote:
> On Mon, 22 Feb 2021, Christian Kastner wrote:
> Oh, this is news indeed. I think Javier hasn't been working on for the
> last 3 years [1]? So I'd say you Christian have been cron's defacto
> maintainer?

While possibly so, I must note that effective with the last upload, I
have removed myself from the Uploaders field, and therefore no longer am
a cron maintainer.

> So if the plan to migrate Debian's cron to cronie has been abandoned
> (by you) and instead the plan is to drop cron and instead use systemd
> timers as the default "cron" mechanism in Debian then I think this
> defacto decision should be communicated clearly.

The default "cron" mechanism in Debian will continue to be, well, cron.
This is defined by the Debian Policy, and hence would need a Policy
change, which almost certainly won't happen fast, and without
discussion.

The switch to systemd timers is just something that I have observed in
practice. Packages shipping both timers and crontabs, with the latter
being no-ops when systemd is detected. I, personally, believe that this
is the right practice.

The switch to cronie as default "cron" is indeed something that I
possibly could have effected alone (as it doesn't require a Policy
change), but recently abandoned.

> As you might have seen I have added some suggestions on how people
> could help with the migration from cron to cronie on cron's Debian
> wiki page [2]. If the plan to migrate to cronie has been abandoned
> then such initiatives do not make sense any more...?

I think those suggestions are still spot on, and I believe migrating
from cron to cronie is still the right thing to do.

I'm just the wrong person for driving this :-) In the meantime, I have
become fully occupied with other projects within Debian, and simply
cannot drive this effort, or continue to be a maintainer at all.

However, if anyone else wants to take over the effort, and I can help as
a mentor and/or upload sponsor, feel free to do so. I have filed an RFA
for cronie a while ago (#974038) and have received pings from some
interested parties, but no results yet.

My plans for cronie were probably too big anyway: instead of carrying
over all of our features, perhaps it would be better to stick with
standard "upstream" cronie instead, and to focus on making the switching
process as easy as possible. If anyone wants to try this, feel free to
contact me any time.

Best,
Christian

Tomas Pospisek

unread,
Feb 25, 2021, 7:00:03 AM2/25/21
to
Javier,

seeing that you do not seem to have been working on cron for a few years
would it be OK with you if I posted something along these lines to
debian-devel:

Request for adoption/request for help: cron

cron's recently active maintainer has removed himself from its
uploaders. So there is currently no active maintainer of cron. It
would be good if cron was actively maintaned. Helping hands or
somebody taking the lead as a cron maintainer would be very welcome!

signed: tpo with Javier's OK

?

Thanks & greetings,
*t

Javier Fernandez-Sanguino

unread,
Feb 26, 2021, 12:30:03 PM2/26/21
to
Dear Tomas,


El jue., 25 feb. 2021 12:52, Tomas Pospisek <tpo...@sourcepole.ch> escribió:
Javier,

seeing that you do not seem to have been working on cron for a few years
would it be OK with you if I posted something along these lines to
debian-devel:


I can send a message along the lines of your proposal below to d-d. Will schedule it to do it soon.

Best regards

Javier

Tomas Pospisek

unread,
Feb 28, 2021, 5:30:03 AM2/28/21
to
:+1 thanks Javier!

Tomas Pospisek

unread,
Mar 12, 2021, 3:40:03 AM3/12/21
to
On Fri, 26 Feb 2021, Javier Fernandez-Sanguino wrote:

https://bugs.debian.org/984736

Thanks Javier!
*t
0 new messages