zokradonh/kopano-docker

Out of office isn't working

Closed this issue · 10 comments

Describe the bug
Out of office isn't working

To Reproduce
Steps to reproduce the behavior:

  1. Enable "out of office" through webapp
  2. Send myself an email from gmail.
  3. check for new emails on gmail -> I don't get the "Out of office"-msg.

Expected behavior
I should get an e-mail on my gmail-account with my defined "out of office"- text.

Versions used:
WebApp:
4.0.2754+1623.1
Kopano Core:
10.0.5

output of dagent-log:

kopano_dagent_1     | If you want to have additional packages installed in the container either:
kopano_dagent_1     | - build your own image with the packages already included
kopano_dagent_1     | - switch the container to 'read_only: false'
kopano_dagent_1     | May 22 15:02:21 Configure core service 'dagent'
kopano_dagent_1     | Using Kopano Groupware Core: 10.0.5.2.9bfb891a3-0+102.1
kopano_dagent_1     | 2020/05/22 15:02:22 Ready: file:///var/lib/dbus/machine-id.
kopano_dagent_1     | 2020/05/22 15:02:22 Ready: file:///etc/machine-id.
kopano_dagent_1     | 2020/05/22 15:02:22 Ready: file:///var/run/kopano/server.sock.
kopano_dagent_1     | 2020-05-22T15:02:22.155040: [kopano-dagent|T6] [=======] Starting kopano-dagent version 10.0.5 (pid 6 uid 0) (LMTP mode)
kopano_dagent_1     | 2020-05-22T15:02:22.177482: [kopano-dagent|T6] [=======] Starting kopano-dagent version 10.0.5 (pid 6 uid 999) (LMTP mode)
kopano_dagent_1     | 2020-05-22T15:11:06.171770: [kopano-dagent|T129] [warning] Unable to create temp file for out of office mail: Permission denied

permissions:
ls -ld /var/lib/kopano/autorespond/
drwxr-xr-x 2 kopano kopano

it already has permission set to 755 and "kopano"-user is the owner.
but when I set:
"chmod -R 755 /var/lib/kopano/autorespond/"
it's telling me:
chmod: changing permissions of '/var/lib/kopano/autorespond/': Read-only file system

so do I need to mount this path somewhere or do I need to disable "read-only" for this container?

drwxr-xr-x 2 kopano kopano

it does not really matter what it shows you as the set permissions, while a container is run read-only you won't be able to write anywhere that is not a mount (volume, bind or tmpfs).

  • Do the out of office messages work when you run it with the read-only mode disabled?
  • Are you certain that this is actually the path that it tries to write to?

If it does work, then it might be worthwhile either mounting it as tmpfs, or changing the configuration so that it uses /tmp for this.

Only downside of pointing it at a tmpfs would be that the time marker file is "lost" on restart meaning that another out of office message is sent for a given user, before the configured grace period has expired.

PR would be welcome.

I just checked docker-compose.yml and there it says it's using /tmp already:
KCCONF_DAGENT_TMP_PATH=/tmp/dagent/

but when I check the permissions there I get:
root@d201f367e6ba:/tmp# ls -ld ./dagent/
drwxr-xr-x 2 root root 40 Apr 8 11:46 /tmp/dagent/

Right now we need both somehow
I used the following inside "docker-compose.yml" to make it work:

kopano_dagent:
read_only: false
tmpfs:
- /tmp:mode=755,uid=999,gid=999
- /tmp/dagent:mode=755,uid=999,gid=999
- /tmp/kopano:mode=755,uid=999,gid=999

but I don't think that's the best solution

I did a bit of testing on my own. Indeed the dagent folder in /tmp has the wrong permissions and because of that dagent fails to send the oof message.

A simple chown allows write access (so no need to modify the compose file for this).

But it then still does not work at a 100%, since auorespond creates a marker file in /var/lib/kopano by default. this only succeeds with read_only: false. Pointing this "senddb" to tmp should restore the ability to run the container read-only, but autorespond does not read its configuration from /tmp/kopano/autorespond.cfg.

Does not seem possible to override the autorespond.cfg at the moment https://jira.kopano.io/browse/KC-1777

While discussing the issue I came to the realisation that kc-1777 is not necessary, because this could be solved with a simple wrapper script. The PR #400 implements the wrapper and with it I can send and receive out of office message just fine.