Skip to content

fix: LDAP - Enable check-for-changes.sh support#4627

Merged
polarathene merged 4 commits intodocker-mailserver:masterfrom
FDHoho007:bug/changedetector-ldap
Dec 26, 2025
Merged

fix: LDAP - Enable check-for-changes.sh support#4627
polarathene merged 4 commits intodocker-mailserver:masterfrom
FDHoho007:bug/changedetector-ldap

Conversation

@FDHoho007
Copy link
Copy Markdown
Contributor

@FDHoho007 FDHoho007 commented Dec 20, 2025

Description

Enables the change detector for account provisioner ldap. This is required to watch for changes in the SSL certificates and reload postfix when needed. Therefore the change detector needs to be aware whether he should also watch the file databases for changes.

Fixes #4528

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 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 have added information about changes made in this PR to CHANGELOG.md

@FDHoho007 FDHoho007 force-pushed the bug/changedetector-ldap branch from 340f7f0 to 26a3272 Compare December 20, 2025 21:37
Copy link
Copy Markdown
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

Minor changes:

  • Revised changelog entry.
  • Allow the LDAP account provisioner to also handle Rspamd config changes.

Comment thread target/scripts/check-for-changes.sh Outdated
Comment thread CHANGELOG.md Outdated
@polarathene polarathene added area/scripts service/ldap kind/improvement Improve an existing feature, configuration file or the documentation area/configuration (file) labels Dec 24, 2025
@polarathene polarathene added this to the v16.0.0 milestone Dec 24, 2025
@FDHoho007
Copy link
Copy Markdown
Contributor Author

Thank you for the feedback! I implemented both suggested changes.

polarathene
polarathene previously approved these changes Dec 25, 2025
@polarathene
Copy link
Copy Markdown
Member

LGTM! Thanks for taking time to make a contribution to DMS ❤️

@polarathene
Copy link
Copy Markdown
Member

It seems that an rspamd test has been broken. Unclear if that's the fault of this PR, we don't have extensive test coverage with LDAP so it would be with the file based provisioner 🤔

ok 78 [Rspamd] (DKIM) setting all arguments to a custom value works in 1241ms

not ok 79 setup_file failed
# (from function `refute_output' in file test/test_helper/bats-assert/src/refute_output.bash, line 189,
#  from function `setup_file' in test file test/tests/parallel/set1/spam_virus/rspamd_full.bats, line 68)
#   `refute_output --partial 'inet:localhost:11332: Connection refused'' failed
# 2025-12-26 00:58:42+00:00 INFO  start-mailserver.sh: mail.example.test is up and running
# -- output should not contain substring --
# substring (1 lines):
#   inet:localhost:11332: Connection refused
# output (628 lines):

There is quite a few lines like:

postfix/smtpd[1590]: warning: connect to Milter service inet:localhost:11332: Connection refused

I've tried re-running the test but it failed again. Until it's confirmed that this is due to something other than this PR I don't think I can go ahead and merge 😓

Unfortunately we don't have an ability to pin the version of rspamd supplied from upstream (I requested it and offered to implement but they declined), it's possible that some upstream change pulled in also contributes to this failure, in which case any PR will trigger it.

@FDHoho007
Copy link
Copy Markdown
Contributor Author

Since I am completely new to this codebase i just poked a bit around.
I reverted my last commit but that did not change anything. Therefore I also assume it is due to an upstream change.
I then found out, that rspamd seems to be running according to supervisorctl but the rspamd logs show, that the rspamd_proxy is only started after that:

#1351(main) <3b3991>; main; rspamd_fork_worker: prepare to fork process rspamd_proxy (0); listen on: 127.0.0.1:11332
#1351(main) <3b3991>; main; rspamd_fork_worker: prepare to fork process rspamd_proxy (1); listen on: 127.0.0.1:11332

The test rspamd_full waits for the service to be running and then immediately tries to trigger rspamd, which has not yet spawned it's workers.
I don't know how this was handled in the past but I assume, that the workers were ready when rspamd reported as running. Maybe rspamd startup times were also faster in before. Therefore maybe we should also add somthing like _wait_for_rspamd_port_in_container?

@FDHoho007
Copy link
Copy Markdown
Contributor Author

There still seems to be an issue in rspamd_dkim which randomly fails while restarting rspamd with exit code 7

 ✗ [Rspamd] (DKIM) argument 'keytype' is applied correctly [2811]
   (from function `assert_success' in file test/test_helper/bats-assert/src/assert_success.bash, line 42,
    in test file test/tests/parallel/set1/spam_virus/rspamd_dkim.bats, line 116)
     `assert_success' failed
   
   -- command failed --
   status : 7
   output (17 lines):
     2025-12-26 11:14:04+00:00 TRACE rspamd-dkim: Options given to this script: 'keytype ed25519'
     2025-12-26 11:14:04+00:00 DEBUG rspamd-dkim: Keytype set to 'ed25519'
     2025-12-26 11:14:04+00:00 INFO  rspamd-dkim: Creating DKIM keys of type 'ed25519' with selector 'mail' for domain 'example.test'
     2025-12-26 11:14:04+00:00 TRACE rspamd-dkim: Creating Rspamd error log
     2025-12-26 11:14:04+00:00 TRACE rspamd-dkim: Running 'rspamadm dkim_keygen -s mail -d example.test -t ed25519 -k /tmp/docker-mailserver/rspamd/dkim/ed25519-mail-example.test.private.txt' as user '_rspamd'
     2025-12-26 11:14:04+00:00 TRACE rspamd-dkim: Running 'grep --quiet --ignore-case --fixed-strings Permission denied /tmp/tmp.C1bcrlXEnG' as user '_rspamd'
     2025-12-26 11:14:04+00:00 INFO  rspamd-dkim: Successfully created DKIM keys
     2025-12-26 11:14:04+00:00 DEBUG rspamd-dkim: Public key written to '/tmp/docker-mailserver/rspamd/dkim/ed25519-mail-example.test.public.txt'
     2025-12-26 11:14:04+00:00 DEBUG rspamd-dkim: Private key written to '/tmp/docker-mailserver/rspamd/dkim/ed25519-mail-example.test.private.txt'
     2025-12-26 11:14:04+00:00 TRACE rspamd-dkim: Running 'ls /tmp/docker-mailserver/rspamd/dkim' as user '_rspamd'
     2025-12-26 11:14:04+00:00 TRACE rspamd-dkim: Running 'cat /tmp/docker-mailserver/rspamd/dkim/ed25519-mail-example.test.private.txt' as user '_rspamd'
     2025-12-26 11:14:04+00:00 DEBUG rspamd-dkim: Permissions on files and directories seem ok
     2025-12-26 11:14:04+00:00 INFO  rspamd-dkim: Supplying a default configuration (to '/tmp/docker-mailserver/rspamd/override.d/dkim_signing.conf')
     2025-12-26 11:14:04+00:00 DEBUG rspamd-dkim: Restarting Rspamd as initial DKIM configuration was supplied
     rspamd: ERROR (not running)
     rspamd: ERROR (abnormal termination)
     2025-12-26 11:14:04+00:00 ERROR rspamd-dkim: Unexpected error occurred :: script = /usr/local/bin/rspamd-dkim  | function = _setup_default_signing_conf | command = supervisorctl restart rspamd | line = 260 | exit code = 7
   --

Randomly meaning that in every test run one or more of the tests fail, but it could be any of them.

@polarathene
Copy link
Copy Markdown
Member

polarathene commented Dec 26, 2025

The test rspamd_full waits for the service to be running and then immediately tries to trigger rspamd, which has not yet spawned it's workers.
I don't know how this was handled in the past but I assume, that the workers were ready when rspamd reported as running. Maybe rspamd startup times were also faster in before.

Could be, or could be a change in the CI environment being slower too. I used to run tests in cheap VPS instances that revealed other issues in the past that didn't show up with our CI on Github.

If that were the case though our current release image (without a fresh build) should similarly fail, otherwise it'd need to be some recent change somewhere.

Therefore maybe we should also add somthing like _wait_for_rspamd_port_in_container?

We have a generic port helper method to wait on, that might be sufficient. Or we could potentially monitor logs (rspamd logs are a separate log file due to verbosity).

EDIT: Oh I see you already contributed that helper. I'm alright with that 👍


There still seems to be an issue in rspamd_dkim which randomly fails while restarting rspamd with exit code 7

Yeah I've caught that one before too and have detailed it here: #4579

I just rarely having time spare for DMS lately beyond quick support tickets and reviews.

The project could do with more contributors, we lack the momentum alternative mail solutions have in that regard so I'm not sure how relevant DMS will remain beyond it's main differentiator of a single container for simple deployment and configuration.

Copy link
Copy Markdown
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

Sweet tests are now passing (DKIM is still racey as noted), thanks for also improving the rspamd tests! ❤️

I'm happy to merge the contribution now 🚀

@polarathene polarathene changed the title fix: Enable changedetector for account provisioner ldap. fix: LDAP - Enable check-for-changes.sh support Dec 26, 2025
@polarathene polarathene merged commit 17111a0 into docker-mailserver:master Dec 26, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/configuration (file) area/scripts kind/improvement Improve an existing feature, configuration file or the documentation service/ldap

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug report: changedetector service is not started when using ACCOUNT_PROVISIONER=ldap. So traefik certificate changes are not detected.

2 participants