Cyrus sasl 错误 — Debian 9 上的“0:无身份验证失败”

Cyrus sasl 错误 — Debian 9 上的“0:无身份验证失败”

我正在尝试让混合 exim/cyrus IMAP 设置工作。我不使用 postfix,它没有安装。x64 和 Raspberry Pi (Raspbian Scratch) 上的操作系统都是 Debian 9。

我已经执行安装:

apt-get install cyrus-common cyrus-doc cyrus-pop3d cyrus-imapd cyrus-admin cyrus-murder cyrus-replication cyrus-nntpd cyrus-caldav cyrus-clients cyrus-dev libcyrus-imap-perl sasl2-bin

并按照第页上的说明进行操作Cyrus 快速入门指南

我被困在这一点上:

testsaslauthd -u imapuser -p secret

如上所述,我没有得到 OK“成功”,而是得到了一个错误:

connect() : No such file or directory

这意味着我误读了 /etc/default/saslauthd 中关于启动的注释。您必须编辑它才能使守护进程正常启动。但现在我明白了

0: NO "authentication failed"

但仅限于 x64 服务器上。Pi 给出了 OK 消息。

[编辑 2018 年 5 月 10 日 22:18 BST] 我必须承认,我曾尝试安装 Kolab在 Debian 9 上安装 Kolab 16当天早些时候我在 x64 上尝试过,但发现需要 postfix 时不得不放弃。一定是 exim。我不得不花几个小时清理它留下的烂摊子。然而 Raspberry Pi 没有遭遇这样的命运。

欢迎任何想法。

答案1

答案是我错过了 x64 上的一步。

Kolab 卸载删除了我的

/etc/default/saslauthd 

文件,我必须从 Raspberry Pi 上传该文件的一个新副本。

如果你看到类似这样的内容:

root@example:/var/run/saslauthd# ps -deaf | grep sasl
root      1559     1  0 Oct05 ?        00:00:00 /usr/sbin/saslauthd -a pam -c -m /var/run/saslauthd -n 5
root      1560  1559  0 Oct05 ?        00:00:00 /usr/sbin/saslauthd -a pam -c -m /var/run/saslauthd -n 5
root      1561  1559  0 Oct05 ?        00:00:00 /usr/sbin/saslauthd -a pam -c -m /var/run/saslauthd -n 5
root      1562  1559  0 Oct05 ?        00:00:00 /usr/sbin/saslauthd -a pam -c -m /var/run/saslauthd -n 5
root      1563  1559  0 Oct05 ?        00:00:00 /usr/sbin/saslauthd -a pam -c -m /var/run/saslauthd -n 5
root     21671 21496  0 00:56 pts/1    00:00:00 grep sasl

注意-帕姆, 它应该是-a 数据库。 /etc/default/saslauthd 文件中的 MECHANISMS="sasldb" 修复了这个问题。我阅读了说明,但在尝试修复损坏的 Kolab 卸载造成的损害后,没有仔细遵循说明。

[编辑 07/10/2018 01:56] 当您进入下一阶段时,请提供以下附加信息:

我已经更新了页面https://github.com/Exim/exim/wiki/AuthenticatedSmtpUsingSaslauthd添加“realm”参数

server_condition = ${if saslauthd{{${local_part:$auth1}}{$auth2}{}{${domain:$auth1}}}{1}{0}}

因为查看了 expand.c 中 exim 的源代码。这仅在源代码中记录:

对于使用 /etc/default/saslauthd:MECHANISMS="sasldb" 的虚拟邮箱托管,使用 LOGIN 身份验证器,您的登录名格式为[电子邮件保护],您需要提取域部分并将其作为“realm”参数传入,如下所示:

// From the source code comment in expand.c
${if saslauthd {{username}{password}{service}{realm}}  {yes}{no}}

您可以使用 cyrus 在服务器 shell 上测试用户名和密码,例如

testsaslauthd -u username -r example.com -p secret

它不适用于

testsaslauthd -u [email protected] -p secret

我现在遇到的问题是邮件卡在 exim 中,而 lmtp 无法工作。

如果你已经做到这一步,使用 OpenSSL 你应该能够得到类似这样的结果,来验证它:

root@raspberrypi:/usr/local/src/exim-4.91/src# openssl s_client -starttls smtp -crlf -connect mx.yourbigserver.co.uk:25
CONNECTED(00000003)
depth=0 C = GB, ST = Somewhere, L = Else, O = yourbigserver.co.uk, CN = Your Name, emailAddress = [email protected]
verify error:num=18:self signed certificate
verify return:1
depth=0 C = GB, ST = Somewhere, L = Else, O = yourbigserver.co.uk, CN = Your Name, emailAddress = [email protected]
verify return:1
---
Certificate chain
 0 s:/C=GB/ST=Somewhere/L=Else/O=yourbigserver.co.uk/CN=Your Name/[email protected]
   i:/C=GB/ST=Somewhere/L=Else/O=yourbigserver.co.uk/CN=Your Name/[email protected]
---
Server certificate
-----BEGIN CERTIFICATE-----
MIID
<snip/>
==
-----END CERTIFICATE-----
subject=/C=GB/ST=Somewhere/L=Else/O=yourbigserver.co.uk/CN=Your Name/[email protected]
issuer=/C=GB/ST=Somewhere/L=Else/O=yourbigserver.co.uk/CN=Your Name/[email protected]
---
No client certificate CA names sent
Peer signing digest: SHA512
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 1776 bytes and written 302 bytes
Verification error: self signed certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: xxxxxxxxxxxxxxxxxxxx
    Session-ID-ctx: 
    Master-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1538862964
    Timeout   : 7200 (sec)
    Verify return code: 18 (self signed certificate)
    Extended master secret: yes
---
250 HELP
EHLO test.com
250-myserver.myprovider.net Hello me.my.example.com [8.8.8.8]
250-SIZE 36700160
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-CHUNKING
250-PRDR
250 HELP
AUTH LOGIN
334 VXNlcm5hbWU6
dXNlcm5hbWVAZXhhbXBsZS5jb20=
334 UGFzc3dvcmQ6
c2VjcmV0
235 Authentication succeeded
mail from:[email protected]
250 OK
rcpt to:[email protected]
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
Hello 2!
.
250 OK id=1g8uZF-00027o-TS
quit
221 myserver.myprovider.net closing connection
closed
root@raspberrypi:/usr/local/src/exim-4.91/src# 

OpenSSL 有一个大问题,如果你输入大写字母 R,它就会进入重新协商序列,这就是为什么上例中的“mail from:”和“rcpt to:”都是小写的。

[编辑 07/10/2018 15:42] 让这一切正常运转的最后部分如下:

让 Exim LMTP 到 Cyrus 正常运行

现在它就像梦一样运行。

相关内容