How to configure dovecot to NOT try to mount user's home

3

0

I'm trying to set up postfix+dovecot on my personal server (Ubuntu 14.0.4 LTS) for sending me some notifications from cronjobs. My /home/%user% directory is encrypted, so it's inaccessible to anything if I'm not logged in (and if the software does not support PAM sessions).

My problem is that for whatever reason my dovecot installation always tries to mount my /home/%user% on POP3 login, silently fails to do so and just returns no mail. In /var/log/mail.err I get series of

May 29 17:32:17 vps dovecot: pop3(u): Error: user u: Initialization failed: Namespace '': Can't create mailbox root dir /home/u/mail: Mountpoint /home/u isn't mounted. Mount it or remove it with doveadm mount remove
May 29 17:32:17 vps dovecot: pop3(u): Error: Invalid user settings. Refer to server log for more information.

In the meantime, doveadm mount list does not show any mountpoints.

My mail is stored by Postfix in /var/mail/%user% and I've configured dovecot to use the same directory to the best of my knowledge.

Any ideas?

Sergey Kudriavtsev

Posted 2016-05-29T15:41:19.087

Reputation: 108

I have in the meantime given up and just set up a service Google account that I can use for SMTP. Not a piece of cake either, but turned out to be easier. – Sergey Kudriavtsev – 2016-05-30T14:55:01.727

Answers

3

I do not have your environment, but I quote from the Dovecot - Community Help Wiki (the part in bold is that way in the original text) :

NOTE: Dovecot will NOT work in an encrypted directory/folder. Dovecot would just complain about permissions and won't work. One answer is to create a 2nd user account that has an unencrypted home directory. We have not tested this solution on a separate home partition, but most probably the outcome would be the same.

Officially, the above workaround using another user account is the only solution.

You might also modify the source-code of Dovecot itself so as not to mount the home directory at all, as described in the thread of dovecot mounts user home dir. However, the problem might even not be with Dovecot at all, as says this answer :

The problem is that pam_ecryptfs captures and uses your login passphrase to decrypt ~/.ecryptfs/wrapped-passphrase, and perform your home directory mount.

Unfortunately the non-interactive dovecot pam session that you describe doesn't ever actually snag your login passphrase, so it cannot perform the mount. Sorry.

The workaround of using another unencrypted user account seems to be the most promising direction.

harrymc

Posted 2016-05-29T15:41:19.087

Reputation: 306 093

Unfortunately makes sense. I believe I have seen the first quote from documentation, but thought it will apply only if the mbox was located inside homedir. Now I understand the issue lies deeper in Dovecot code. I'll try to research other solutions then. – Sergey Kudriavtsev – 2016-07-04T08:32:10.897

Also I was once able to make it work. I believe that if my home dir is mounted (so, if I'm logged in) at the dovecot's startup AND there is some mail coming while I'm still logged in, then it will continue working even if I close the session. However, this is of course neither reliable nor scalable in long run. – Sergey Kudriavtsev – 2016-07-04T08:36:08.173