Recently I upgraded dovecot quite a few major versions. Since then some
mailboxes are experiencing deleted mail reappearing. It seems to be happening
roughly once a day, but not for every mail client or mailbox, I have at least
two clients with this issue: Thunderbird and Outlook.
Storage is local under two partitions, one as alternative storage.
# 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.7.2 ()
# OS: Linux 5.4.0-29-generic x86_64 Ubuntu 20.04 LTS ext4
auth_mechanisms = plain login digest-md5
base_dir = /var/run/dovecot/
default_client_limit = 4000
default_vsz_limit = 512 M
dict {
expire = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
}
disable_plaintext_auth = no
lda_mailbox_autocreate = yes
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = mdbox:/home/vmail/%d/%n
mail_max_userip_connections = 240
mail_plugins = quota
mail_privileged_group = mail
mdbox_rotate_size = 64 M
namespace {
inbox = yes
location =
prefix =
separator = .
}
passdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
plugin {
quota = dict:user_quota::proxy:/var/run/dovecot/dict:quota
quota_warning = storage=95%% quota-warning 95 %u
quota_warning2 = storage=80%% quota-warning 80 %u
sieve = file:~/sieve;active=~/.dovecot.sieve
sieve_dir = ~/sieve
sieve_global_dir = /etc/dovecot/sieve/
}
protocols = imap pop3
service anvil {
client_limit = 2615
}
service auth {
client_limit = 5536
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
unix_listener auth-master {
group = root
mode = 0600
user = vmail
}
}
service dict {
unix_listener dict {
mode = 0600
user = vmail
}
}
service imap-login {
client_limit = 2115
executable = /usr/lib/dovecot/imap-login
inet_listener imap {
address = *
port = 143
}
inet_listener imaps {
address = *
port = 993
}
process_limit = 2000
}
service imap {
executable = /usr/lib/dovecot/imap
process_limit = 2000
}
service pop3-login {
client_limit = 1024
executable = /usr/lib/dovecot/pop3-login
inet_listener pop3 {
address = *
port = 110
}
inet_listener pop3s {
address = *
port = 995
}
process_limit = 512
}
service pop3 {
executable = /usr/lib/dovecot/pop3
}
service stats {
unix_listener stats-reader {
group = vmail
mode = 0660
user = vmail
}
unix_listener stats-writer {
group = vmail
mode = 0660
user = vmail
}
}
ssl_cert = < /etc/dovecot/ssl/crt.pem
ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
ssl_prefer_server_ciphers = yes
syslog_facility = local0
userdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
protocol imap {
imap_max_line_length = 64 k
mail_plugins = quota imap_quota
}
protocol pop3 {
mail_plugins = quota
pop3_uidl_format = %08Xu%08Xv
}
protocol lda {
auth_socket_path = /var/run/dovecot/auth-master
mail_plugins = quota sieve
postmaster_address = postmaster at localhost
sendmail_path = /usr/lib/sendmail
}
dovecot-sql.conf:
driver = mysql
connect = host=127.0.0.1 dbname=mail user=mail password=####
password_query = SELECT IF('%m' = 'DIGEST-MD5',
users.password_digest_md5, NULL) as password, IF('%m' =
'DIGEST-MD5', NULL, 'Y') as nopassword, username FROM users LEFT
JOIN domains ON users.domain = domains.domain WHERE users.username =
'%u' AND users.domain = '%d' AND users.active = 'yes'
AND domains.state = '1' AND ((users.password = encrypt('%w',
LEFT(users.password, 11)) AND ('%m' = 'PLAIN' OR '%m' =
'LOGIN')) OR ('%m' = 'DIGEST-MD5'))
user_query = SELECT maildir as home, uid, gid, CONCAT(CONCAT(type, ':',
maildir), ':ALT=/home/altmail/%d/%n') AS mail FROM users LEFT JOIN
domains ON users.domain = domains.domain WHERE users.username = '%u' AND
domains.state = '1'
iterate_query = SELECT SUBSTRING_INDEX(email, '@', 1) AS username,
domain FROM users;