我使用 Postfix 和 dovecot 在我的伺服器上設定了郵件伺服器。使用openssl s_client -connect localhost:143 -starttls imap
以下命令時 SMTP 和 IMAP 伺服器運作良好
openssl s_client -connect localhost:25 -starttls smtp
時間 SMTP 和 IMAP 伺服器運作良好。我使用了讓我們加密證書。但是當我在 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 找不到本地主機 mail.example.com