Dovecot IMAP 伺服器與 Horde Groupware ActiveSync - IMAP 伺服器不報告變更的狀態

Dovecot IMAP 伺服器與 Horde Groupware ActiveSync - IMAP 伺服器不報告變更的狀態

我有一個 Horde Groupware,在 Debian Linux 上運行著一個 Dovecot IMAP 伺服器。

使用 Horde 的 Web UI 效果很好,但我在使用 ActiveSync 時遇到問題。

在 Android 上使用 BlueMail 等客戶端應用程式時,我在收件匣中看不到最新的電子郵件。

activesync 日誌顯示以下內容:

[163168][2022-11-11T15:08:44+00:00] >>>: INBOX IMAP PREVIOUS MODSEQ: 190086

此行顯示收件匣上次同步時的 MODSEQ 值為 190086。

[163168][2022-11-11T15:08:44+00:00] >>>: IMAP status: a:4:{s:8:"messages";i:6874;s:7:"uidnext";i:157933;s:11:"uidvalidity";i:1291740963;s:13:"highestmodseq";i:190086;}

此行顯示我的 IMAP 伺服器報告的 CURRENT MODSEQ,顯示伺服器沒有報告任何更改的狀態。

這怎麼可能?我在收件匣中收到了新電子郵件,但它沒有顯示在應用程式中。

透過 Thunderbird 直接存取 IMAP 伺服器,所有新電子郵件都會顯示。

它以前可以在 FreeBSD 上的 Dovecot 伺服器上運行,但我已將 Dovecot 遷移到 Debian Linux。

我的 Dovecot 配置可能有問題嗎?

我主要使用 Dovecot 的標準配置,尤其是 IMAP 設定。

這是我的 imap 特定配置:

##
## IMAP specific settings
##

# If nothing happens for this long while client is IDLEing, move the connection
# to imap-hibernate process and close the old imap process. This saves memory,
# because connections use very little memory in imap-hibernate process. The
# downside is that recreating the imap process back uses some resources.
#imap_hibernate_timeout = 0

# Maximum IMAP command line length. Some clients generate very long command
# lines with huge mailboxes, so you may need to raise this if you get
# "Too long argument" or "IMAP command line too large" errors often.
#imap_max_line_length = 64k

# IMAP logout format string:
#  %i - total number of bytes read from client
#  %o - total number of bytes sent to client
#  %{fetch_hdr_count} - Number of mails with mail header data sent to client
#  %{fetch_hdr_bytes} - Number of bytes with mail header data sent to client
#  %{fetch_body_count} - Number of mails with mail body data sent to client
#  %{fetch_body_bytes} - Number of bytes with mail body data sent to client
#  %{deleted} - Number of mails where client added \Deleted flag
#  %{expunged} - Number of mails that client expunged, which does not
#                include automatically expunged mails
#  %{autoexpunged} - Number of mails that were automatically expunged after
#                    client disconnected
#  %{trashed} - Number of mails that client copied/moved to the
#               special_use=\Trash mailbox.
#  %{appended} - Number of mails saved during the session
#imap_logout_format = in=%i out=%o deleted=%{deleted} expunged=%{expunged} \
#  trashed=%{trashed} hdr_count=%{fetch_hdr_count} \
#  hdr_bytes=%{fetch_hdr_bytes} body_count=%{fetch_body_count} \
#  body_bytes=%{fetch_body_bytes}

# Override the IMAP CAPABILITY response. If the value begins with '+',
# add the given capabilities on top of the defaults (e.g. +XFOO XBAR).
#imap_capability =

# How long to wait between "OK Still here" notifications when client is
# IDLEing.
#imap_idle_notify_interval = 2 mins

# ID field names and values to send to clients. Using * as the value makes
# Dovecot use the default value. The following fields have default values
# currently: name, version, os, os-version, support-url, support-email,
# revision.
#imap_id_send =

# ID fields sent by client to log. * means everything.
#imap_id_log =

# Workarounds for various client bugs:
#   delay-newmail:
#     Send EXISTS/RECENT new mail notifications only when replying to NOOP
#     and CHECK commands. Some clients ignore them otherwise, for example OSX
#     Mail (<v2.1). Outlook Express breaks more badly though, without this it
#     may show user "Message no longer in server" errors. Note that OE6 still
#     breaks even with this workaround if synchronization is set to
#     "Headers Only".
#   tb-extra-mailbox-sep:
#     Thunderbird gets somehow confused with LAYOUT=fs (mbox and dbox) and
#     adds extra '/' suffixes to mailbox names. This option causes Dovecot to
#     ignore the extra '/' instead of treating it as invalid mailbox name.
#   tb-lsub-flags:
#     Show \Noselect flags for LSUB replies with LAYOUT=fs (e.g. mbox).
#     This makes Thunderbird realize they aren't selectable and show them
#     greyed out, instead of only later giving "not selectable" popup error.
#
# The list is space-separated.
#imap_client_workarounds =

# Host allowed in URLAUTH URLs sent by client. "*" allows all.
#imap_urlauth_host =

# Enable IMAP LITERAL- extension (replaces LITERAL+)
#imap_literal_minus = no

# What happens when FETCH fails due to some internal error:
#   disconnect-immediately:
#     The FETCH is aborted immediately and the IMAP client is disconnected.
#   disconnect-after:
#     The FETCH runs for all the requested mails returning as much data as
#     possible. The client is finally disconnected without a tagged reply.
#   no-after:
#     Same as disconnect-after, but tagged NO reply is sent instead of
#     disconnecting the client. If the client attempts to FETCH the same failed
#     mail more than once, the client is disconnected. This is to avoid clients
#     from going into infinite loops trying to FETCH a broken mail.
#imap_fetch_failure = disconnect-immediately

protocol imap {
  # Space separated list of plugins to load (default is global mail_plugins).
  #mail_plugins = $mail_plugins

  # Maximum number of IMAP connections allowed for a user from each IP address.
  # NOTE: The username is compared case-sensitively.
  #mail_max_userip_connections = 10

我的 maildir 特定設定:


##
## Maildir-specific settings
##

# By default LIST command returns all entries in maildir beginning with a dot.
# Enabling this option makes Dovecot return only entries which are directories.
# This is done by stat()ing each entry, so it causes more disk I/O.
# (For systems setting struct dirent->d_type, this check is free and it's
# done always regardless of this setting)
#maildir_stat_dirs = no

# When copying a message, do it with hard links whenever possible. This makes
# the performance much better, and it's unlikely to have any side effects.
#maildir_copy_with_hardlinks = yes

# Assume Dovecot is the only MUA accessing Maildir: Scan cur/ directory only
# when its mtime changes unexpectedly or when we can't find the mail otherwise.
maildir_very_dirty_syncs = no

# If enabled, Dovecot doesn't use the S=<size> in the Maildir filenames for
# getting the mail's physical size, except when recalculating Maildir++ quota.
# This can be useful in systems where a lot of the Maildir filenames have a
# broken size. The performance hit for enabling this is very small.
#maildir_broken_filename_sizes = no

# Always move mails from new/ directory to cur/, even when the \Recent flags
# aren't being reset.
#maildir_empty_new = no

有人知道為什麼 MODSEQ 不更新嗎?

鴿舍-n:

# 2.3.13 (89f716dc2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.13 (cdd19fe3)
# OS: Linux 5.10.0-19-amd64 x86_64 Debian 11.5
# Hostname: mail01.public.forberger-online.de
auth_mechanisms = plain login
mail_location = maildir:~/.maildir
mail_privileged_group = mail
mailbox_list_index_include_inbox = yes
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix =
}
passdb {
  driver = pam
}
protocols = " imap"
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
}
service imap-login {
  client_limit = 256
  inet_listener imap {
    address = 192.168.108.1, 127.0.0.1, [::1]
    port = 143
  }
  inet_listener imaps {
    address = 192.168.108.1, 127.0.0.1, [::1]
    port = 993
    ssl = yes
  }
  process_min_avail = 6
}
ssl_ca = </etc/letsencrypt/live/mail.forberger-online.de/chain.pem
ssl_cert = </etc/letsencrypt/live/mail.forberger-online.de/cert.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
ssl_min_protocol = TLSv1.2
userdb {
  driver = passwd
}

重要提示:資料夾 INBOX 上的 MODSEQ 不會增加:

* OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ AUTH=PLAIN AUTH=LOGIN] Dovecot (Debian) ready.
A login REDACTED REDACTED
A OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY STATUS=SIZE SAVEDATE LITERAL+ NOTIFY SPECIAL-USE] Logged in
A status INBOX (messages)
* STATUS INBOX (MESSAGES 7247)
A OK Status completed (0.001 + 0.000 secs).
1 SELECT Inbox
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $MDNSent Junk NonJunk $label4 $label1 $label2 $label3 $label5 Old $Forwarded NOTJUNK $has_cal)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft $MDNSent Junk NonJunk $label4 $label1 $label2 $label3 $label5 Old $Forwarded NOTJUNK $has_cal \*)] Flags permitted.
* 7247 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1291740963] UIDs valid
* OK [UIDNEXT 158406] Predicted next UID
* OK [HIGHESTMODSEQ 190086] Highest
1 OK [READ-WRITE] Select completed (0.010 + 0.000 + 0.009 secs).

正如您所看到的,HIGHESTMODSEQ 保持在 190086。

為什麼 HIGHESTMODSEQ 不增加可能是什麼問題?

答案1

你知道有什麼方法可以測試 IMAP 伺服器是否增加了 MODSEQ

似乎下一個合乎邏輯的步驟是手動連接並

  1. 當(預期和宣傳的)CONDSTORE 功能不可用時,堅持使用會產生錯誤的命令。
  2. 當使用之前和之後測試的操作重複請求時,檢查哪個操作(接收訊息、使用 Thunderbird 拖放在資料夾之間移動訊息、執行doveadm index, doveadm force-resync, ..)執行以及哪個操作不會增加HIGHESTMODSEQDovecot 報告的值。SELECT

像這樣:

# openssl s_client -quiet -crlf -connect [::1]:993
* OK [CAPABILITY IMAP4rev1  .. AUTH=LOGIN ..] Dovecot (Debian) ready.
A LOGIN [email protected] password
A OK [CAPABILITY IMAP4rev1  .. CONDSTORE QRESYNC ..] Logged in
A ENABLE CONDSTORE QRESYNC
* OK [HIGHESTMODSEQ 1337] Highest
* ENABLED CONDSTORE QRESYNC
A OK ENABLED (..).
A SELECT INBOX (CONDSTORE)
...
* OK [HIGHESTMODSEQ 1338] Highest
A OK [READ-WRITE] SELECT completed (..).
A SELECT INBOX (CONDSTORE)
...
* OK [HIGHESTMODSEQ 1400] Highest
A OK [READ-WRITE] SELECT completed (..).

確認 IMAP 等級已存在問題後,您可以繼續該等級。或甚至調查數字 190086 到底來自哪裡。我正在考慮一種邊緣情況,Dovecot 錯誤地報告了一個數字,該數字指的是無法更新的內容,因為它不再可訪問。透過讀取索引檔案的文字表示形式會將您指向該訊息 - 在該訊息上新增 IMAP 標誌應該會觸發doveadm mailbox status -u [email protected] all NewlyCreatedFolderdoveadm dump -t index /file/path/to/mailbox/dovecot.index | grep -B 10 -A 100 "modseq.*190086"一些結果可能顯示問題的本質。

答案2

現在又可以用了。我使用重新建立了郵件目錄(我只有一個)maildirmake並將郵件移回原處。感謝您的所有幫助。

相關內容