On Mon, 2025-02-17 at 15:49 +0200, Timo Sirainen wrote:
     On 16. Feb 2025, at 17.03, Ken Wright via dovecot
     <dovecot@dovecot.org> wrote:
          mysql localhost {
            user = something
            password = MYPASSWORD
            dbname = something
          }
     ..
          According to the logs, Dovecot isn't trying to connect
          using the user
          something, it's using the user dovecot.  That's not the
          user for the
          database.

     The default mysql user is empty, not "dovecot". So it must be getting
     "dovecot" user from somewhere in your config. Look at your "doveconf"
     output - maybe the mysql_user gets overridden in some other config
     file. Things to look at:

     doveconf mysql
     doveconf | grep mysql
     doveconf

I went through every file in conf.d trying to find a mention of dovecot with no
positive results.  Then I tried the three things to look at you suggested, and
got this:

doveconf mysql:

mysql localhost {
dbname = database
password = # hidden, use -P to show it
user = DBuser
}

doveconf | grep mysql:

sql_driver = mysql
mysql localhost {

doveconf:

# 2.4.0-2+ubuntu24.04 (daeb6bc59c): /etc/dovecot/dovecot.conf
# Pigeonhole version 2.4.0-2+ubuntu24.04 (1b2d5bb9)
# OS: Linux 6.8.0-53-generic x86_64 Ubuntu 24.04.2 LTS ext4
# Hostname: localhost
dovecot_config_version = 2.4.0
auth_mechanisms =
auth_mechanisms {
plain = yes
login = yes
}
dovecot_storage_version = 2.4.0
mail_driver = maildir
mail_gid = vmail
mail_inbox_path = /var/vmail/%{user | domain}/%{user | username }
mail_path = /var/vmail/%{user | domain }/%{user | username }/Maildir
mail_uid = vmail
mailbox_list_utf8 = yes
passdb_default_password_scheme = ARGON2I
protocols =
protocols {
imap = yes
lmtp = yes
sieve = yes
}
sql_driver = mysql
ssl = required
ssl_server {
cert_file = /etc/letsencrypt/live/mailserver.example1.com/fullchain.pem
key_file = /etc/letsencrypt/live/mailserver.example1.com/privkey.pem
prefer_ciphers = server
}
namespace inbox {
mailbox Drafts {
auto = create
special_use =
special_use {
"\\Drafts" = yes
}
}
mailbox Junk {
auto = create
special_use =
special_use {
"\\Junk" = yes
}
}
mailbox Trash {
auto = create
special_use =
special_use {
"\\Trash" = yes
}
}
mailbox Sent {
auto = create
special_use =
special_use {
"\\Sent" = yes
}
}
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0600
user = postfix
}
}
mysql localhost {
dbname = database
password = # hidden, use -P to show it
user = DBuser
}
passdb sql {
query = SELECT username AS username, domain, password FROM mailbox WHERE
username = '%{user | username}' AND domain = '%{user | domain}' AND active= '1'
}
userdb sql {
iterate_query = SELECT username AS username, domain FROM mailbox
query = SELECT mail_path, uid, gid FROM mailbox WHERE username = '%{user |
username}' AND domain = '%{user | domain}' AND active= '1'
}
local 127.0.0.1 {
local_name mailserver.example1.com {
protocol imap {
ssl_server {
cert_file = /etc/letsencrypt/live/mailserver.example1.com/fullchain.pem
key_file = /etc/letsencrypt/live/mailserver.example1.com/privkey.pem
}
}
}
local_name mail.example2.net {
protocol imap {
ssl_server {
cert_file = /etc/letsencrypt/live/mail.example2.net/fullchain.pem
key_file = /etc/letsencrypt/live/mail.example2.net/privkey.pem
}
}
}
}

I can't find anything indicating a database user 'dovecot.'  Would you like to
see the results of tail /var/log/mail.log?

Ken
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org

Reply via email to