我有一个运行 dovecot 和 postfix 的 RedHat 8 服务器。Postfix 正在将消息传递到我的 maildir 文件夹中,并且 dovecot 被配置为通过 IMAPS 向用户提供这些消息。配置似乎大部分工作,但运行一段时间后,我的应用程序开始出现错误登录服务器。
尝试通过 IMAPS 登录时,我将收到以下消息:
NDC2 N0 [SERVERBUG] Internal error occurred. Refer to server log for more information.
当我查看 dovecot 日志时,我会看到如下错误消息:
Error: Mailbox INBOX: mmap failed: Permission denied (euid=xxx(user) egid=xxx(vmail) UNIX perms appear ok (ACL/MAC wrong?))
Error: Mailbox INBOX: mmap(/my/maildir/path/dovecot.index.cache) failed: Permission denied (euid=xxx(user) egid=xxx(vmail) UNIX perms appear ok (ACL/MAC wrong?))
Error: Mailbox INBOX: Index (in-memory index): in-memory index: Lost log for seq=1 offset=0: Failed to map file seq=2 offset=40..18446744073709551615 (ret=0): Beginning of the log isn't available (initial_mapped=0) - fscking (reopen_reason: Index not open)
Warning: fscking index file (in-memory index)
Error: Mailbox INBOX: Failed to map transaction log /my/maildir/path/dovecot.index.log at sync_offset=40 after locking: Beginning of the log isn't available
据我所知,目录的权限很好。这特别令人困惑,因为它似乎工作正常,然后在一段时间后随机开始给出错误。从每个收件箱中删除索引文件可以让它重新开始工作,但显然这是一种解决方法,而不是真正的解决方案。
经过一番研究,我发现 SELinux 阻止了 map 操作。一旦我添加了所需的规则以允许事情似乎开始正常工作。显然 dovecot 在尝试这样做并打破之前能够运行一段时间。