-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opensmtpd: Does not respect the system time zone in mail header and logfile #39918
Comments
I mostly use sendmail, but I have a few opensmtp installs and will look for 3. |
There doesn't seem to be any SHOULD or MUST for the Received header being any particular timezone. The only MUSTard is a gateway MUST NOT alter Received headers from other systems. https://www.rfc-editor.org/rfc/rfc2821#section-3.8.2 |
Date fields, including Received header, SHOULD use local time expressed as offset from UTC (not TZ abbreviation). https://www.rfc-editor.org/rfc/rfc2822#section-3.3 If localtime is UTC, they SHOULD use +0000. If defaulting to UTC because localtime is unknown - they SHOULD use -0000. Your example uses +0000. Also, your log example uses the same TZ from the logging system and from opensmtpd - suggesting that they both use the same config. That sounds to me like you have the system configured to UTC, and have only configured a personal preference somewhere as CEST. The Date header is normally generated by the email client, not opensmtpd. |
I checked OpenSMTPd installs on Fedora, and it also uses +0000 for Received Header fields that it adds. I have no objection to using UTC - it fits the purpose of Received for tracing. However, the RFC recommends using -0000 to indicate when that is not actually the local time zone. |
Thanks a lot for your investigations. Yes, the Date header isn't from OpenSMTPd, and the Date header is not the problem because it shows local times. The logging system (socklog) shows the time stamps in UTC, yes. But the time stamps from the processes in the logs use local time. In my example logfile above you can see that when OpenSMTPd starts (PID 2699) it logs correctly with local time, but when processing the mail within a forked process (PID 2703) it jumps to UTC. When stopping the process (PID 2699) it then jumps back to local time. I don't think that this behaviour is intended or that OpenSMTPd uses generally UTC times in headers. Two reasons for that:
So the variable
Regarding my system config for the time zone: It is set to CET/CEST, because Is your Fedora installation configured to use UTC as time zone? If no, then that would indicate that the problem is not Void specific, but Linux specific... A configuration option for the time stamps does not exist - at least not a documented one. My suspicion is still that the problem has to do with the fork resp. privilege drop to the _smtpd or _smtpq user. Somehow the configured system time zone disappears then. |
I've this problem on Gentoo Linux also, do you have filed an upstream bug? |
After a short break of several months :-) I picked up this issue again. I think I found the reason for the behaviour and a suitable workaround. The chroot'ed processes can't access If So the workaround is as simple as setting
And the corresponding entry in |
Is this a new report?
Yes
System Info
Void 4.9.261_1 x86_64 glibc
Package(s) Affected
opensmtpd-6.8.0p2_4
Does a report exist for this bug with the project's home (upstream) and/or another distro?
No response
Expected behaviour
In the headers of the tranferred mail and in the logfiles the MTA should use times with the time zone which was set up for this system.
Actual behaviour
OpenSMTPD seems to write times in UTC instead of my system time zone (Europe/Berlin, actually UTC+2).
Example header from a local delivered mail:
In the "Date" header the local time in the correct time zone is used. In the "Received" header which is added by OpenSMTPD the time is stated in UTC, regardless of the time zone of the system.
The same problem exists for the log file (/var/log/socklog/mail/current):
When the OpenSMTPD process starts it logs with the local time (21:09:10). When processing mails it changes over to UTC (19:09:55). And when it exits it uses local time again (21:11:20). I don't think that this behaviour is intended.
Maybe the _smtpd or the _smtpq user to which OpenSMTPD drops privileges is not able to read the setted up time zone? Therefore this problem is maybe Void specific, since I haven't found any bug reports from other distributions or from OpenBSD regarding this.
Steps to reproduce
/var/log/socklog/mail/current
for the logged timesThe text was updated successfully, but these errors were encountered: