cronie-crond / cronie

Cronie cron daemon project
Other
467 stars 80 forks source link

MAILFROM option broken between 1.6.1 and 1.7.0 #166

Closed djsissom closed 10 months ago

djsissom commented 10 months ago

I'm using postfix to route outgoing email from a cronie crontab entry to an Apple iCloud+ SMTP server, which requires the FROM address to be on the approved list in order to send mail.

In my (root) crontab, I've set the appropriate MAILFROM address: MAILFROM='admin@example.com'

After updating cronie to 1.7.0, the journalctl entry for postfix after the cron job outputs shows: postfix/qmgr[887]: 1BC705E2030: from=<>, size=782, nrcpt=1 (queue active)

Downgrading cronie to 1.5.7 gives the expected result, and I receive the email: postfix/qmgr[887]: 0531D5E2030: from=<admin@example.com>, size=766, nrcpt=1 (queue active)

My other server is still running version 1.6.1, and that also is still working correctly, so the regression seems to have happened somewhere between 1.6.1 and 1.7.0.

Git-diffing the two commits, there seem to be a couple of places where "mailfrom" is touched between releases, notably in anacron/runjob.c and src/do_command.c.

t8m commented 10 months ago

Do you see this for both cron based and anacron based jobs or just for one of these?

t8m commented 10 months ago

Hmm... actually this was an intentional change from https://github.com/cronie-crond/cronie/pull/118

t8m commented 10 months ago

I assume we could make this optional.

djsissom commented 10 months ago

I get the reasoning behind #118, but if I'm understanding correctly what's happening on my end, now even explicitly setting MAILFROM to a valid address in the crontab results in outgoing mail being rejected from the relay because of the missing FROM header.

I should be able to downgrade to 1.5.7 for the time being until fixed.

The full postfix log when an email should be sent:

Nov 15 16:24:01 motoko postfix/pickup[6912]: 1BC705E2030: uid=0 from=<>

Nov 15 16:24:01 motoko postfix/cleanup[7142]: 1BC705E2030: message-id=<20231115222401.1BC705E2030@motoko.remote.example.com>

Nov 15 16:24:01 motoko postfix/qmgr[887]: 1BC705E2030: from=<>, size=782, nrcpt=1 (queue active)

Nov 15 16:24:03 motoko postfix/smtp[7144]: 1BC705E2030: to=<me@example.com>, relay=smtp.mail.me.com[17.42.251.41]:587, delay=2.1, delays=0.03/0.03/1/1, dsn=5.7.0, status=bounced (host smtp.mail.me.com[17.42.251.41] said: 550 5.7.0 From address is not one of your addresses (in reply to MAIL FROM command))

Nov 15 16:24:04 motoko postfix/qmgr[887]: 1BC705E2030: removed

t8m commented 10 months ago

Can you please try applying 3428028e6df0a1e9b2efa1cb52b2722f790d9741 4e8c767efb1bea03da465fee29641b65da1246eb c640f4f39e5c20995e960e4b954cd0574a96c028 to see if that works for you?

djsissom commented 10 months ago

Yes, perfect! That works for me as expected and makes the Apple servers happy again.

Thanks for the quick attention!

igxlin commented 8 months ago

Hi, may I know when there will be a release with this fix? As the MAILFROM doesn't work in 1.7.0, this fix is quite necessary. Thanks a lot.

t8m commented 8 months ago

I've done a new release now.

igxlin commented 8 months ago

Thank you! :tada: