
나는 다음과 같이 우분투의 새로운 SSL 인증서를 사용하여 dovecot imap 서버(버전 1.0.10 - 업그레이드는 이 단계에서 옵션이 아님)를 구성하려고 했습니다.
$ grep ^ssl /etc/dovecot/dovecot.conf
ssl_disable = no
ssl_cert_file = /etc/ssl/certs/mydomain.com.crt.20120904
ssl_key_file = /etc/ssl/private/mydomain.com.key.20120904
$ /etc/init.t/dovecot stop
$ sudo dovecot -p
$ [i enter the ssl password here]
오류가 표시되지 않으며 실행하면 다음과 같은 결과 ps aux | grep dovecot
가 나타납니다.
root 21368 0.0 0.0 12452 688 ? Ss 15:19 0:00 dovecot -p
root 21369 0.0 0.0 71772 2940 ? S 15:19 0:00 dovecot-auth
dovecot 21370 0.0 0.0 14140 1904 ? S 15:19 0:00 pop3-login
dovecot 21371 0.0 0.0 14140 1900 ? S 15:19 0:00 pop3-login
dovecot 21372 0.0 0.0 14140 1904 ? S 15:19 0:00 pop3-login
dovecot 21381 0.0 0.0 14280 2140 ? S 15:19 0:00 imap-login
dovecot 21497 0.0 0.0 14280 2116 ? S 15:29 0:00 imap-login
dovecot 21791 0.0 0.0 14148 1908 ? S 15:48 0:00 imap-login
dovecot 21835 0.0 0.0 14148 1908 ? S 15:53 0:00 imap-login
dovecot 21931 0.0 0.0 14148 1904 ? S 16:00 0:00 imap-login
me 21953 0.0 0.0 5168 944 pts/0 S+ 16:02 0:00 grep --color=auto dovecot
모두 잘 돌아가고 있는 것 같군요. 그런 다음 dovecot 서버에 텔넷으로 연결할 수 있는지 테스트했는데 정상적으로 작동합니다.
$ telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK Dovecot ready.
하지만 dovecot이 SSL 인증서를 올바르게 구성했는지 테스트하면 실패한 것으로 나타납니다.
$ sudo openssl s_client -connect localhost:143 -starttls imap
CONNECTED(00000003)
depth=0 /description=xxxxxxxxxxxxxxxxx/C=AU/ST=xxxxxxxx/L=xxxx/O=xxxxxx/CN=*.mydomain.com/[email protected]
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 /description=xxxxxxxxxxx/C=AU/ST=xxxxxx/L=xxxx/O=xxxx/CN=*.mydomain.com/[email protected]
verify error:num=27:certificate not trusted
verify return:1
depth=0 /description=xxxxxxxx/C=AU/ST=xxxxxxxxxx/L=xxxx/O=xxxxx/CN=*.mydomain.com/[email protected]
verify error:num=21:unable to verify the first certificate
verify return:1
---
Certificate chain
0 s:/description=xxxxxxxxxxxx/C=AU/ST=xxxxxxxxxx/L=xxxxxxxx/O=xxxxxxx/CN=*.mydomain.com/[email protected]
i:/C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Class 2 Primary Intermediate Server CA
---
Server certificate
-----BEGIN CERTIFICATE-----
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
.
.
.
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxx==
-----END CERTIFICATE-----
subject=/description=xxxxxxxxxx/C=AU/ST=xxxxxxxxx/L=xxxxxxx/O=xxxxxx/CN=*.mydomain.com/[email protected]
issuer=/C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Class 2 Primary Intermediate Server CA
---
No client certificate CA names sent
---
SSL handshake has read 2831 bytes and written 342 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Server public key is 2048 bit
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : DHE-RSA-AES256-SHA
Session-ID: xxxxxxxxxxxxxxxxxxxx
Session-ID-ctx:
Master-Key: xxxxxxxxxxxxxxxxxx
Key-Arg : None
Start Time: 1351661960
Timeout : 300 (sec)
Verify return code: 21 (unable to verify the first certificate)
---
. OK Capability completed.
적어도 나는 이것이 실패라고 가정하고 있다???
답변1
문제는 dovecot이 아니라 openssl에 있습니다.
있다버그-CApath
openssl에서는 기본 CApath 검색을 중지하므로 명령줄에 추가하여 루트 CA 인증서 목록을 찾을 수 있는 위치를 알려주어야 합니다 . 예를 들어:
sudo openssl s_client -connect localhost:143 -starttls imap -CApath /dev/null
아직 certs 폴더를 채우지 않았고 컴퓨터에 능숙하다면 다음을 따르십시오.이 튜토리얼Mozilla에서 certdata.txt를 다운로드하고 필요한 PEM 파일과 심볼릭 링크를 생성합니다. /bin에 대한 액세스 권한이 없고 심볼릭 링크 ln -s ca-bundle.crt cert.pem을 생성해야 하는 경우 스크립트를 수정해야 할 수 있습니다.
(/dev/null을 지정하면 openssl은 openssl 디렉터리에 있는 cert.pem의 기본 경로를 사용하게 됩니다. openssl 디렉터리가 어디에 있는지 알아보려면 를 입력하세요 openssl version -d
.)
StartSSL을 사용하고 있으므로 StartCom Class 2 Primary Intermediate Server CA의 경우 인증서와 dovecot에 대한 중간 인증서를 연결해야 할 수도 있습니다. 무료 인증서는 StartCom Class 1 Primary Intermediate Server CA를 사용합니다.
답변2
verbose_ssl = yes
추가 로깅 출력을 생성하기 위해 비둘기장 구성에서 사용할 수 있습니다 .
내 구성(dovecot 2.0)에서는 다음 명령문을 사용합니다.
ssl_cert = </etc/ssl/certs/mydomain.com.crt.20120904
ssl_key = </etc/ssl/private/mydomain.com.key.20120904
답변3
이전 질문 - 새로운 문제(이번에는 Letsencrypt 인증서):
"반환 코드 확인: 21(첫 번째 인증서를 확인할 수 없음)"
(중간 인증서(체인)를 찾을 수 없거나 확인하는 데 사용되지 않음을 의미)
지난 24시간 동안 수많은 시행착오 끝에 제가 찾은 해결책은 다음과 같습니다.
먼저 테스트에 사용한 내용을 소개하겠습니다.
다른 이메일 서버(Ubuntu 18.xx)에 Dovecot이 있고 local.conf
사용된 도메인/인증서 이외의 동일한 Dovecot 설정이 있습니다. 둘 다 Letsencrypt 인증서를 사용하며 둘 다 어제 갱신되었습니다.
Ubuntu 18의 Dovecot(버전 2.2.33.2)은 완벽하게 작동합니다.
사용 중 오류 코드 없음openssl s_client이메일 포트 테스트:993/IMAP 또는 :995/POP.
그러나 다른 컴퓨터(오류가 표시된 컴퓨터)에서는 다음을 사용합니다.
OS: Ubuntu 20.04.2
Dovecot(Ubuntu 기본/repo 버전): 2.3.7.2 (3c910f64b)
OpenSSL(Ubuntu 기본/repo 버전):1.1.1f 31 Mar 2020
Android 휴대폰(Google/Gmail 기본 이메일 앱)에 이메일 계정을 추가하는 것에 대해 고객이 불만을 제기한 후 오류가 발생했습니다.
"인증서를 신뢰할 수 없습니다."
웹 또는 smtp용 인증서를 사용하면 openssl 테스트가 제대로 작동하고 확인됩니다.
이로 인해 문제는 Ubuntu 20의 Dovecot에 있다고 생각됩니다.
Thunderbird 및 Outlook과 같은 다른 이메일 클라이언트도 잘 작동합니다.
나는 즉시 'openssl s_client'로 테스트하기로 결정했고 오류로 인해 결국 여기까지 왔습니다.
내 구성은 고장난 비둘기장 컴퓨터와 작동하는 비둘기장 컴퓨터 모두에서 다음과 같습니다.
ssl_ca = </etc/letsencrypt/live/{CertName}/fullchain.pem
ssl_cert = </etc/letsencrypt/live/{CertName}/cert.pem
ssl_key = </etc/letsencrypt/live/{CertName}/privkey.pem
어떤 소프트웨어가 오류를 일으키는지 확인하지 못했지만 오류를 해결했습니다. 이제 Android 휴대폰은 인증서를 완전히 신뢰합니다. 들어가 보니 오류가 아마도 인증서 체인/CA 확인 부족으로 인해 발생했다는 것을 알았습니다.
솔루션/TL;DR:
사용풀체인.pem인증서 항목( ssl_cert =
)으로 사용하세요. 여기에는 LE 인증서와 체인이 모두 포함되어 있습니다.
SSL에 대한 Dovecot 구성은 다음과 같아야 합니다(물론 {CertName}을 자신의 것으로 바꾸십시오).
ssl_ca = </etc/letsencrypt/live/{CertName}/chain.pem (or 'fullchain' should work)
ssl_cert = </etc/letsencrypt/live/{CertName}/fullchain.pem
ssl_key = </etc/letsencrypt/live/{CertName}/privkey.pem
테스트 중에 더 이상 오류가 표시되지 않습니다.
Verify return code: 0 (ok)
오류가 표시되지 않는 컴퓨터(Ubuntu 18)에서는 아무것도 변경할 필요가 없었으므로 변경하지 않았습니다.
업데이트:
현재 Ubuntu 20 저장소/apt와 함께 사용 중인 Dovecot이 영향을 받았습니다.
버그 참조:https://dovecot.org/pipermail/dovecot/2021-April/121884.html