From 71160b8f6509a7ecd26e726c98b1332768e7500e Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 10 Apr 2025 16:50:45 +0200 Subject: [PATCH] fix timezone handling such that client/server do not need to have the same --- CHANGELOG.md | 4 ++++ cmdeploy/src/cmdeploy/tests/online/test_1_basic.py | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11b73ec3..2bfbacc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ - Avoid "acmetool not found" during initial run ([#550](https://github.com/chatmail/relay/pull/550)) +- Fix timezone handling such that client/servers do not need to use + same timezone. + ([#553](https://github.com/chatmail/relay/pull/553)) + - Enforce end-to-end encryption for incoming messages. New user address mailboxes now get a `enforceE2EEincoming` file which prohibits incoming cleartext messages from other domains. diff --git a/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py b/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py index fe449e0f..a1dd0bfb 100644 --- a/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py +++ b/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py @@ -55,11 +55,12 @@ class TestSSHExecutor: def test_opendkim_restarted(self, sshexec): """check that opendkim is not running for longer than a day.""" - out = sshexec(call=remote.rshell.shell, kwargs=dict(command="systemctl status opendkim")) - assert type(out) == str - since_date_str = out.split("since ")[1].split(";")[0] - since_date = datetime.datetime.strptime(since_date_str, "%a %Y-%m-%d %H:%M:%S %Z") - assert (datetime.datetime.now() - since_date).total_seconds() < 60 * 60 * 24 + cmd = "systemctl show opendkim --timestamp=utc --property=ActiveEnterTimestamp" + out = sshexec(call=remote.rshell.shell, kwargs=dict(command=cmd)) + datestring = out.split("=")[1] + since_date = datetime.datetime.strptime(datestring, "%a %Y-%m-%d %H:%M:%S %Z") + now = datetime.datetime.now(since_date.tzinfo) + assert (now - since_date).total_seconds() < 60 * 60 * 24 def test_remote(remote, imap_or_smtp):