[Dovecot] Allow to define static master user (not recommended)
parent
4817de6d27
commit
5f8e13f596
|
@ -219,6 +219,10 @@ done
|
||||||
RAND_USER=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 16 | head -n 1)
|
RAND_USER=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 16 | head -n 1)
|
||||||
RAND_PASS=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 24 | head -n 1)
|
RAND_PASS=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 24 | head -n 1)
|
||||||
|
|
||||||
|
if [[ ! -z ${DOVECOT_MASTER_USER} ]] && [[ ! -z ${DOVECOT_MASTER_PASS} ]]; then
|
||||||
|
RAND_USER=${DOVECOT_MASTER_USER}
|
||||||
|
RAND_PASS=${DOVECOT_MASTER_PASS}
|
||||||
|
fi
|
||||||
echo ${RAND_USER}@mailcow.local:{SHA1}$(echo -n ${RAND_PASS} | sha1sum | awk '{print $1}'):::::: > /etc/dovecot/dovecot-master.passwd
|
echo ${RAND_USER}@mailcow.local:{SHA1}$(echo -n ${RAND_PASS} | sha1sum | awk '{print $1}'):::::: > /etc/dovecot/dovecot-master.passwd
|
||||||
echo ${RAND_USER}@mailcow.local::5000:5000:::: > /etc/dovecot/dovecot-master.userdb
|
echo ${RAND_USER}@mailcow.local::5000:5000:::: > /etc/dovecot/dovecot-master.userdb
|
||||||
echo ${RAND_USER}@mailcow.local:${RAND_PASS} > /etc/sogo/sieve.creds
|
echo ${RAND_USER}@mailcow.local:${RAND_PASS} > /etc/sogo/sieve.creds
|
||||||
|
|
|
@ -192,7 +192,7 @@ services:
|
||||||
- sogo
|
- sogo
|
||||||
|
|
||||||
dovecot-mailcow:
|
dovecot-mailcow:
|
||||||
image: mailcow/dovecot:1.133
|
image: mailcow/dovecot:1.134
|
||||||
depends_on:
|
depends_on:
|
||||||
- mysql-mailcow
|
- mysql-mailcow
|
||||||
dns:
|
dns:
|
||||||
|
@ -213,6 +213,8 @@ services:
|
||||||
- rspamd-vol-1:/var/lib/rspamd:z
|
- rspamd-vol-1:/var/lib/rspamd:z
|
||||||
- mysql-socket-vol-1:/var/run/mysqld/:z
|
- mysql-socket-vol-1:/var/run/mysqld/:z
|
||||||
environment:
|
environment:
|
||||||
|
- DOVECOT_MASTER_USER=${DOVECOT_MASTER_USER:-}
|
||||||
|
- DOVECOT_MASTER_PASS=${DOVECOT_MASTER_PASS:-}
|
||||||
- LOG_LINES=${LOG_LINES:-9999}
|
- LOG_LINES=${LOG_LINES:-9999}
|
||||||
- DBNAME=${DBNAME}
|
- DBNAME=${DBNAME}
|
||||||
- DBUSER=${DBUSER}
|
- DBUSER=${DBUSER}
|
||||||
|
|
|
@ -303,6 +303,14 @@ MAILDIR_SUB=Maildir
|
||||||
# SOGo session timeout in minutes
|
# SOGo session timeout in minutes
|
||||||
SOGO_EXPIRE_SESSION=480
|
SOGO_EXPIRE_SESSION=480
|
||||||
|
|
||||||
|
# DOVECOT_MASTER_USER and DOVECOT_MASTER_PASS must both be provided. No special chars.
|
||||||
|
# Empty by default to auto-generate master user and password on start.
|
||||||
|
# User expands to DOVECOT_MASTER_USER@mailcow.local
|
||||||
|
# LEAVE EMPTY IF UNSURE
|
||||||
|
DOVECOT_MASTER_USER=
|
||||||
|
# LEAVE EMPTY IF UNSURE
|
||||||
|
DOVECOT_MASTER_PASS=
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
mkdir -p data/assets/ssl
|
mkdir -p data/assets/ssl
|
||||||
|
|
17
update.sh
17
update.sh
|
@ -215,6 +215,8 @@ CONFIG_ARRAY=(
|
||||||
"SKIP_HTTP_VERIFICATION"
|
"SKIP_HTTP_VERIFICATION"
|
||||||
"SOGO_EXPIRE_SESSION"
|
"SOGO_EXPIRE_SESSION"
|
||||||
"REDIS_PORT"
|
"REDIS_PORT"
|
||||||
|
"DOVECOT_MASTER_USER"
|
||||||
|
"DOVECOT_MASTER_PASS"
|
||||||
)
|
)
|
||||||
|
|
||||||
sed -i --follow-symlinks '$a\' mailcow.conf
|
sed -i --follow-symlinks '$a\' mailcow.conf
|
||||||
|
@ -373,6 +375,21 @@ for option in ${CONFIG_ARRAY[@]}; do
|
||||||
echo "Adding new option \"${option}\" to mailcow.conf"
|
echo "Adding new option \"${option}\" to mailcow.conf"
|
||||||
echo "REDIS_PORT=127.0.0.1:7654" >> mailcow.conf
|
echo "REDIS_PORT=127.0.0.1:7654" >> mailcow.conf
|
||||||
fi
|
fi
|
||||||
|
elif [[ ${option} == "DOVECOT_MASTER_USER" ]]; then
|
||||||
|
if ! grep -q ${option} mailcow.conf; then
|
||||||
|
echo "Adding new option \"${option}\" to mailcow.conf"
|
||||||
|
echo '# DOVECOT_MASTER_USER and DOVECOT_MASTER_PASS must _both_ be provided. No special chars.' >> mailcow.conf
|
||||||
|
echo '# Empty by default to auto-generate master user and password on start.' >> mailcow.conf
|
||||||
|
echo '# User expands to DOVECOT_MASTER_USER@mailcow.local' >> mailcow.conf
|
||||||
|
echo '# LEAVE EMPTY IF UNSURE' >> mailcow.conf
|
||||||
|
echo "DOVECOT_MASTER_USER=" >> mailcow.conf
|
||||||
|
fi
|
||||||
|
elif [[ ${option} == "DOVECOT_MASTER_PASS" ]]; then
|
||||||
|
if ! grep -q ${option} mailcow.conf; then
|
||||||
|
echo "Adding new option \"${option}\" to mailcow.conf"
|
||||||
|
echo '# LEAVE EMPTY IF UNSURE' >> mailcow.conf
|
||||||
|
echo "DOVECOT_MASTER_PASS=" >> mailcow.conf
|
||||||
|
fi
|
||||||
elif ! grep -q ${option} mailcow.conf; then
|
elif ! grep -q ${option} mailcow.conf; then
|
||||||
echo "Adding new option \"${option}\" to mailcow.conf"
|
echo "Adding new option \"${option}\" to mailcow.conf"
|
||||||
echo "${option}=n" >> mailcow.conf
|
echo "${option}=n" >> mailcow.conf
|
||||||
|
|
Loading…
Reference in New Issue