Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Postfix, dovecot, cron and empty envelope from
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3171

PostPosted: Wed Jan 10, 2024 8:16 pm    Post subject: Postfix, dovecot, cron and empty envelope from Reply with quote

Somewhere in December my pigeonhole sieves inside dovecot stopped properly handling cron's reports. I finally tried to figure out what's going on, and it turns out my sieves don't match sender address anymore because those email no longer have envelope from address.
Note: envelope from is not necessarily the same as the sender in the message. The latter is properly defined as "Cron.. yada yada" <root@machine>. Like in: the second part works.

Although I don't know which update broke the whole thing, after a few tests I'm fairly confident that postfix is the culprit here.
So, how do I force postfix it to set envelope from when forwarding mail from daemons, without overriding envelope from on mail incoming from the internet? I just need a pointer in the right direction; should be able to figure out the details once I know what to look for...
Back to top
View user's profile Send private message
acmondor
n00b
n00b


Joined: 08 Aug 2014
Posts: 59
Location: Canadian Prairies

PostPosted: Sun Jan 14, 2024 3:54 pm    Post subject: Reply with quote

Might you be using mail-mta/ssmtp?

I had a similar issue quite a while back and if memory serves me correctly it was due to a change in ssmtp. Specifically, the FromLineOverride setting in /etc/ssmtp.conf. It was no longer defaulting to YES, so I had to uncomment the following line:

#FromLineOverride=YES

Hope this helps.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3171

PostPosted: Sun Jan 14, 2024 4:20 pm    Post subject: Reply with quote

No, I use postfix. And I see ssmtp actually conflicts with postifx.
Also, mail delivery to dovecot goes via unix socket using lmtp, and emails from other sources do have envelope from set, so it's not like I my toys suddenly started to strip it.
Finally, I called on the power of git to find out if there were any changes to /etc recently, but found nothing even remotely relevant.
Back to top
View user's profile Send private message
acmondor
n00b
n00b


Joined: 08 Aug 2014
Posts: 59
Location: Canadian Prairies

PostPosted: Sun Jan 14, 2024 5:12 pm    Post subject: Reply with quote

Ok, sorry, I use postfix and dovecot as well, but only on my main mail server and other machines use ssmtp to get email over to it. Email from cron jobs on the mail server itself never had such an issue. My cron jobs are run by sys-process/cronie and that uses /usr/sbin/sendmail provided by postfix for sending email.
Back to top
View user's profile Send private message
nicop
n00b
n00b


Joined: 10 Apr 2014
Posts: 46

PostPosted: Mon Jan 15, 2024 12:29 am    Post subject: Reply with quote

This is the mechanism that has been hardcoded since 1.7.0 :
https://github.com/cronie-crond/cronie/commit/d5d7db6a42f8c3ae6f6bd1efc767ae3fe97f4734

We have to wait for the next version :
Quote:
Release 1.7.1

crond: Wait on finishing the job with -n option to check the exit status
crond: Do not set the return path to <> if non-default MAILFROM is set
/etc/sysconfig/crond and /etc/default/anacron files are optional
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3171

PostPosted: Mon Jan 15, 2024 12:52 pm    Post subject: Reply with quote

Huh.... That's interesting.

From https://github.com/cronie-crond/cronie/pull/118
pull-118 wrote:
our mail server admins keep complaining about vacation messages (e.g. from Microsoft Exchange) which cannot be delivered locally.
After investigating further we found out that these messages got sent as a reply to cron mails. The sender is often "root@some-hostname" which is not a working email address.

Well, on one hand it's nice to know that dev takes users' requests into consideration when working on his project. On the other hand, this PR solves the wrong problem in the wrong place.
I mean... It's a global, technical solution to a local social problem which could have been worked around by the complainer himself. Like, dude, just make your exchange swallow messages you know are going nowhere.

I'd risk a bet this PR is a result of corporation's non-standard change process. Someone figured it will be easier to convince a 3dr party project than the company advisors board.


BTW, it looks like after the new version reverts that regression, I will still have to go through my crontabs to set variables disabling the new behavior in cronie.
I'll need to think a bit what to do about it.
pull-118 wrote:
> Why do not you just use MAILFROM=<> in the crontab?
I would have to edit all crontabs on all systems
Back to top
View user's profile Send private message
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 1697

PostPosted: Fri Jan 19, 2024 9:33 am    Post subject: Reply with quote

See bug 922477.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3171

PostPosted: Sat Jan 20, 2024 3:13 pm    Post subject: Reply with quote

Thanks.
Alright, so, I updated cronie to 1.7.1-r1 and the problem with daemon explicitly setting an empty return-path is gone.
Still, on cronie's github it says that it will be set empty unless MAILFROM is explicitly set (it is not set on my system).

So, with the newest cronie in portage emails are sent correctly on my systems, even though according to upstream they shouldn't. Is current behavior permanently patched by gentoo devs, or did the authors completely back out of the idea of changing default behavior, or should I expect it to break again with the next version bump?
Back to top
View user's profile Send private message
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 1697

PostPosted: Sat Jan 20, 2024 3:53 pm    Post subject: Reply with quote

They reverted the change upstream after some discussion and we backported it. Are you sure you're looking at the latest GitHub issue? The one filed by Hanno in the bug I linked is clear I think.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3171

PostPosted: Sat Jan 20, 2024 7:54 pm    Post subject: Reply with quote

Ah, I think I understand it now. Basically, the default behavior was reverted, so it no longer breaks old installations, but it can easily be changed server-wide via env, so there is no need to modify crontabs for all users.
This is probably the best result possible. Kudos to Hanno for getting this sorted with upstream.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum