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

* fix: Enable change detection support for `ACCOUNT_PROVISIONER=LDAP`
* fix(test/rspamd_full): Explicitly wait for the `rspamd_proxy` port to be available before testing
This commit is contained in:
FDHoho007
2025-12-27 00:15:28 +01:00
committed by GitHub
parent f0181a11cd
commit 17111a0ea2
7 changed files with 20 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. The format
- **Internal:** - **Internal:**
- `ENABLE_QUOTAS=1` - When an alias has multiple addresses, the first local mailbox address found will be used for the Dovecot dummy account workaround ([#4581](https://github.com/docker-mailserver/docker-mailserver/pull/4581)) - `ENABLE_QUOTAS=1` - When an alias has multiple addresses, the first local mailbox address found will be used for the Dovecot dummy account workaround ([#4581](https://github.com/docker-mailserver/docker-mailserver/pull/4581))
- Change Detection service - Added support for responding to updated DMS config (_Rspamd and TLS certificates_) to `ACCOUNT_PROVISIONER=LDAP` ([#4627](https://github.com/docker-mailserver/docker-mailserver/pull/4627))
- **Tests:** - **Tests:**
- Make the helper method `_get_container_ip()` compatible with Docker 29 ([#4606](https://github.com/docker-mailserver/docker-mailserver/pull/4606)) - Make the helper method `_get_container_ip()` compatible with Docker 29 ([#4606](https://github.com/docker-mailserver/docker-mailserver/pull/4606))

View File

@@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
# TODO: Adapt for compatibility with LDAP
# Only the cert renewal change detection may be relevant for LDAP?
# CHKSUM_FILE global is imported from this file: # CHKSUM_FILE global is imported from this file:
# shellcheck source=./helpers/index.sh # shellcheck source=./helpers/index.sh
source /usr/local/bin/helpers/index.sh source /usr/local/bin/helpers/index.sh
@@ -63,7 +60,8 @@ function _handle_changes() {
# Variable to identify any config updates dependent upon vhost changes. # Variable to identify any config updates dependent upon vhost changes.
local VHOST_UPDATED=0 local VHOST_UPDATED=0
# These two configs are the source for /etc/postfix/vhost (managed mail domains) # These two configs are the source for /etc/postfix/vhost (managed mail domains)
if [[ ${CHANGED} =~ ${DMS_DIR}/postfix-(accounts|virtual).cf ]]; then if [[ ${ACCOUNT_PROVISIONER} == 'FILE' ]] \
&& [[ ${CHANGED} =~ ${DMS_DIR}/postfix-(accounts|virtual).cf ]]; then
_log 'trace' 'Regenerating vhosts (Postfix)' _log 'trace' 'Regenerating vhosts (Postfix)'
# Regenerate via `helpers/postfix.sh`: # Regenerate via `helpers/postfix.sh`:
_create_postfix_vhost _create_postfix_vhost
@@ -72,7 +70,11 @@ function _handle_changes() {
fi fi
_ssl_changes _ssl_changes
_postfix_dovecot_changes # TODO: Consider support relay host config change support for other provisioners
if [[ ${ACCOUNT_PROVISIONER} == 'FILE' ]]; then
_postfix_dovecot_changes
fi
_rspamd_changes _rspamd_changes
_log 'debug' 'Reloading services due to detected changes' _log 'debug' 'Reloading services due to detected changes'

View File

@@ -156,8 +156,8 @@ function _register_functions() {
[[ ${ENABLE_FETCHMAIL} -eq 1 ]] && _register_start_daemon '_start_daemon_fetchmail' [[ ${ENABLE_FETCHMAIL} -eq 1 ]] && _register_start_daemon '_start_daemon_fetchmail'
[[ ${ENABLE_CLAMAV} -eq 1 ]] && _register_start_daemon '_start_daemon_clamav' [[ ${ENABLE_CLAMAV} -eq 1 ]] && _register_start_daemon '_start_daemon_clamav'
[[ ${ENABLE_AMAVIS} -eq 1 ]] && _register_start_daemon '_start_daemon_amavis' [[ ${ENABLE_AMAVIS} -eq 1 ]] && _register_start_daemon '_start_daemon_amavis'
[[ ${ACCOUNT_PROVISIONER} == 'FILE' ]] && _register_start_daemon '_start_daemon_changedetector'
[[ ${ENABLE_GETMAIL} -eq 1 ]] && _register_start_daemon '_start_daemon_getmail' [[ ${ENABLE_GETMAIL} -eq 1 ]] && _register_start_daemon '_start_daemon_getmail'
_register_start_daemon '_start_daemon_changedetector'
} }
# ------------------------------------------------------------ # ------------------------------------------------------------

View File

@@ -269,6 +269,14 @@ function _wait_for_smtp_port_in_container_to_respond() {
done done
} }
# Wait for RSPAMD port (11332) to become ready.
#
# @param ${1} = name of the container [OPTIONAL]
function _wait_for_rspamd_port_in_container() {
local CONTAINER_NAME=$(__handle_container_name "${1:-}")
_wait_for_tcp_port_in_container 11332
}
# Checks whether a service is running inside a container (${1}). # Checks whether a service is running inside a container (${1}).
# #
# @param ${1} = service name # @param ${1} = service name

View File

@@ -24,6 +24,7 @@ function setup_file() {
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS' _common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
_wait_for_service rspamd-redis _wait_for_service rspamd-redis
_wait_for_service rspamd _wait_for_service rspamd
_wait_for_rspamd_port_in_container
} }
# We want each test to start with a clean state. # We want each test to start with a clean state.

View File

@@ -40,6 +40,7 @@ function setup_file() {
_wait_for_service rspamd-redis _wait_for_service rspamd-redis
_wait_for_service rspamd _wait_for_service rspamd
_wait_for_rspamd_port_in_container
_wait_for_service clamav _wait_for_service clamav
_wait_for_service postfix _wait_for_service postfix
_wait_for_smtp_port_in_container _wait_for_smtp_port_in_container

View File

@@ -33,6 +33,7 @@ function setup_file() {
_wait_for_service rspamd-redis _wait_for_service rspamd-redis
_wait_for_service rspamd _wait_for_service rspamd
_wait_for_rspamd_port_in_container
_wait_for_service amavis _wait_for_service amavis
_wait_for_service postfix _wait_for_service postfix
_wait_for_smtp_port_in_container _wait_for_smtp_port_in_container