feat: Allow changing the Dovecot vmail UID/GID via ENV#3550
feat: Allow changing the Dovecot vmail UID/GID via ENV#3550polarathene merged 13 commits intodocker-mailserver:masterfrom
Conversation
|
I ran the test suite locally with a clone of your branch, but with a slight modification to the This gave a variety of errors though. LDAP (non-concern)This one is just due to the rspamd_full.bats (big failure logs)This one is just due to how the test command was written a bit differently (I've raised a PR to address that). Instead of The 2nd failure is like |
|
Failure keywords observed by log type (from prior comments test failures):
The bulk of test failures are due to either:
Notably, several tests log failures with explicit UID/GID errors were caught. In the
All logs with the `5000` or `9042` valuesLogs filtered by failure keywords |
There was a problem hiding this comment.
There is quite a few mistakes to be corrected. Thanks for tackling this though!
- It's great to see you were comfortable enough to try setup a test (which we're definitely lacking proper guidance / docs for).
- You can go into the "Files changed" tab of this PR view and "Add suggestion to batch" everything I've suggested if you agree with the changes, and commit that via the web UI.
git pull your branch locally afterwards and continue resolving the failure ūser.bats will cause (you may want to comment out the wait for empty queue helper for now, substitute with a little bit of sleep for faster failures).
I've rewritten your PR description. Once all the review feedback is addressed, we'll deal with moving/renaming the test file and ENV. Docs will need to be improved a little bit to better clarify the feature (I'll assist with that).
| @test '/var/log/mail/mail.log is error-free' { | ||
| _run_in_container grep 'non-null host address bits in' /var/log/mail/mail.log | ||
| assert_failure | ||
| _run_in_container grep ': error:' /var/log/mail/mail.log | ||
| assert_failure | ||
| } |
There was a problem hiding this comment.
You didn't mention any reasoning for this in your PR description or commit messages.
I know this is taken from tests.bats, but I don't know why you've skimped on it with only a subset of error checks?
docker-mailserver/test/tests/serial/tests.bats
Lines 184 to 201 in 8c0cfa0
Some can be ignored (but they're harmless so adding all for now is fine), here's a proper snippet instead to use:
| @test '/var/log/mail/mail.log is error-free' { | |
| _run_in_container grep 'non-null host address bits in' /var/log/mail/mail.log | |
| assert_failure | |
| _run_in_container grep ': error:' /var/log/mail/mail.log | |
| assert_failure | |
| } | |
| # TODO: Migrate to test/helper/common.bash | |
| # This test case is shared with tests.bats, but provides context on errors + some minor edits | |
| # TODO: Could improve in future with keywords from https://github.com/docker-mailserver/docker-mailserver/pull/3550#issuecomment-1738509088 | |
| # Potentially via a helper that allows an optional fixed number of errors to be present if they were intentional | |
| @test '/var/log/mail/mail.log is error free' { | |
| # Postfix: https://serverfault.com/questions/934703/postfix-451-4-3-0-temporary-lookup-failure | |
| _run_in_container grep 'non-null host address bits in' /var/log/mail/mail.log | |
| assert_failure | |
| # Postfix delivery failure: https://github.com/docker-mailserver/docker-mailserver/issues/230 | |
| _run_in_container grep 'mail system configuration error' /var/log/mail/mail.log | |
| assert_failure | |
| # Unknown error source: https://github.com/docker-mailserver/docker-mailserver/pull/85 | |
| _run_in_container grep -i ': error:' /var/log/mail/mail.log | |
| assert_failure | |
| # Unknown error source: https://github.com/docker-mailserver/docker-mailserver/pull/320 | |
| _run_in_container grep -i 'not writable' /var/log/mail/mail.log | |
| assert_failure | |
| _run_in_container grep -i 'permission denied' /var/log/mail/mail.log | |
| assert_failure | |
| # Amavis: https://forum.howtoforge.com/threads/postfix-smtp-error-caused-by-clamav-cant-connect-to-a-unix-socket-var-run-clamav-clamd-ctl.81002/ | |
| _run_in_container grep -i '(!)connect' /var/log/mail/mail.log | |
| assert_failure | |
| # Postfix: https://github.com/docker-mailserver/docker-mailserver/pull/2597 | |
| _run_in_container grep -i 'using backwards-compatible default setting' /var/log/mail/mail.log | |
| assert_failure | |
| # Postgrey: https://github.com/docker-mailserver/docker-mailserver/pull/612#discussion_r117635774 | |
| _run_in_container grep -i 'connect to 127.0.0.1:10023: Connection refused' /var/log/mail/mail.log | |
| assert_failure | |
| } |
- Dovecot logs with
: Error:(sogrep -i ': error:) - Dovecot failure
failed: Permission denied(already covered bygrep -i 'permission denied', butfailed:may still be applicable elsewhere 🤷♂️ )
Additional keywords have been identified from failures I've caught running this PR: #3550 (comment)
polarathene
left a comment
There was a problem hiding this comment.
I've decided to just apply the feedback myself. You're welcome to read the review feedback if you're interested, or raise any concerns if you disagree with those changes.
Just focus on making ūser.bats pass correctly now by having user.sh apply whatever other configuration changes are required 👍
|
@polarathene Test pass correctly now thanks for your modification and advice!!! 💥 I have just searched 30 min how access to container log before to understand, I need to comment teardown function 😂 note: maybe a part of solution for other LDAP issue will be to add an UID parameter in the account creation script to custom with the LDAP UID dovecot userDB and modify chown for only chown /var/mail and not all folder hierarchy |
polarathene
left a comment
There was a problem hiding this comment.
Please update the remaining:
UID_DOCKER=>DMS_VMAIL_UIDGID_DOCKER=>DMS_VMAIL_GIDuser.sh=>vmail-id.shuser.bats=>vmail-id.batsaccounts.shneeds to update one more line with5000:500=>${DMS_VMAIL_UID}:${DMS_VMAIL_GID}
Afterwards this looks all good to go 👍
If your test fails regarding sieve, this is an unrelated bug to this PR (the failure is just actually caught now).
|
I think we are ready to merge? |
polarathene
left a comment
There was a problem hiding this comment.
These suggestions were missed.
polarathene
left a comment
There was a problem hiding this comment.
LGTM 👍
Thanks for the contribution! I won't merge it immediately, the other maintainers may be interested in blocking it for a review of their own first.
It's a small enough and harmless change to review though, and a useful feature for some users. I think you'll get another approval :)
Co-authored-by: Georg Lauterbach <[email protected]>
e18e9a6
|
Documentation preview for this PR is ready! 🎉 Built with commit: e18e9a6 |
Description
There is a deployment scenario with remote storage (NFS / NAS) where the appliance restricts what UID / GID values are allowed on the file system.
This causes a problem when using a volume bind mount for persisting the DMS
/var/mailonto the host, where the UID/GID of5000:5000(internally mapped todocker:docker) that is used by Dovecot in DMS is not permitted.Unlike a similar issue with LDAP supporting per-user UID/GID (where
chown -Rduring startup and change detection adjusts ownership over/var/mail), this PR only needs to adjust the static vmail user configured for Dovecot. This can be supported easily with ENV.Resolves: #3548 #405 #1611
Resolves discussion: https://github.com/orgs/docker-mailserver/discussions/3407#discussioncomment-6299183
Type of change
Fixes a bug by introducing a new feature.
Checklist:
docs/)