mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-07-12 18:34:52 +02:00
fix: /var/mail-state
should not symlink non-existing directories (#4018)
Fixes an issue with the Getmail service, view PR thread for additional details. - Log an error when the expected service state directory doesn't exist. - The location `/var/lib/getmail/` doesn't seem like it should have been introduced. Drop it in favor of `/tmp/docker-mailserver/getmail`. It appears to be for storing remote mail that was retrieved if not configured to send to Dovecot like our docs advise. This location was never valid anyway (_as referenced issue covers_).
This commit is contained in:
parent
a780fb3311
commit
ed669bd314
6 changed files with 18 additions and 10 deletions
|
@ -31,6 +31,11 @@ function _setup_getmail() {
|
|||
EOF
|
||||
chmod -R 600 "${GETMAILRC}"
|
||||
fi
|
||||
|
||||
# Both the debug command and cron job (that runs getmail) for getmail
|
||||
# expect this location to exist.
|
||||
GETMAILDIR=/tmp/docker-mailserver/getmail
|
||||
mkdir -p "${GETMAILDIR}"
|
||||
else
|
||||
_log 'debug' 'Getmail is disabled'
|
||||
fi
|
||||
|
|
|
@ -23,7 +23,6 @@ function _setup_save_states() {
|
|||
[[ ${ENABLE_CLAMAV} -eq 1 ]] && SERVICEDIRS+=('lib/clamav')
|
||||
[[ ${ENABLE_FAIL2BAN} -eq 1 ]] && SERVICEDIRS+=('lib/fail2ban')
|
||||
[[ ${ENABLE_FETCHMAIL} -eq 1 ]] && SERVICEDIRS+=('lib/fetchmail')
|
||||
[[ ${ENABLE_GETMAIL} -eq 1 ]] && SERVICEDIRS+=('lib/getmail')
|
||||
[[ ${ENABLE_MTA_STS} -eq 1 ]] && SERVICEDIRS+=('lib/mta-sts')
|
||||
[[ ${ENABLE_POSTGREY} -eq 1 ]] && SERVICEDIRS+=('lib/postgrey')
|
||||
[[ ${ENABLE_RSPAMD} -eq 1 ]] && SERVICEDIRS+=('lib/rspamd')
|
||||
|
@ -70,11 +69,13 @@ function _setup_save_states() {
|
|||
rm -rf "${SERVICEDIR}"
|
||||
elif [[ -d ${SERVICEDIR} ]]; then
|
||||
_log 'trace' "Moving contents of ${SERVICEDIR} to ${DEST}"
|
||||
# Empty volume was mounted, or new content from enabling a feature ENV:
|
||||
# An empty volume was mounted, or new content dir now exists from enabling a feature ENV:
|
||||
mv "${SERVICEDIR}" "${DEST}"
|
||||
# Apply SELinux security context to match the state directory, so access
|
||||
# is not restricted to the current running container:
|
||||
chcon -R --reference="${STATEDIR}" "${DEST}" 2>/dev/null || true
|
||||
else
|
||||
_log 'error' "${SERVICEDIR} should exist but is missing"
|
||||
fi
|
||||
|
||||
# Symlink the original path in the container ($SERVICEDIR) to be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue