Hello,

I have a problem with OpenSMTPD (version 6.8.0p2) on my Linux installation 
(Void Linux distribution).

OpenSMTPD seems to write times in UTC instead of my configured system time zone 
(Europe/Berlin).
Example header from a local delivered mail:

 From abc  Wed Sep 28 21:09:55 2022  
 Return-Path: <webmas...@yourdomain.com>  
 Delivered-To: abc@localhost  
 Received: from localhost (xyz.localdomain [local])  
         by xyz.localdomain (OpenSMTPD) with ESMTPA id 020e7525  
         for <abc@localhost>;  
         Wed, 28 Sep 2022 19:09:55 +0000 (UTC)  
 Date: Wed, 28 Sep 2022 21:09:55 +0200 (CEST)  
 To: abc@localhost  
 From: webmas...@yourdomain.com  
 Subject: Test Email  
 Message-ID: <b4b222b031806af8@xyz.localdomain>  

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):

 2022-09-28T19:09:10.78118 mail.info: Sep 28 21:09:10 smtpd[2699]: info: 
OpenSMTPD 6.8.0p2 starting
 2022-09-28T19:09:55.62957 mail.info: Sep 28 21:09:55 smtpd[2703]: 
b4b222afa5939ddc smtp connected address=local host=xyz.localdomain
 2022-09-28T19:09:55.63338 mail.info: Sep 28 19:09:55 smtpd[2703]: 
b4b222afa5939ddc smtp message msgid=020e7525 size=389 nrcpt=1 proto=ESMTP
 2022-09-28T19:09:55.63342 mail.info: Sep 28 19:09:55 smtpd[2703]: 
b4b222afa5939ddc smtp envelope evpid=020e752572255a45 
from=<webmas...@yourdomain.com> to=<abc@localhost>
 2022-09-28T19:09:55.63347 mail.info: Sep 28 19:09:55 smtpd[2703]: 
b4b222afa5939ddc smtp disconnected reason=quit
 2022-09-28T19:09:57.64998 mail.info: Sep 28 19:09:57 smtpd[2703]: 
b4b222b1cbdebff4 mda delivery evpid=020e752572255a45 
from=<webmas...@yourdomain.com> to=<abc@localhost> rcpt=<abc@localhost> 
user=abc delay=2s result=Ok stat=Delivered
 2022-09-28T19:11:20.45865 mail.info: Sep 28 21:11:20 smtpd[2699]: Exiting

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.

I suppose that the problem appears due to the privdrop to the _smtpd or the 
_smtpq user. Do you have any hints where to search further for the cause? 
Obviously when the C function "localtime" is called, the time is not returned 
in the systems time zone.

The problem is probably Void Linux specific, since I don't have this problem on 
a OpenBSD installation.


Thanks in advance,
Nils

P.S.: This is a cross-post of 
https://github.com/void-linux/void-packages/issues/39918

Reply via email to