我使用 Postfix 和 dovecot 在服务器上配置了邮件服务器。使用命令
openssl s_client -connect localhost:143 -starttls imap
和时,SMTP 和 IMAP 服务器运行良好openssl s_client -connect localhost:25 -starttls smtp
。我使用了 Let's Encrypt 证书。但是当我在 nexcloud 中设置相同的凭据时,总是会出现日志创建帐户失败:无法打开与服务器的安全 TLS 连接。我怀疑 nextcloud 不信任我的证书。当我禁用 TLS 时,我可以在 Nexcloud 中进行身份验证
depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
verify return:1
depth=0 CN = mail.example.com
verify return:1
---
Certificate chain
0 s:/CN=mail.example.com
i:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
1 s:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
i:/O=Digital Signature Trust Co./CN=DST Root CA X3
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIGWzCCBUOgAwIBAgISA0ajSksNknzQ2+R7wK9h1J2HMA0GCSqGSIb3DQEBCwUA
<TRUNCATE>
FMSZwZRGt2I1pTSafXsqRNzryHrc5ZQVgpsqHQnmGWnpg9I4Lv7glSg7dY+/bbE=
-----END CERTIFICATE-----
subject=/CN=mail.example.com
issuer=/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
---
No client certificate CA names sent
Peer signing digest: SHA512
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 3955 bytes and written 450 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 4096 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: 309CFB94430523ABFC29179E5003A74CB332CDC4F6A975AFCCE12C3A45EC33D4
Session-ID-ctx:
Master-Key: ***
Key-Arg : None
Krb5 Principal: None
PSK identity: None
PSK identity hint: None
TLS session ticket lifetime hint: 3600 (seconds)
TLS session ticket:
0000 - 50 f3 2e 9a 1e 01 04 3c-86 8e f8 c7 f0 50 1a 3d P......<.....P.=
<TRUNCATE>
0090 - a4 93 ea 18 9e 0b 7b f1-2d 97 be cf fe 8b f3 4e ......{.-......N
Start Time: 1597921756
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
250 DSN
对于 Postfix 端的 TLS,我设置了 main.cf
#TLS
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.example.com/privkey.pem
smtpd_tls_loglevel = 3
#smtpd_tls_received_header = yes
smtpd_tls_security_level = may
#smtpd_tls_auth_only = yes
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
tls_preempt_cipherlist = yes
tls_disable_workarounds = 0xFFFFFFFFFFFFFFFF
#smtpd_tls_mandatory_ciphers = high
smtpd_tls_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDB3-SHA, KRB5-DES, CBC3-SHA
#smtpd_tls_dh1024_param_file = /etc/postfix/dhparam/dh1024.pem
#smtpd_tls_eecdh_grade = ultra
答案1
当我实际输入主机 mail.example.com 时,STARTTLS 会运行,但对于 localhost 不起作用。我从子域 cloud.example.com 运行此邮件客户端,似乎 cloud.example.com 找不到 localhost mail.example.com