mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-06-24 17:58:58 +02:00
Dovecot: make home dir distinct from mail dir (#3335)
* add new home dir for Dovecot I tried changing the mail dir, but this is a _very_ disruptive change, so I took approach 3 on <https://doc.dovecot.org/configuration_manual/home_directories_for_virtual_users/>, whereby the home directory is now inside the mail directory. The MDBOX/SDBOX formats are not touched by this change. The change itself could be considered breaking though. * adjust Sieve tests accordingly * Update target/dovecot/10-mail.conf * Update target/dovecot/auth-passwdfile.inc --------- Co-authored-by: Casper <casperklein@users.noreply.github.com>
This commit is contained in:
parent
a72adc2731
commit
7453bc096b
6 changed files with 10 additions and 11 deletions
|
@ -77,7 +77,7 @@ function _create_accounts
|
|||
|
||||
# Dovecot's userdb has the following format
|
||||
# user:password:uid:gid:(gecos):home:(shell):extra_fields
|
||||
DOVECOT_USERDB_LINE="${LOGIN}:${PASS}:5000:5000::/var/mail/${DOMAIN}/${USER}::${USER_ATTRIBUTES}"
|
||||
DOVECOT_USERDB_LINE="${LOGIN}:${PASS}:5000:5000::/var/mail/${DOMAIN}/${USER}/home::${USER_ATTRIBUTES}"
|
||||
if grep -qF "${DOVECOT_USERDB_LINE}" "${DOVECOT_USERDB_FILE}"
|
||||
then
|
||||
_log 'warn' "Login '${LOGIN}' will not be added to '${DOVECOT_USERDB_FILE}' twice"
|
||||
|
@ -85,12 +85,12 @@ function _create_accounts
|
|||
echo "${DOVECOT_USERDB_LINE}" >>"${DOVECOT_USERDB_FILE}"
|
||||
fi
|
||||
|
||||
mkdir -p "/var/mail/${DOMAIN}/${USER}"
|
||||
mkdir -p "/var/mail/${DOMAIN}/${USER}/home"
|
||||
|
||||
# copy user provided sieve file, if present
|
||||
if [[ -e "/tmp/docker-mailserver/${LOGIN}.dovecot.sieve" ]]
|
||||
then
|
||||
cp "/tmp/docker-mailserver/${LOGIN}.dovecot.sieve" "/var/mail/${DOMAIN}/${USER}/.dovecot.sieve"
|
||||
cp "/tmp/docker-mailserver/${LOGIN}.dovecot.sieve" "/var/mail/${DOMAIN}/${USER}/home/.dovecot.sieve"
|
||||
fi
|
||||
done < <(_get_valid_lines_from_file "${DATABASE_ACCOUNTS}")
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ function _setup_dovecot
|
|||
|
||||
( 'sdbox' | 'mdbox' )
|
||||
_log 'trace' "Dovecot ${DOVECOT_MAILBOX_FORMAT} format configured"
|
||||
sed -i -e \
|
||||
"s|^mail_location = .*$|mail_location = ${DOVECOT_MAILBOX_FORMAT}:\/var\/mail\/%d\/%n|g" \
|
||||
sedfile -i -E "s|^(mail_home =).*|\1 /var/mail/%d/%n|" /etc/dovecot/conf.d/10-mail.conf
|
||||
sedfile -i -E \
|
||||
"s|^(mail_location =).*|\1 ${DOVECOT_MAILBOX_FORMAT}:/var/mail/%d/%n|" \
|
||||
/etc/dovecot/conf.d/10-mail.conf
|
||||
|
||||
_log 'trace' 'Enabling cron job for dbox purge'
|
||||
mv /etc/cron.d/dovecot-purge.disabled /etc/cron.d/dovecot-purge
|
||||
chmod 644 /etc/cron.d/dovecot-purge
|
||||
|
@ -35,7 +35,6 @@ function _setup_dovecot
|
|||
|
||||
( * )
|
||||
_log 'trace' 'Dovecot default format (maildir) configured'
|
||||
sed -i -e 's|^mail_location = .*$|mail_location = maildir:\/var\/mail\/%d\/%n|g' /etc/dovecot/conf.d/10-mail.conf
|
||||
;;
|
||||
|
||||
esac
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue