mailcow / mailcow-dockerized

mailcow: dockerized - 🐮 + 🐋 = 💕
https://mailcow.email
GNU General Public License v3.0
8.78k stars 1.17k forks source link

SOGo vacation auto reply date shifting #5394

Closed saytamkenorh closed 1 month ago

saytamkenorh commented 1 year ago

Contribution guidelines

I've found a bug and checked that ...

Description

When SOGo Vacation autoreply with start and end dates is set then after a short time the dates in Sieve filter stored in dovecot are shifted by one day. This means that the autoreply starts working sooner as expected and ends sooner.

I was able to workaround the bug by creating a hook in "/data/hooks/sogo" with following contents:

#!/bin/bash
echo "$TZ" > /etc/timezone

By default the "/etc/timezone" file in the sogo-mailcow container contains "Etc/UTC".


### Logs:

```plain text
mailcowdockerized-ofelia-mailcow-1  | 2023-08-25T15:52:13.672+02:00  common.go:125 ▶ NOTICE [Job "sogo_eautoreply" (5ae4e4539106)] StdErr: <0x0x558ea7ec8090[SOGoCache]> Cache cleanup interval set every 900.000000 seconds
mailcowdockerized-ofelia-mailcow-1  | <0x0x558ea7ec8090[SOGoCache]> Using host(s) 'memcached' as server(s)
mailcowdockerized-ofelia-mailcow-1  | 2023-08-25 13:52:13.664 sogo-tool[180:180] Removed auto-reply of user <address of the test user>
mailcowdockerized-ofelia-mailcow-1  | 2023-08-25T15:52:13.672+02:00  common.go:125 ▶ NOTICE [Job "sogo_eautoreply" (5ae4e4539106)] Finished in "661.275022ms", failed: false, skipped: false, error: none

Steps to reproduce:

1. Use mailcow with other timezone than UTC (e.g. Europe/Prague in my case)
2. Set vacation in SOGo with start and end dates (https://imgur.com/tNPmyd9)
3. Login to mailcow UI and click the "[Show active user sieve filter]" button (https://imgur.com/RmI2Jeb)
4. Observe that SOGo created a Sieve filter with correct dates
5. Wait 5 minutes so the Ofelia "sogo_eautoreply" job is run
6. Click the "[Show active user sieve filter]" button again (https://imgur.com/zt0BpZ6)
7. Observe that both the start and end date are shifted one day backwards so they do not correspond to dates that are set in SOGo

Which branch are you using?

master

Operating System:

Fedora Linux 38 (Server Edition)

Server/VM specifications:

16 GB RAM, 2 CPU cores

Is Apparmor, SELinux or similar active?

no

Virtualization technology:

none

Docker version:

24.0.5

docker-compose version or docker compose version:

v2.20.2

mailcow version:

2023-08

Reverse proxy:

Nginx

Logs of git diff:

No changes

Logs of iptables -L -vn:

# Warning: iptables-legacy tables present, use iptables-legacy to see them
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
54415   18M DOCKER-ISOLATION-STAGE-1  0    --  *      *       0.0.0.0/0            0.0.0.0/0           
   40  2173 ACCEPT     0    --  *      br-cd11408c3d16  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    7   384 DOCKER     0    --  *      br-cd11408c3d16  0.0.0.0/0            0.0.0.0/0           
   40  2677 ACCEPT     0    --  br-cd11408c3d16 !br-cd11408c3d16  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  br-cd11408c3d16 br-cd11408c3d16  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  *      br-e81b3ea461da  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 DOCKER     0    --  *      br-e81b3ea461da  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  br-e81b3ea461da !br-e81b3ea461da  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  br-e81b3ea461da br-e81b3ea461da  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  *      br-f2142f94beb4  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 DOCKER     0    --  *      br-f2142f94beb4  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  br-f2142f94beb4 !br-f2142f94beb4  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  br-f2142f94beb4 br-f2142f94beb4  0.0.0.0/0            0.0.0.0/0           
54328   18M DOCKER-USER  0    --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  *      br-e15620437eed  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 DOCKER     0    --  *      br-e15620437eed  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  br-e15620437eed !br-e15620437eed  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  br-e15620437eed br-e15620437eed  0.0.0.0/0            0.0.0.0/0           
26212 7959K ACCEPT     0    --  *      br-mailcow  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
 2679  164K DOCKER     0    --  *      br-mailcow  0.0.0.0/0            0.0.0.0/0           
 1827  176K ACCEPT     0    --  br-mailcow !br-mailcow  0.0.0.0/0            0.0.0.0/0           
 2677  164K ACCEPT     0    --  br-mailcow br-mailcow  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  *      docker0  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 DOCKER     0    --  *      docker0  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     0    --  docker0 docker0  0.0.0.0/0            0.0.0.0/0           
22660 9492K ACCEPT     0    --  *      br-1c07dbb0a62e  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
  533 31980 DOCKER     0    --  *      br-1c07dbb0a62e  0.0.0.0/0            0.0.0.0/0           
  521 52788 ACCEPT     0    --  br-1c07dbb0a62e !br-1c07dbb0a62e  0.0.0.0/0            0.0.0.0/0           
  533 31980 ACCEPT     0    --  br-1c07dbb0a62e br-1c07dbb0a62e  0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain DOCKER (7 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     6    --  !br-1c07dbb0a62e br-1c07dbb0a62e  0.0.0.0/0            172.21.0.8           tcp dpt:8090
    0     0 ACCEPT     17   --  !br-1c07dbb0a62e br-1c07dbb0a62e  0.0.0.0/0            172.21.0.8           udp dpt:8090
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.13          tcp dpt:8983
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.250         tcp dpt:995
    1    60 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.250         tcp dpt:993
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.250         tcp dpt:143
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.250         tcp dpt:4190
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.249         tcp dpt:6379
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.6           tcp dpt:8102
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.253         tcp dpt:587
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.250         tcp dpt:12345
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.10          tcp dpt:3306
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.6           tcp dpt:8101
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.253         tcp dpt:465
    1    52 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.253         tcp dpt:25
    0     0 ACCEPT     6    --  !br-mailcow br-mailcow  0.0.0.0/0            172.22.1.250         tcp dpt:110
    0     0 ACCEPT     6    --  !br-e15620437eed br-e15620437eed  0.0.0.0/0            172.18.0.2           tcp dpt:8080
    7   384 ACCEPT     6    --  !br-cd11408c3d16 br-cd11408c3d16  0.0.0.0/0            172.23.0.2           tcp dpt:25565

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
 pkts bytes target     prot opt in     out     source               destination         
54519   18M RETURN     0    --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain DOCKER-ISOLATION-STAGE-2 (0 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     0    --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain DOCKER-USER (1 references)
 pkts bytes target     prot opt in     out     source               destination         
54328   18M RETURN     0    --  *      *       0.0.0.0/0            0.0.0.0/0

Logs of ip6tables -L -vn:

# Warning: ip6tables-legacy tables present, use ip6tables-legacy to see them
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Logs of iptables -L -vn -t nat:

# Warning: iptables-legacy tables present, use iptables-legacy to see them
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  577 33988 DOCKER     0    --  *      *       0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type LOCAL

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DOCKER     0    --  *      *       0.0.0.0/0           !127.0.0.0/8          ADDRTYPE match dst-type LOCAL

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MASQUERADE  0    --  *      !br-cd11408c3d16  172.23.0.0/16        0.0.0.0/0           
    0     0 MASQUERADE  0    --  *      !br-e81b3ea461da  172.20.0.0/16        0.0.0.0/0           
    0     0 MASQUERADE  0    --  *      !br-f2142f94beb4  172.19.0.0/16        0.0.0.0/0           
    0     0 MASQUERADE  0    --  *      !br-e15620437eed  172.18.0.0/16        0.0.0.0/0           
  930 68391 MASQUERADE  0    --  *      !br-mailcow  172.22.1.0/24        0.0.0.0/0           
    0     0 MASQUERADE  0    --  *      !docker0  172.17.0.0/16        0.0.0.0/0           
   88  5280 MASQUERADE  0    --  *      !br-1c07dbb0a62e  172.21.0.0/16        0.0.0.0/0           
    0     0 MASQUERADE  6    --  *      *       172.21.0.8           172.21.0.8           tcp dpt:8090
    0     0 MASQUERADE  17   --  *      *       172.21.0.8           172.21.0.8           udp dpt:8090
    0     0 MASQUERADE  6    --  *      *       172.22.1.13          172.22.1.13          tcp dpt:8983
    0     0 MASQUERADE  6    --  *      *       172.22.1.250         172.22.1.250         tcp dpt:995
    0     0 MASQUERADE  6    --  *      *       172.22.1.250         172.22.1.250         tcp dpt:993
    0     0 MASQUERADE  6    --  *      *       172.22.1.250         172.22.1.250         tcp dpt:143
    0     0 MASQUERADE  6    --  *      *       172.22.1.250         172.22.1.250         tcp dpt:4190
    0     0 MASQUERADE  6    --  *      *       172.22.1.249         172.22.1.249         tcp dpt:6379
    0     0 MASQUERADE  6    --  *      *       172.22.1.6           172.22.1.6           tcp dpt:8102
    0     0 MASQUERADE  6    --  *      *       172.22.1.253         172.22.1.253         tcp dpt:587
    0     0 MASQUERADE  6    --  *      *       172.22.1.250         172.22.1.250         tcp dpt:12345
    0     0 MASQUERADE  6    --  *      *       172.22.1.10          172.22.1.10          tcp dpt:3306
    0     0 MASQUERADE  6    --  *      *       172.22.1.6           172.22.1.6           tcp dpt:8101
    0     0 MASQUERADE  6    --  *      *       172.22.1.253         172.22.1.253         tcp dpt:465
    0     0 MASQUERADE  6    --  *      *       172.22.1.253         172.22.1.253         tcp dpt:25
    0     0 MASQUERADE  6    --  *      *       172.22.1.250         172.22.1.250         tcp dpt:110
    0     0 MASQUERADE  6    --  *      *       172.18.0.2           172.18.0.2           tcp dpt:8080
    0     0 MASQUERADE  6    --  *      *       172.23.0.2           172.23.0.2           tcp dpt:25565

Chain DOCKER (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     0    --  br-cd11408c3d16 *       0.0.0.0/0            0.0.0.0/0           
    0     0 RETURN     0    --  br-e81b3ea461da *       0.0.0.0/0            0.0.0.0/0           
    0     0 RETURN     0    --  br-f2142f94beb4 *       0.0.0.0/0            0.0.0.0/0           
    0     0 RETURN     0    --  br-e15620437eed *       0.0.0.0/0            0.0.0.0/0           
    0     0 RETURN     0    --  br-mailcow *       0.0.0.0/0            0.0.0.0/0           
    0     0 RETURN     0    --  docker0 *       0.0.0.0/0            0.0.0.0/0           
    0     0 RETURN     0    --  br-1c07dbb0a62e *       0.0.0.0/0            0.0.0.0/0           
    0     0 DNAT       6    --  !br-1c07dbb0a62e *       0.0.0.0/0            127.0.0.1            tcp dpt:8090 to:172.21.0.8:8090
    0     0 DNAT       17   --  !br-1c07dbb0a62e *       0.0.0.0/0            127.0.0.1            udp dpt:8090 to:172.21.0.8:8090
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            127.0.0.1            tcp dpt:18983 to:172.22.1.13:8983
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            0.0.0.0/0            tcp dpt:995 to:172.22.1.250:995
    1    60 DNAT       6    --  !br-mailcow *       0.0.0.0/0            0.0.0.0/0            tcp dpt:993 to:172.22.1.250:993
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            0.0.0.0/0            tcp dpt:143 to:172.22.1.250:143
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            127.0.0.1            tcp dpt:4190 to:172.22.1.250:4190
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            127.0.0.1            tcp dpt:7654 to:172.22.1.249:6379
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            127.0.0.1            tcp dpt:8102 to:172.22.1.6:8102
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            0.0.0.0/0            tcp dpt:587 to:172.22.1.253:587
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            127.0.0.1            tcp dpt:19991 to:172.22.1.250:12345
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            127.0.0.1            tcp dpt:13306 to:172.22.1.10:3306
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            127.0.0.1            tcp dpt:8101 to:172.22.1.6:8101
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            0.0.0.0/0            tcp dpt:465 to:172.22.1.253:465
    1    52 DNAT       6    --  !br-mailcow *       0.0.0.0/0            0.0.0.0/0            tcp dpt:25 to:172.22.1.253:25
    0     0 DNAT       6    --  !br-mailcow *       0.0.0.0/0            0.0.0.0/0            tcp dpt:110 to:172.22.1.250:110

Logs of ip6tables -L -vn -t nat:

# Warning: ip6tables-legacy tables present, use ip6tables-legacy to see them
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

DNS check:

151.101.1.69
151.101.129.69
151.101.193.69
151.101.65.69
mac-linux-free commented 1 year ago

Thank you for the workaround.

jonboy86 commented 12 months ago

Maybe related but not fully sure. I have had complaints that even after disabling vacation messages they will randomly auto respond to senders

milkmaker commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

mkddostro commented 9 months ago

? not fixing a bug is considered as stale? This bug still occurs in 2023-11. The auto-reply just triggered although it is set for beginning 2023-12-23.

milkmaker commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

smart-matwolf commented 5 months ago

This bug is still current... could you please fix it in some way? Thanks

fredol commented 5 months ago

Same here, dates are shifting anytime we use SoGo vacation messages. We are going to test above workaround and let you know here if it fixes date shifting

smart-matwolf commented 5 months ago

After my message I've tested the workaround and it's working. Still, it would be better to fix it at the source ;)

fredol commented 5 months ago

Thanks, we'll give it a try ASAP and post results here

A quick question: $TZ is an ENV var of SoGo?

smart-matwolf commented 5 months ago

$TZ is an ENV var that should be already defined within your docker-compose file (sourced from .env/mailcow.conf file) . And so it should be already available within SoGO container.