Skip to content

[TODO]: Migrate away from legacy docker user + group #3557

@polarathene

Description

@polarathene

Description

Bit of a history with this one:

The issue description is documenting any concerns / knowledge regarding this docker account, so that a future PR can justify renaming it to something more appropriate such as vmail / dms-vmail.


Before Dovecot - Creation of docker user + group (Dockerfile)

The docker user and group created during the Dockerfile build were added via this Sep 2015 commit from the original DMS project author. The only context provided was a reference to this issue, but it's lacking information on why the account was added.

Back then I think the mail account support was quite a different story, and it's likely become irrelevant for the original purpose?

EDIT: When DMS switched from Courier to Dovecot in DMS v2 (2016), it was configured with LDA instead of LMTP, with Postfix master.cf running the process as the docker user.


Dovecot configs referencing docker user + group

April 2016 - DMS migrated from Courier + Cyrus to Dovecot, which introduced various configs referencing the docker user and group:

Dovecot vmail user / group and common 5000 ID

Dovecot Docs - Service Config notes various processes that have a default of user=root, with advice that you could set an explicit non-privileged user instead when all mail accounts would belong to a single UID. Otherwise the processes only temporarily run as root and drop to the UID returned from the UserDB lookup result.

I haven't looked into the reasoning for 5000 as the UID/GID choice, there didn't appear to be any discussion about it in DMS. It does seem to be common advice found online though (EDIT: Seems that it might have originated from this Dovecot doc (which presently notes it's outdated and from 2010):


/var/mail ownership and sticky-bit

Presently at startup and when check-for-changes.sh service is running, chown -R is applied to /var/mail for the 5000:5000 ownership.

There wasn't much context about how this arrived in the project as a fix/workaround (a follow-up limited the scan depth to avoid applying further if permissions looked correct for the scanned directory).

  • A recent PR that will allow making the vmail ID 5000 configurable revealed the common failures, which came down to /var/mail ownership not aligning with the Dovecot user / group preventing it from creating files to store mail.
  • It's probably fine to follow earlier advice above from Dovecot docs and keep and leverage the default mail group? IIRC this location was configured with a sticky-bit, like this discusses.
    • NOTE: Earlier PR discussion regarding sticky-bit I have various comments there, one documenting a gotcha with losing sticky-bit from some operations depending on kernel support.
    • Setting vmail as user and group is probably fine, but may not need to be done beyond /var/mail (while we do have our own default layout with /var/mail/{fqdn}/{account}/, it is possible to configure that to be one level less).

supervisord Web UI

Unrelated to the above, there is another config that has a similar user (docker-mailserver) + password for the supervisord web UI when enabled: #1758

May 2025

Identified an issue with fetchmail when configured with --mda option to deliver to Dovecot. The fetchmail process needs to match the UID/GID of user to deliver to in the Dovecot UserDB, or it needs to run as root for setuid/setgid to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/scriptsarea/testskind/improvementImprove an existing feature, configuration file or the documentationmeta/help wantedThe OP requests help from others - chime in! :Dservice/dovecotstale-bot/ignoreIndicates that this issue / PR shall not be closed by our stale-checking CI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions