Email

doveadm 備份不會從根 INBOX 傳輸郵件

  • March 28, 2019

我正在嘗試將 IMAP 郵件從 dovecot 1.1.20apple0.5 (osx) 遷移到 dovecot 2.2.33.2 (ubuntu)。我正在使用“doveadm 備份”來遷移我的數據。它適用於所有子文件夾,但根 INBOX 在新伺服器上保持為空。我懷疑與層次分隔符(以前的伺服器上的“.”,新伺服器上的“/”)或命名空間前綴(新伺服器上的設置為“INBOX/”)有關的問題。有什麼提示嗎?

顯示收件箱中沒有消息:

# doveadm mailbox status -u (myuser) all INBOX
INBOX messages=0 recent=0 uidnext=1 uidvalidity=1553630060 unseen=0 highestmodseq=1 vsize=0 guid=d54cd42849739b5cb5790000ed87e144 firstsaved=18446744073709551615

顯示子目錄中有消息:

# doveadm mailbox status -u (myuser) all INBOX/Sent
INBOX/Sent messages=253 recent=0 uidnext=8721 uidvalidity=1263328366 unseen=0 highestmodseq=256 vsize=16335358 guid=bfb2e03fdce327671e82bf173b1ccb8b firstsaved=1553634631

我在新伺服器上執行的用於遷移數據的命令:

# doveadm -o mail_fsync=never backup -R -u (myuser) imapc:

我在新伺服器上的配置:

# doveadm -n
# 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.21 (92477967)
# OS: Linux 4.15.0-46-generic x86_64 Ubuntu 18.04.2 LTS 
auth_default_realm = example.com
doveadm_password =  # hidden, use -P to show it
doveadm_port = 53683
first_valid_uid = 200
imapc_features = rfc822.size fetch-headers
imapc_host = oldmail.example.com
imapc_master_user = (removed)
imapc_password =  # hidden, use -P to show it
imapc_user = %n
last_valid_uid = 200
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_plugins = " notify replication zlib quota"
mail_prefetch_count = 20
mail_privileged_group = mail
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext
mdbox_rotate_size = 10 M
namespace inbox {
 inbox = yes
 location = 
 mailbox "Éléments envoyés" {
   special_use = \Sent
 }
 mailbox "Éléments supprimés" {
   special_use = \Trash
 }
 mailbox Brouillon {
   special_use = \Drafts
 }
 mailbox "Courrier indésirable" {
   special_use = \Junk
 }
 mailbox Drafts {
   auto = subscribe
   special_use = \Drafts
 }
 mailbox Junk {
   auto = subscribe
   special_use = \Junk
 }
 mailbox Sent {
   auto = subscribe
   special_use = \Sent
 }
 mailbox "Sent Messages" {
   special_use = \Sent
 }
 mailbox Trash {
   auto = subscribe
   special_use = \Trash
 }
 prefix = INBOX/
 separator = /
}
passdb {
 args = /etc/dovecot/dovecot-ldap.conf.ext
 driver = ldap
}
plugin {
 mail_replica = tcps:mail2.example.com:53683
 quota = count:User quota
 quota_grace = 10%%
 quota_rule = *:storage=10G
 quota_rule2 = INBOX/Trash:storage=+100M
 quota_vsizes = yes
 quota_warning = storage=100%% quota-warning 100 %u
 quota_warning2 = storage=95%% quota-warning 95 %u
 quota_warning3 = storage=90%% quota-warning 90 %u
 quota_warning4 = storage=85%% quota-warning 85 %u
 quota_warning5 = storage=75%% quota-warning 75 %u
 quota_warning6 = -storage=80%% quota-warning '-80' %u
 quota_warning7 = -storage=100%% quota-warning '-100' %u
 sieve = /var/vmail/domains/%Ld/%Ln/.dovecot.sieve
 sieve_before = /var/vmail/sieve/before.sieve
 sieve_default = /var/vmail/sieve/default.sieve
 sieve_global = /var/vmail/sieve/global
 zlib_save = lz4
}
protocols = " imap lmtp sieve"
service aggregator {
 fifo_listener replication-notify-fifo {
   user = vmail
 }
 unix_listener replication-notify {
   user = vmail
 }
}
service auth {
 inet_listener {
   address = (removed)
   port = 55123
 }
 unix_listener /var/spool/postfix/private/auth {
   mode = 0666
 }
}
service doveadm {
 inet_listener {
   port = 53683
   ssl = yes
 }
}
service imap-login {
 inet_listener imap {
   port = 0
 }
 process_min_avail = 10
}
service lmtp {
 unix_listener /var/spool/postfix/private/dovecot-lmtp {
   group = postfix
   mode = 0660
   user = postfix
 }
}
service quota-warning {
 executable = script /usr/local/bin/quota-warning.sh
 unix_listener quota-warning {
   user = vmail
 }
}
service replicator {
 process_min_avail = 1
 unix_listener replicator-doveadm {
   mode = 0600
   user = vmail
 }
}
ssl = required
ssl_cert = </etc/ssl/example/example.com.crtbundle
ssl_client_ca_dir = /etc/ssl/certs
ssl_key =  # hidden, use -P to show it
userdb {
 args = /etc/dovecot/dovecot-ldap.conf.ext
 driver = ldap
}
verbose_proctitle = yes
protocol lmtp {
 mail_plugins = " notify replication zlib quota sieve"
 postmaster_address = postmaster@example.com
}
protocol imap {
 mail_plugins = " notify replication zlib quota imap_zlib imap_quota"
}

配置 LDAP

# cat /etc/dovecot/dovecot-ldap.conf.ext | grep -v "^#" | grep -v "^$"
uris = ldaps://dc1.ad.example.com ldaps://dc2.ad.example.com
dn = (removed)
dnpass = (removed)
auth_bind = yes
base = (removed)
scope = subtree
deref = never
user_filter = (&(mail=%u)(memberOf:1.2.840.113556.1.4.1941:=CN=acces_courriels,(removed))(&(|(objectclass=person))(!(UserAccountControl:1.2.840.113556.1.4.803:=2))))
pass_filter = (&(mail=%u)(memberOf:1.2.840.113556.1.4.1941:=CN=acces_courriels,(removed))(&(|(objectclass=person))(!(UserAccountControl:1.2.840.113556.1.4.803:=2))))
iterate_filter = (&(mail=*)(memberOf:1.2.840.113556.1.4.1941:=CN=acces_courriels,(removed))(&(|(objectclass=person))(!(UserAccountControl:1.2.840.113556.1.4.803:=2))))
iterate_attrs = mail=user
user_attrs = \
 =quota_rule=*:storage=%{ldap:division:10G}, \
 =home=/var/vmail/domains/%Ld/%Ln, \
 =mail=mdbox:/var/vmail/domains/%Ld/%Ln/mdbox, \
 =uid=200, \
 =gid=200

我沒有找到如何使 doveadm 備份/同步正常工作,但我在 imapsync 上取得了成功。它慢得多,但它的工作原理!

引用自:https://serverfault.com/questions/960264