diff --git a/data/Dockerfiles/dovecot/docker-entrypoint.sh b/data/Dockerfiles/dovecot/docker-entrypoint.sh index 4305a084..bc964d31 100755 --- a/data/Dockerfiles/dovecot/docker-entrypoint.sh +++ b/data/Dockerfiles/dovecot/docker-entrypoint.sh @@ -128,15 +128,6 @@ user_query = SELECT CONCAT(JSON_UNQUOTE(JSON_VALUE(attributes, '$.mailbox_format iterate_query = SELECT username FROM mailbox WHERE active = '1' OR active = '2'; EOF -# Create pass dict for Dovecot -cat < /etc/dovecot/sql/dovecot-dict-sql-passdb.conf -# Autogenerated by mailcow -driver = mysql -connect = "host=/var/run/mysqld/mysqld.sock dbname=${DBNAME} user=${DBUSER} password=${DBPASS}" -default_pass_scheme = ${MAILCOW_PASS_SCHEME} -password_query = SELECT password FROM mailbox WHERE active = '1' AND username = '%u' AND domain IN (SELECT domain FROM domain WHERE domain='%d' AND active='1') AND JSON_UNQUOTE(JSON_VALUE(attributes, '$.force_pw_update')) != '1' AND (JSON_UNQUOTE(JSON_VALUE(attributes, '$.%s_access')) = '1' OR ('%s' != 'imap' AND '%s' != 'pop3')) -EOF - cat < /etc/dovecot/lua/passwd-verify.lua function auth_password_verify(req, pass) @@ -176,6 +167,7 @@ function auth_password_verify(req, pass) INNER JOIN mailbox ON mailbox.username = app_passwd.mailbox WHERE mailbox = '%s' AND IFNULL(JSON_UNQUOTE(JSON_VALUE(mailbox.attributes, '$.%s_access')), 1) = '1' + AND IFNULL(JSON_UNQUOTE(JSON_VALUE(mailbox.attributes, '$.force_pw_update')), 0) != '1' AND app_passwd.active = '1' AND mailbox.active = '1' AND app_passwd.domain IN (SELECT domain FROM domain WHERE domain='%s' AND active='1')]], con:escape(req.user), con:escape(req.service), con:escape(req.domain)))