出于测试目的,我想禁用 Dovecot IMAP 服务器中的特定功能。在文档中,我只找到
imap_capability Default: <empty> Values: String
覆盖 IMAP CAPABILITY 响应。
如果该值以 + 字符开头,则此处列出的功能将添加到默认字符串的末尾。
例子:
imap_capability = +XFOO XBAR
但是,它没有解释如何禁用单个功能?
出于测试目的,我想禁用 Dovecot IMAP 服务器中的特定功能。在文档中,我只找到
imap_capability Default: <empty> Values: String
覆盖 IMAP CAPABILITY 响应。
如果该值以 + 字符开头,则此处列出的功能将添加到默认字符串的末尾。
例子:
imap_capability = +XFOO XBAR
但是,它没有解释如何禁用单个功能?
我有一个 Dovecot 服务器,它使用 MariaDB 作为虚拟邮箱。MariaDB 服务器位于同一 LAN 中的另一台计算机上。
我们最近在 MariaDB 机器上启用了 TLS。
Dovecot 在关闭时工作正常,但当我们在 MariaDB 配置文件中打开require_secure_transport
时无法连接。require_secure_transport
错误是:
Error: mysql(xxx.xxx.xxx.xxx): Connect failed to database (db_name): Access denied for user 'db_user'@'xxx.xxx.xxx.xxx' (using password: YES)
这看起来像是一个身份验证错误,但在关闭时使用相同的用户和密码连接可以正常工作require_secure_transport
,因此 MariaDB 拒绝连接,因为 Dovecot 不使用 TLS。
连接字符串/etc/dovecot/dovecot-sql.conf.ext
如下所示:
connect = host=db0.mydomain.com dbname=my_db user=the_user password=secret ssl_ca=/etc/ssl/authority/authority.crt
配置文件说:
ssl_ca、ssl_ca_path - 设置其中之一或两者以启用 SSL
我可以获得错误的更多详细信息吗?例如,如果 TLS 版本不匹配,我可以将其显示在某处吗?
Dovecot 中是否有需要更改的设置?
更新:添加ssl_verify_server_cert=no
到连接字符串中/etc/dovecot/dovecot-sql.conf.ext
允许连接正常工作。
所以这似乎是证书验证错误。但如果没有更详细的日志记录,我不确定它不喜欢证书的什么。
证书由 CA 在连接字符串中签名。最好知道它正在检查什么通用名称,以及 Dovecot 是否会使用任何 SAN 值作为证书。
我在使用 Dovecot + Postfix 设置提交时遇到问题。
doveadm auth login user pass
给出正确的输出。
当我尝试发送带有提交的邮件时,它给出身份验证失败错误。
doveconf -n
输出:
auth_mechanisms = plain login
disable_plaintext_auth = no
mail_location = maildir:/home/vmail/%d/%n
mail_privileged_group = vmail
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 {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
protocols = " imap lmtp submission"
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
}
service lmtp {
unix_listener /var/spool/postfix/private/lmtp {
group = postfix
mode = 0600
user = postfix
}
}
ssl_cert = < some_crt
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
我将 maildir 用户从旧的 courier imap 安装迁移到 docker alpine:latest 上的 dovecot。最初一切看起来都很好,但是,问题似乎已经悄然出现。由于缓存大小差异,某些消息将无法获取,日志最终如下所示:
不是很有帮助。基于此处的此条目: https ://xpufx.com/posts/dovecot_doveadm_failed_cache_message_size_error/
我认为两个服务配置之间不匹配,但我没有看到任何明显的东西,我应该将 zlib 设置为全局配置吗?
邮件目录中的邮件均未压缩。除了一些关于 mbox 的抱怨之外,谷歌上没有太多关于此的信息。
将 Ubuntu 从 20.04 升级到 22.04 后,我在启动 dovecot 时遇到问题,并收到以下错误:
$ sudo dovecot -F
doveconf: Fatal: execvp(/usr/sbin/dovecot) failed: Argument list too long
经过一番搜索后,我发现你必须提高ARG_MAX
变量,但我不知道如何。
我尝试在ulimit
、sysconf
和中寻找解决方案exec
。
$ sudo getconf ARG_MAX
2097152
$ getconf ARG_MAX
6291456
我已将以下内容添加到/etc/secutiry/limits.conf
:
root soft nofile 65535
root hard nofile 65535
LimitNOFILE=65536
但dovecot.service
它仍然抛出同样的错误!
$ sudo doveconf -n
auth_debug = yes
auth_debug_passwords = yes
auth_mechanisms = PLAIN
auth_verbose = yes
disable_plaintext_auth = no
log_path = /var/log/dovecot.log
mail_home = /home/vmail/%d/%u
mail_location = maildir:~
passdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
protocols = imap pop3
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
user = root
}
ssl = required
ssl_ca = </etc/ssl/certs/ca-certificates.crt
ssl_cert = </etc/letsencrypt/live/*.nl/fullchain.pem
ssl_cipher_list = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
ssl_prefer_server_ciphers = yes
userdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
local_name mail.*.nl {
protocol imap {
ssl_ca = </etc/ssl/certs/ca-certificates.crt
ssl_cert = </etc/letsencrypt/live/*.nl/fullchain.pem
ssl_key = # hidden, use -P to show it
}
}
local_name mail.*.nl {
protocol pop3 {
ssl_ca = </etc/ssl/certs/ca-certificates.crt
ssl_cert = </etc/letsencrypt/live/*.nl/fullchain.pem
ssl_key = # hidden, use -P to show it
}
}
退出代码:89
这在 procmail 中有效,但似乎 procmail在 2001 年 9 月被放弃了。当在“收件人:”标头中使用 utf-8 来使用表情符号或非拉丁字符写我的名字时,我有一个规则可以感知。当我在 Dovecot 的 Sieve 实现“Pigeonhole”中尝试同样的操作时,我很沮丧,因为它似乎丢弃了一些数据。
参考。RFC5228 参考中的筛选规则
。Dovecot Pigeonhole 实施
我尝试了什么:
require ["fileinto"];
if header :contains ["to", "from"] "=?utf-8?B?" { fileinto "Junk"; }
elsif address :contains :all ["to", "from"] "=?utf-8?B?" { fileinto "Junk"; }
使用此示例数据:
From: "=?utf-8?B?TWluaSBXdQ==?=" <[email protected]>
To: "=?utf-8?B?Q1VTVA==?=" <[email protected]>
Subject: =?utf-8?B?UmU6TWljcm9jaGlwIFRleGFzIE9mZmVy?=
Date: Mon, 20 Mar 2023 16:12:50 +0900
Hello potential customer! Please stop whatever you're
doing and pay attention to me!
我得到什么:
sieve-test -Tlevel=matching -t - /tmp/badmail.sieve /tmp/badmail.txt
## Started executing script 'badmail'
2: header test
2: starting `:contains' match with `i;ascii-casemap' comparator:
2: extracting `to' headers from message
2: matching value `"CUST" <[email protected]>'
2: with key `=?utf-8?B?' => 0
2: extracting `from' headers from message
2: matching value `"Mini Wu" <[email protected]>'
2: with key `=?utf-8?B?' => 0
2: finishing match with result: not matched
2: jump if result is false
2: jumping to line 3
3: address test
3: starting `:contains' match with `i;ascii-casemap' comparator:
3: extracting `to' headers from message
3: parsing address header value `"=?utf-8?B?Q1VTVA==?=" <[email protected]>'
3: address value `[email protected]'
3: extracting `all' part from address <[email protected]>
3: matching value `[email protected]'
3: with key `=?utf-8?B?' => 0
3: extracting `from' headers from message
3: parsing address header value `"=?utf-8?B?TWluaSBXdQ==?=" <[email protected]>'
3: address value `[email protected]'
3: extracting `all' part from address <[email protected]>
3: matching value `[email protected]'
3: with key `=?utf-8?B?' => 0
3: finishing match with result: not matched
3: jump if result is false
3: jumping to line 3
## Finished executing script 'badmail'
Implicit keep: store message in folder: INBOX
它在跟踪输出中记录了“=?utf-8?B?...”,所以我知道它知道。但是 'header' 测试和 'address' 测试都在执行之前丢弃了该数据。我还尝试了:comparator "i;octet"
而不是默认的“i;ascii-casemap”,结果相同。
我如何测试原始标头而不是这些解释值?
我有一个运行在 AlmaLinux 上的 VPS。对于 SMTP,我使用 sendmail,它成功地为我的两个域名发送和接收了电子邮件。我设置了 Dovecot 来处理 IMAP/POP3。我想允许 Gmail 帐户使用 Gmail 提供的“检查来自其他帐户的邮件”功能从我的一个域名(我们称之为 example.com)接收电子邮件。不幸的是,我无法让它发挥作用。
事情是这样的:
我很确定 Dovecot 已正确配置以处理 POP3 连接。在我的电脑上,我可以在命令行中输入以下内容:
openssl s_client -starttls pop3 -connect mail.example.com:110
如果我然后输入USER fake_username
and PASS fake_password
,我可以执行 POP 命令(例如LIST
and STAT
)并获得正确的响应。
此外,我在本地计算机上配置 Thunderbird 使用 POP3 从 mail.example.com 读取电子邮件。在 Thunderbird 中,我可以使用以下帐户设置阅读电子邮件:
Server Name: mail.example.com
Port: 110
User Name: fake_username
Connection Security: STARTTLS
Authentication Method: Normal Password
...虽然电子邮件来得很顺利。
但是,当我在 Gmail 中使用相同的信息(mail.example.com、端口 110、正确的用户名、正确的密码)时,我收到两条错误消息之一,具体取决于我是否选中了“始终使用安全连接 ( SSL) 在检索邮件时。”
如果我未选中该复选框,在 Web 表单上,我会看到以下错误消息:
“服务器拒绝对给定的用户名和密码进行 POP3 访问。”
在我的服务器日志 ( dovecot.log
) 上,我看到以下内容:
Mar 19 12:27:36 pop3-login: Info: Disconnected: Disconnected: Too many bad commands (no auth attempts in 0 secs): user=<>, rip=209.85.128.137, lip=103.72.79.234, session=<cR/KSUP3MIvRVYCJ>
如果我选中“始终使用 SSL”复选框,在前端 Gmail 会显示此错误消息:
“连接到 mail.example.com 时出现问题”
在 中dovecot.log
,我看到:
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: before SSL initialization
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2002, ret=-1: before SSL initialization
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2002, ret=-1: before SSL initialization
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2002, ret=-1: before SSL initialization
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: before SSL initialization
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS read client hello
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write server hello
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write change cipher spec
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: TLSv1.3 write encrypted extensions
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write certificate
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: TLSv1.3 write server certificate verify
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write finished
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: TLSv1.3 early data
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2002, ret=-1: TLSv1.3 early data
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2002, ret=-1: TLSv1.3 early data
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2002, ret=-1: TLSv1.3 early data
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2002, ret=-1: TLSv1.3 early data
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: TLSv1.3 early data
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS read finished
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x20, ret=1: SSLv3/TLS write session ticket
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write session ticket
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2001, ret=1: SSLv3/TLS write session ticket
Mar 19 12:27:01 pop3-login: Debug: SSL: where=0x2002, ret=1: SSL negotiation finished successfully
Mar 19 12:27:01 pop3-login: Info: Login: user=<fake_username>, method=PLAIN, rip=71.232.112.192, lip=[MY SERVER'S IP ADDRESS], mpid=949498, TLS, session=<waq2R0P3fM1H6HDA>
Mar 19 12:27:01 pop3(fake_username)<949498><waq2R0P3fM1H6HDA>: Info: Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
Mar 19 12:27:01 pop3-login: Debug: SSL alert: close notify
在我的文件中/etc/dovecot/10-auth.conf
,我唯一没有注释的行是:
auth_mechanisms = plain login
!include auth-system.conf.ext
并且没有任何与 auth 相关的内容dovecot.conf
我认为一方面我通过命令行授权会话和在 Thunderbird 中授权会话之间存在一些不匹配(Thunderbird 无法通过 POP3 连接到 mail.example.com,除非我使用 ),以及STARTTLS
Gmail 尝试连接的方式另一方面。不幸的是,错误日志对我来说都是希腊语,我无法充分理解 Dovecot 文档以弄清楚如何让 Dovecot 授予对 Gmail 的访问权限。
有没有好心人知道这里发生了什么/可能发生了什么以及我该如何解决?
我正在尝试按照此操作通过我的 Dovecot 安装获取 Solr 搜索设置:
https://doc.dovecot.org/configuration_manual/fts/solr/#fts-backend-solr
一切似乎都很好——我可以在 Solr 管理中看到核心。我正在使用 Solr 8.9.0,但它似乎对配置文件很满意。
但是,它说运行以实际索引的命令之一:
doveadm fts rescan -u [email protected]
我得到:
Fatal: Plugin 'fts_solr' not found from directory /usr/lib/dovecot/modules
果然,我在任何东西中都看不到那个名字的任何东西:
root@east:/usr/lib/dovecot/modules# ls -lh *fts*
-rw-r--r-- 1 root root 263K Jul 7 17:17 lib20_fts_plugin.so
-rw-r--r-- 1 root root 71K Jul 7 17:17 lib21_fts_squat_plugin.so
我错过了什么?我是否也需要手动安装插件?
dovecot --version
2.3.7.2 (3c910f64b)
更新:环顾四周,我可以看到 dovecot-fts-solr 插件(https://alpine.pkgs.org/3.15/alpine-main-aarch64/dovecot-fts-solr-2.3.17.1-r0.apk.html) . 我似乎无法安装它。不太确定如何进行?(我可以直接下载 .so 文件并将其放入 /usr/lib/dovecot/modules ,但我很确定那行不通:))
更新 2:所以我设法找到了:
apt-get 安装 dovecot-solr
这将创建 lib21_fts_solr_plugin.so 文件。但是,当我尝试重新索引消息时,我什么也没得到:
doveadm -D fts rescan -u [email protected]
Debug: Loading modules from directory: /usr/lib/dovecot/modules
Debug: Module loaded: /usr/lib/dovecot/modules/lib20_fts_plugin.so
Debug: Module loaded: /usr/lib/dovecot/modules/lib21_fts_solr_plugin.so
Debug: Loading modules from directory: /usr/lib/dovecot/modules/doveadm
Debug: Skipping module doveadm_acl_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_acl_plugin.so: undefined symbol: acl_user_module (this is usually intentional, so just ignore this message)
Debug: Skipping module doveadm_expire_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_expire_plugin.so: undefined symbol: expire_set_deinit (this is usually intentional, so just ignore this message)
Debug: Skipping module doveadm_quota_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_quota_plugin.so: undefined symbol: quota_user_module (this is usually intentional, so just ignore this message)
Debug: Module loaded: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_sieve_plugin.so
Debug: Skipping module doveadm_fts_lucene_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib20_doveadm_fts_lucene_plugin.so: undefined symbol: lucene_index_iter_deinit (this is usually intentional, so just ignore this message)
Debug: Module loaded: /usr/lib/dovecot/modules/doveadm/lib20_doveadm_fts_plugin.so
Debug: Skipping module doveadm_mail_crypt_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/libdoveadm_mail_crypt_plugin.so: undefined symbol: mail_crypt_box_get_pvt_digests (this is usually intentional, so just ignore this message)
doveadm([email protected])<35131><>: Debug: auth-master: userdb lookup([email protected]): Started userdb lookup
doveadm([email protected])<35131><>: Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb: Connecting
doveadm([email protected])<35131><>: Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb: Client connected (fd=10)
doveadm([email protected])<35131><>: Debug: auth-master: userdb lookup([email protected]): auth USER input: [email protected] uid=1011 gid=8 home=/home/hatlamp quota_rule=*:storage=0M
doveadm([email protected])<35131><>: Debug: auth-master: userdb lookup([email protected]): Finished userdb lookup ([email protected] uid=1011 gid=8 home=/home/hatlamp quota_rule=*:storage=0M)
doveadm([email protected])<35131><>: Debug: Added userdb setting: plugin/quota_rule=*:storage=0M
doveadm([email protected]): Debug: Effective uid=1011, gid=8, home=/home/hatlamp
doveadm([email protected]): Debug: Namespace : type=private, prefix=, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/home/hatlamp/mail/hatlamp.com/hello
doveadm([email protected]): Debug: maildir++: root=/home/hatlamp/mail/hatlamp.com/hello, index=, indexpvt=, control=, inbox=/home/hatlamp/mail/hatlamp.com/hello, alt=
doveadm([email protected]): Debug: auth-master: conn unix:/var/run/dovecot//auth-userdb: Disconnected: Connection closed (fd=10)
查看solr的界面,没有文章:
我正在使用 Dovecot 2.2.33 运行 Ubuntu 邮件服务器,并且正在使用系统帐户:
passdb {
driver = pam
我有大约 100 个邮件用户。
我想强加每个用户的存储配额,但是 Dovecot docs on per-user quota configuration说:
Passwd userdb 不支持额外的字段。这就是为什么您不能直接将用户的配额限制设置为 passwd 文件。一种可能性是编写一个脚本,从另一个文件读取配额限制,将它们与 passwd 文件合并并生成另一个 passwd 文件,然后您可以将其与 Dovecot 的 Passwd 文件一起使用。
有没有人有这样一个脚本的例子?例如,我从文档中不清楚密码本身是如何处理的。或者是否有其他一些解决方法不需要迁移到虚拟用户设置来获得每个用户的配额?
我有一个运行 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
据我所知,目录的权限很好。这特别令人困惑,因为它似乎工作正常,然后在一段时间后随机开始给出错误。从每个收件箱中删除索引文件可以让它重新开始工作,但显然这是一种解决方法,而不是真正的解决方案。