Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dovecot: make home dir distinct from mail dir #3335

Merged
merged 5 commits into from May 15, 2023

Conversation

georglauterbach
Copy link
Member

Description

Funnily enough, strictly speaking this is not actually a breaking change. The Sieve scripts are already moved by us from /tmp/docker-mailserver to the correct location on startup, and the same goes for the Dovecot userdb file. But that is irrelevant, as the next version we are going to release is a major.. I woudl definitely mention it separately on the release page and in the changelog.

I consider this PR as high priority, as <https://doc.dovecot.org/configuration_manual/home_directories_for_virtual_users/ points out: "Home directory shouldn’t be the same as mail directory with mbox or Maildir formats (but with dbox/obox it’s fine). It’s possible to do that, but you might run into trouble with it sooner or later."

I took care that mdbox/sdbox formats are untouched.

Fixes #3296

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or the documentation under docs/)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

I tried changing the mail dir, but this is a _very_ disruptive change,
so I took approach 3 on
<https://doc.dovecot.org/configuration_manual/home_directories_for_virtual_users/>,
whereby the home directory is now inside the mail directory.

The MDBOX/SDBOX formats are not touched by this change. The change
itself could be considered breaking though.
@polarathene
Copy link
Member

I took care that mdbox/sdbox formats are untouched.

Not sure if that's required? The docs seem to imply that it's a non-issue for them, but nothing about having a separate location for the user home like other mailbox types.

I would definitely mention it separately on the release page and in the changelog.

Presumably this will be a problem for users unaffected as separating out the content for N users to the new home subdir may not be straight-forward?

I'm unable to investigate if that is a possibility to advise further. It may warrant supporting a way to opt-in to keeping the current home location, but I leave that decision up to you.

polarathene
polarathene previously approved these changes May 14, 2023
@georglauterbach
Copy link
Member Author

I took care that mdbox/sdbox formats are untouched.

Not sure if that's required? The docs seem to imply that it's a non-issue for them, but nothing about having a separate location for the user home like other mailbox types.

I guess this is because SDBOX/MDBOX seem to already use different directories for that by default. When looking at the tests, there is the "mailboxes" directory, which already does the separation AFAIK. Hence, we needn't update it.

I would definitely mention it separately on the release page and in the changelog.

Presumably this will be a problem for users unaffected as separating out the content for N users to the new home subdir may not be straight-forward?

I'm not sure I understand. Those that use MDBOX/SDBOX already use a different directory structure altogether. What is important is to get everyone in-line when the switch to DMS >= v13.0.0 (i.e. everyone who uses maildir must get the new home directory).

I'm unable to investigate if that is a possibility to advise further. It may warrant supporting a way to opt-in to keeping the current home location, but I leave that decision up to you.

I'd like to avoid that, due to what I just said (above). I don't want to maintain partitions of users with one home dir, and the other partition with another home dir..

@casperklein
Copy link
Member

It's not completely clear to me. At the moment, home dir == mail dir. What files are supposed to be in home dir?

Is it fine to just use the new configuration with home/mail dirs separated? Or is there some kind of data migration needed?

This is how a directory looks at the moment on my system:

root@mail:/var/mail/example.com/postmaster# ls
total 252K
drwxr-xr-x 2 docker docker  44K May 14 16:44 cur
-rw-r--r-- 1 docker docker  13K May 14 17:54 dovecot-uidlist
-rw-r--r-- 1 docker docker    8 Mar  4  2020 dovecot-uidvalidity
-r--r--r-- 1 docker docker    0 Mar  4  2020 dovecot-uidvalidity.5e6032a8
-rw-r--r-- 1 docker docker 2.9K May 14 06:36 dovecot.index
-rw-r--r-- 1 docker docker  80K May 14 17:54 dovecot.index.cache
-rw-r--r-- 1 docker docker 7.6K May 14 17:54 dovecot.index.log
-rw-r--r-- 1 docker docker  33K May 14 06:36 dovecot.index.log.2
-rw-r--r-- 1 docker docker  384 Mar  4  2020 dovecot.list.index.log
drwxr-xr-x 2 docker docker  36K May 14 17:54 new
drwxr-xr-x 2 docker docker 4.0K May 14 17:54 tmp

What files will be in /var/mail/example.com/postmaster/home after his change?

@georglauterbach
Copy link
Member Author

At the moment, this is primarily about Sieve user files. From what I can see, nothing from your directory @casperklein is relevant when it comes to the home dir.

Is it fine to just use the new configuration with home/mail dirs separated? Or is there some kind of data migration needed?

AFAIK it actually is. This is mainly due to the reason the mail dir did not change, only the home dir location did.


Here is an excerpt from the Dovecot docs:

Some uses for home directory are:

  • By default Sieve scripts are in user's home directory.
  • Duplicate mail check database is in user's home directory. Suppression of duplicate rejects/vacations won't work if home directory isn't specified.
  • Debugging: If an imap or pop3 process crashes, the core file is written to the user's home directory.

Co-authored-by: Casper <casperklein@users.noreply.github.com>
casperklein
casperklein previously approved these changes May 15, 2023
Copy link
Member

@casperklein casperklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another trailing slash.. otherwise ready to merge.

target/dovecot/auth-passwdfile.inc Outdated Show resolved Hide resolved
Co-authored-by: Casper <casperklein@users.noreply.github.com>
@georglauterbach
Copy link
Member Author

I will merge this and then update my system to check whether everything is fine.

@georglauterbach georglauterbach merged commit 7453bc0 into master May 15, 2023
7 checks passed
@georglauterbach georglauterbach deleted the docevot/mail-home-dir branch May 15, 2023 18:10
@IIIlllIIllIIIll IIIlllIIllIIIll mentioned this pull request Nov 20, 2023
4 tasks
@alterNERDtive
Copy link

So just to be perfectly clear now that 13.0.0 is released: unless I have fiddled with Dovecot settings like a madman, I won’t have to manually touch anything even though this is listed as a breaking change in the release notes?

@Sovamorco
Copy link

After 13.0.0 was pushed as latest, at least for me - all Sieve scripts stopped working, and managesieve was showing none of them. Had to manually move all scripts from server/account/sieve to server/account/home/sieve and re-enable them with managesieve

@georglauterbach
Copy link
Member Author

georglauterbach commented Nov 26, 2023

I will make sure to mention this in the release notes; sorry for not making this more clear in CHANGELOG.md.

Update: I edited the release notes; now they contain this information :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: Dovecot mail-dir and home locations shouldn't overlap
5 participants