I was getting these errors below and after fixing it delivery errors were introduced
dovecot/error_log
dovecot: Jul 11 06:19:28 Error: auth-worker(default): sql(user@domain.com): User query failed: Table 'postfix.users' doesn't exist deliver(user@domain.com): Jul 11 06:19:28 Error: BUG: Unexpected input from auth master: FAIL 1 dovecot: Jul 11 06:21:41 Error: auth-worker(default): sql(admin@achimota.com,127.0.0.1): User query failed: Table 'postfix.users' doesn't exist
It turns out that using prefetch with dovecot lda required a user_query in dovecot/sql.conf I fixed it by adding this query to dovecot/sql.conf
user_query = SELECT concat('/var/vmail/', maildir) as home, 601 as uid, 12 as gid FROM mailbox WHERE username = '%u' AND active = '1'
This resulted in a new mailbox /var/vmail/domain.com/user@domain.com being created when although /var/vmail/domain.com/user already exists and is what the query returns
It seems that prior to that when the query was failing the mail was properly delivered somehow by dovecot, but fixing it created a new problem.
It appears that the mail_location = maildir:/var/vmail/%d/%u in dovecot.conf could be related as %u is user@domain.com
Is there a fix for this? Does the deliver line in postfix/master.cf need to be adjusted in some way
I will probably have to disable the user_query and restart for the time being
dovecot version - 1.0rc26
Here is dovecot.conf
ssl_cert_file = /etc/pki/dovecot/certs/abc.domain.net.crt ssl_key_file = /etc/pki/dovecot/private/abc.domain.net.key ssl_ca_file = /etc/pki/dovecot/certs/ca-bundle.crt mail_location = maildir:/var/vmail/%d/%u mail_extra_groups = mail first_valid_uid = 601 last_valid_uid = 601 maildir_copy_with_hardlinks = yes protocol imap { mail_plugins = quota imap_quota imap_client_workarounds = outlook-idle delay-newmail } protocol pop3 { mail_plugins = quota pop3_client_workarounds = outlook-no-nuls oe-ns-eoh } protocol lda { postmaster_address = postmaster@domain.net mail_plugins = quota log_path = /var/log/dovecot/deliver.log info_log_path = /var/log/dovecot/deliver.log } auth default { mechanisms = plain passdb sql { args = /etc/dovecot/sql.conf } userdb prefetch { } userdb sql { args = /etc/dovecot/sql.conf } user = nobody socket listen { master { path = /var/run/dovecot/auth-master mode = 0660 user = vmail group = mail } client { path = /var/spool/postfix/private/auth mode = 0660 user = postfix group = mail } } } dict { } plugin { quota = maildir:storage=10240:messages=1000 acl = vfile:/etc/dovecot/acls trash = /etc/dovecot/trash.conf }
dovecot/sql.conf
default_pass_scheme = PLAIN-MD5 driver = mysql connect = host=localhost dbname=postfix user=dovecot password=password password_query = SELECT username as user, password, concat('/var/vmail/', maildir) as userdb_home, concat('maildir:/var/vmail/', maildir) as userdb_mail, 601 as userdb_uid, 12 as userdb_gid, concat('dirsize:storage=', cast(quota as char)) AS userdb_quota FROM mailbox WHERE username = '%u' AND active = '1' user_query = SELECT concat('/var/vmail/', maildir) as home, 601 as uid, 12 as gid FROM mailbox WHERE username = '%u' AND active = '1'
dovecot line in postfix/master.cf
# Dovecot LDA dovecot unix - n n - - pipe flags=DRhu user=vmail:mail argv=/usr/local/libexec/dovecot/deliver -d ${recipient}
- Frank