![Dovecot 通过 IMAPS 登录时出现错误](https://linux22.com/image/779727/Dovecot%20%E9%80%9A%E8%BF%87%20IMAPS%20%E7%99%BB%E5%BD%95%E6%97%B6%E5%87%BA%E7%8E%B0%E9%94%99%E8%AF%AF.png)
我有一台运行 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
据我所知,目录的权限没有问题。这尤其令人困惑,因为它似乎工作正常,但过了一段时间后就开始随机出现错误。删除每个收件箱中的索引文件可以让它重新开始工作,但显然这只是一种变通方法,而不是真正的解决方案。
答案1
经过一番研究,我发现 SELinux 阻止了 map 操作。一旦我添加了允许该操作所需的规则,一切似乎就开始正常工作了。显然,dovecot 在尝试执行此操作并中断之前能够运行一段时间。