From: Jean-Marc Pigeon (Delson) Date: Wed, 9 Jul 2025 21:51:25 +0000 (-0400) Subject: dovecot, authentication with digest-md5 working with postgresql X-Git-Tag: tag-0.13~5 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=349a53fa719be31b6c2d02ff5bcd526c63e58efa;p=jmp%2Fmailleur dovecot, authentication with digest-md5 working with postgresql --- diff --git a/conf/dovecot/dovecot.conf b/conf/dovecot/dovecot.conf index 9906acb..949c018 100644 --- a/conf/dovecot/dovecot.conf +++ b/conf/dovecot/dovecot.conf @@ -10,10 +10,14 @@ first_valid_gid=12 #-------------------------------------------------------------------------- #debug level -mail_debug=no -auth_debug=no -auth_verbose=yes -auth_debug_passwords=yes +auth_debug = yes +auth_debug_passwords = yes +#auth_mechanisms = plain login digest-md5 +auth_mechanisms = digest-md5 +auth_verbose = yes +auth_verbose_passwords = plain +mail_uid = mailleur +mail_debug = yes log_path=/var/log/dovecot.log #-------------------------------------------------------------------------- @@ -43,14 +47,9 @@ service pop3-login { #-------------------------------------------------------------------------- #email repository mail_location=maildir:/var/spool/mailleur/mails/%d/%n +#Cautions THIS realm value is HARDCODED within code AND database +auth_realms = mailleur-email -auth_debug = yes -auth_debug_passwords = yes -auth_mechanisms = plain login -auth_verbose = yes -auth_verbose_passwords = plain -mail_uid = mailleur -mail_debug = yes #-------------------------------------------------------------------------- #email authentication # diff --git a/data-feed/feed01.tst b/data-feed/feed01.tst index cc4badb..5ff901a 100644 --- a/data-feed/feed01.tst +++ b/data-feed/feed01.tst @@ -5,18 +5,18 @@ R:220 mailleur.example.com, ESMTP (cleartext) mailleur... S:EHLO example.com #R:250-mailleur.example.com, link (cleartext) ready, your IP/FQDN=[127.127.0.2/feed2.example.com] R:250-mailleur.example.com, link (cleartext) ready,... -R:250-SIZE 52428800 R:250-STARTTLS +R:250-AUTH DIGEST-MD5 +R:250-SIZE 52428800 R:250-8BITMIME -R:250-ENHANCEDSTATUSCODES -R:250 AUTH PLAIN LOGIN +R:250 ENHANCEDSTATUSCODES C:GOTLS S:EHLO example.com R:250-mailleur.example.com, link (crypted) ready,... +R:250-AUTH PLAIN LOGIN DIGEST-MD5 R:250-SIZE 52428800 R:250-8BITMIME -R:250-ENHANCEDSTATUSCODES -R:250 AUTH PLAIN LOGIN +R:250 ENHANCEDSTATUSCODES S:MAIL FROM: R:250 2.1.3 postmaster@example.com.. sender ok S:RCPT TO: diff --git a/support/addconfig.sh b/support/addconfig.sh index 44f4fcb..a798215 100755 --- a/support/addconfig.sh +++ b/support/addconfig.sh @@ -25,17 +25,19 @@ echo "#"`date` case "$DB_TYPE" in "POSTGRESQL" ) echo "driver = pgsql" + echo "default_pass_scheme = digest-md5" echo "connect= dbname=$APPNAME" - echo "password_query=SELECT password FROM emails WHERE email='%u'" + echo "password_query=SELECT hash as password FROM emails WHERE email='%u'" echo "user_query=SELECT 'mailleur' AS uid,'mail' AS gid,'$SPOOLDIR/%d/%n' AS home,'maildir:~' AS mail,'*:storage='||mxspace||'M' AS quota_rule FROM emails WHERE email='%u'" ;; "MYSQL" ) echo "driver = mysql" + echo "default_pass_scheme = digest-md5" echo "connect= host=localhost dbname=$APPNAME" - echo "password_query=SELECT password FROM emails WHERE email='%u'" + echo "password_query=SELECT hash as password FROM emails WHERE email='%u'" echo "user_query=SELECT 'mailleur' AS uid,'mail' AS gid,'$SPOOLDIR/%d/%n' AS home,'maildir:~' AS mail,concat('*:storage=',mxspace,'M') AS quota_rule from emails WHERE email='%u'" ;; esac -) >> /etc/$APPNAME/dovecot/dovecot-sql.conf +) >> /etc/$APPNAME/dovecot/dovecot-sql.conf 2>&1