Mailq timestamps in localtime rather than UTC

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Mailq timestamps in localtime rather than UTC

PeterDaem
Hi,

my Postfix 3.1.12 mailq command is showing timestamps in UTC... is it possible to have them in localtime?


It is not chrooted and /etc/localtime is correct.

Thanks!

Pete.
Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

Wietse Venema
Pedro David Marco:
> Hi,
> my Postfix 3.1.12 mailq command is showing timestamps in UTC... is it possible to have them in localtime?
>
> It is not chrooted and /etc/localtime is correct.

What is the output from:

date ; env - date

I'm asking this, because the date conversion happens in the postqueue
program, which has no chroot option as it is not configured in
master.cf.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

PeterDaem
Thanks Wietse..

The  output is this:  

# date ; env - date
Wed Oct 23 21:22:20 CEST 2019
Wed Oct 23 21:22:20 CEST 2019
#

It is actual valid localtime... 

Thanks again,

Pedro.

On Wednesday, October 23, 2019, 3:56:51 PM GMT+2, Wietse Venema <[hidden email]> wrote:


Pedro David Marco:

> Hi,
> my Postfix 3.1.12 mailq command is showing timestamps in UTC... is it possible to have them in localtime?
>
> It is not chrooted and /etc/localtime is correct.


What is the output from:

date ; env - date

I'm asking this, because the date conversion happens in the postqueue
program, which has no chroot option as it is not configured in
master.cf.

    Wietse

Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

Wietse Venema
Pedro David Marco:
>  Thanks Wietse..
> The? output is this:??
> # date ; env - dateWed Oct 23 21:22:20 CEST 2019Wed Oct 23 21:22:20 CEST 2019#
> It is actual valid localtime...?
> Thanks again,
> Pedro.

Can you run this AS A NON-ROOT USER? On the same machine that runs
Postfix?

The Postfix mailq command calls the postqueue command, which deletes
most of its environment (similar to "env -") before calling the
same standard library time conversion functions that are also used
by the date command.

I suspect the discreoancy is caused by environment or permission
errors.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

PeterDaem
Thanks Wietse,

Normal user:

$ date; env - date
Thu Oct 24 10:56:11 CEST 2019
Thu Oct 24 10:56:11 CEST 2019
$

Postfix user:

$ date; env - date
Thu Oct 24 10:56:13 CEST 2019
Thu Oct 24 10:56:13 CEST 2019
$

I guess Postfix is taking just EPOCH time whitout considering localization...  so i agree with you that most lilkely Postfix cannot read some file somewhere... but i have checked files permisisons and i have not any clue.. there are no errors in Posfrix log.

Thanks again,

Pedro.


On Wednesday, October 23, 2019, 10:43:49 PM GMT+2, Wietse Venema <[hidden email]> wrote:


Pedro David Marco:
>  Thanks Wietse..
> The? output is this:??
> # date ; env - dateWed Oct 23 21:22:20 CEST 2019Wed Oct 23 21:22:20 CEST 2019#
> It is actual valid localtime...?
> Thanks again,
> Pedro.

Can you run this AS A NON-ROOT USER? On the same machine that runs
Postfix?

The Postfix mailq command calls the postqueue command, which deletes
most of its environment (similar to "env -") before calling the
same standard library time conversion functions that are also used
by the date command.

I suspect the discreoancy is caused by environment or permission
errors.


    Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

Wietse Venema
Pedro David Marco:
>  Thanks Wietse,
> Normal user:
> $ date; env - dateThu Oct 24 10:56:11 CEST 2019Thu Oct 24 10:56:11 CEST 2019$
> Postfix user:
> $ date; env - dateThu Oct 24 10:56:13 CEST 2019Thu Oct 24 10:56:13 CEST 2019$
> I guess Postfix is taking just EPOCH time whitout considering localization...? so i agree with you that most lilkely Postfix cannot read some file somewhere... but i have checked files permisisons and i have not any clue.. there are no errors in Posfrix log.
> Thanks again,
> Pedro.

Postfix does not convert time. Instead, that happens in the system
library.

Postfix does not open time configuration files. Instead, that happens
in the system library.

Unfortunately, the system library asctime() and localtime() functions
return no error indication. Postfix can't report errors that it is
not told about.

Try running "strace postquueue -p" as root. Maybe that will reveal
file open errors. Perhaps a bad SeLinux policy.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

Matus UHLAR - fantomas
In reply to this post by PeterDaem
On 24.10.19 09:05, Pedro David Marco wrote:
>Normal user:
>$ date; env - dateThu Oct 24 10:56:11 CEST 2019Thu Oct 24 10:56:11 CEST 2019$
>Postfix user:
>$ date; env - dateThu Oct 24 10:56:13 CEST 2019Thu Oct 24 10:56:13 CEST 2019$
>I guess Postfix is taking just EPOCH time whitout considering localization...  so i agree with you that most lilkely Postfix cannot read some file somewhere... but i have checked files permisisons and i have not any clue.. there are no errors in Posfrix log.

CEST is localised time. UTC time would be shown as UTC, try "date -u"
apparently your time is set wrong.

--
Matus UHLAR - fantomas, [hidden email] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton
Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

PeterDaem
Thanks Matus...

date -u shows correct UTC time.

Monitoring mailq with strace i have seen it always reads the file /usr/share/zoneinfo/UTC  but "date" and "env - date"  commads read the file "/etc/localtime" (shown by strace)

So it seems that  mailq always shows UTC time despite system localtime, while other postfix elements, like headers added to the email, use localtime (CEST in my case)...


Thanks...

Pedro.



On Thursday, October 24, 2019, 2:21:34 PM GMT+2, Matus UHLAR - fantomas <[hidden email]> wrote:


On 24.10.19 09:05, Pedro David Marco wrote:

>Normal user:
>$ date; env - dateThu Oct 24 10:56:11 CEST 2019Thu Oct 24 10:56:11 CEST 2019$
>Postfix user:
>$ date; env - dateThu Oct 24 10:56:13 CEST 2019Thu Oct 24 10:56:13 CEST 2019$
>I guess Postfix is taking just EPOCH time whitout considering localization...  so i agree with you that most lilkely Postfix cannot read some file somewhere... but i have checked files permisisons and i have not any clue.. there are no errors in Posfrix log.


CEST is localised time. UTC time would be shown as UTC, try "date -u"
apparently your time is set wrong.

--
Matus UHLAR - fantomas, [hidden email] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton

Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

Wietse Venema
Pedro David Marco:
>  Thanks Matus...
> date -u shows correct UTC time.
> Monitoring mailq with strace i have seen it always reads the file?/usr/share/zoneinfo/UTC? but "date" and "env - date"? commads read the file "/etc/localtime" (shown by strace)
>
> So it seems that? mailq always shows UTC time despite system localtime, while other postfix elements, like headers added to the email, use localtime (CEST in my case)...

On my systems (FreeBSD, Fedora) mailq reports local time (i.e. not
UTC).

On a recent Fedora release, "strace postqueue -p" show it opens
/etc/localtime (same for an older FreeBSD system). This does not
change when main.cf:maillog_file is empty or non-empty.

What system are you using? Some non-GLIBC Linux distribution?

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

PeterDaem
I use Devuan Ascii. It uses GLIBC 2.24

My main concern is that this problem may affect how postfix deals with deferred emails...  What do you think, Wietse?

Thanks,

Pedro.



On Thursday, October 24, 2019, 4:53:45 PM GMT+2, Wietse Venema <[hidden email]> wrote:


Pedro David Marco:
>  Thanks Matus...
> date -u shows correct UTC time.
> Monitoring mailq with strace i have seen it always reads the file?/usr/share/zoneinfo/UTC? but "date" and "env - date"? commads read the file "/etc/localtime" (shown by strace)
>
> So it seems that? mailq always shows UTC time despite system localtime, while other postfix elements, like headers added to the email, use localtime (CEST in my case)...

On my systems (FreeBSD, Fedora) mailq reports local time (i.e. not

UTC).


On a recent Fedora release, "strace postqueue -p" show it opens
/etc/localtime (same for an older FreeBSD system). This does not
change when main.cf:maillog_file is empty or non-empty.

What system are you using? Some non-GLIBC Linux distribution?

    Wietse

Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

Viktor Dukhovni
> On Oct 24, 2019, at 5:10 PM, Pedro David Marco <[hidden email]> wrote:
>
> My main concern is that this problem may affect how postfix deals with deferred emails...

Locale and timezone specific human readable date strings don't enter
into how Postfix deals with time internally.  So postqueue(1) time
output formatting is entirely irrelevant to queue management.

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

PeterDaem
as good as it gets... thanks Viktor!

Pedro.


On Thursday, October 24, 2019, 5:53:53 PM GMT+2, Viktor Dukhovni <[hidden email]> wrote:


> On Oct 24, 2019, at 5:10 PM, Pedro David Marco <[hidden email]> wrote:

>
> My main concern is that this problem may affect how postfix deals with deferred emails...


Locale and timezone specific human readable date strings don't enter
into how Postfix deals with time internally.  So postqueue(1) time
output formatting is entirely irrelevant to queue management.

--
    Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

Wietse Venema
In reply to this post by PeterDaem
Pedro David Marco:
>  I use Devuan Ascii. It uses GLIBC 2.24
> My main concern is that this problem may affect how postfix deals
> with deferred emails...
> What do you think, Wietse?

UNIX systems use UTC internally, therefore Postfix scheduling is
UTC based, and does not depend on what timezone the system  
runs in, or whether summer or winter time are in effect.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Mailq timestamps in localtime rather than UTC

PeterDaem
level{'calm'}++;

Thanks Wietse!

Pedro.



On Thursday, October 24, 2019, 6:08:11 PM GMT+2, Wietse Venema <[hidden email]> wrote:


Pedro David Marco:
>  I use Devuan Ascii. It uses GLIBC 2.24
> My main concern is that this problem may affect how postfix deals
> with deferred emails...
> What do you think, Wietse?

UNIX systems use UTC internally, therefore Postfix scheduling is
UTC based, and does not depend on what timezone the system 
runs in, or whether summer or winter time are in effect.


    Wietse