
Hin und wieder gibt es ein Problem bei der Zertifikatserneuerung mittels Lets’ Encrypt und dem laufendem Mail Transfer Agent (MTA) Postfix bzw. dem IMAP Server Dovecot. Um das Zertifikat zu prüfen verwende ich folgende Befehle.
Nachfolgend ist <mail.example.tdl> durch den abzufragenden Mailserver zu ersetzen.
Mailserver und übliche Ports
Dies sind die üblichen Ports und deren Verschlüsselungen für den Mailverkehr:
Aktion | Protokoll | Verschlüsselung | Port |
Senden | |||
SMTP | keine | 25 | |
SMTP | TLS | 25 | |
SMTPS | SSL | 465 | |
Empfangen | |||
POP3 | keine | 110 | |
POP3 | TLS | 110 | |
POP3S | SSL | 995 | |
IMAP | keine | 143 | |
IMAP | TLS | 143 | |
IMAPS | SSL | 993 |
- 25 – Standard SMTP Port (unverschlüsselt)
- 133 IMAP
- 465 SMTPS (SMTP over SSL) ( verschlüsselt)
- 587 – SMTP over TLS (verschlüsselt)
- 993
- 995
- 2525 kein offizieller SMTP Port, wird oft als Alternative für SMTP verwendet
IMAP mittels SSL und Port 993 – Dovecot
Um die Abfrage nach dem Zertifikat zu starten folgendes in der Konsole eingeben:
# openssl s_client -showcerts -connect <mail.example.tdl>:993 -servername <mail.example.tdl>
Ist dies erfolgreich, sollte folgendes zu sehen sein:
Certificate chain
0 s:CN = mail.example.tdl
i:C = US, O = Let's Encrypt, CN = R3
-----BEGIN CERTIFICATE-----
.....
Server certificate
subject=CN = mail.example.tdl
.....
read R BLOCK
* OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SPECIAL-USE XLIST LITERAL+ AUTH=PLAIN AUTH=LOGIN] Dovecot (Debian) ready.
POP3 mittels SSL und Port 995 – Dovecot
Die Abfrage sieht nun wie folgt aus:
# openssl s_client -showcerts -connect <mail.example.tdl>:995 -servername <mail.example.tdl>
Eine positive Rückmeldung dann wie folgt:
Certificate chain
0 s:CN = mail.example.tdl
i:C = US, O = Let's Encrypt, CN = R3
-----BEGIN CERTIFICATE-----
....
Server certificate
subject=CN = mail.example.tdl
issuer=C = US, O = Let's Encrypt, CN = R3
....
read R BLOCK
+OK Dovecot (Debian) ready.
SMTP mittels SSL und Port 465 – Postfix
Die Abfrage ist wie folgt:
# openssl s_client -showcerts -connect <mail.example.tdl>:465 -servername <mail.example.tdl>
Die erfolgreiche Rückmeldung:
Certificate chain
0 s:CN = mail.example.tdl
i:C = US, O = Let's Encrypt, CN = R3
-----BEGIN CERTIFICATE-----
....
Server certificate
subject=CN = mail.example.tdl
issuer=C = US, O = Let's Encrypt, CN = R3
....
read R BLOCK
220 mail.example.tdl ESMTP Postfix
SMTP mittels TLS/StartTLS und Port 25 oder 587
Die Abfrage hier am Beispiel von Port 25:
# openssl s_client -starttls smtp -showcerts -connect <mail.example.tdl>:25 -servername pitvsrv04.purwin-it.de
Das Ergebnis:
Certificate chain
0 s:CN = mail.example.tdl
i:C = US, O = Let's Encrypt, CN = R3
-----BEGIN CERTIFICATE-----
....
Server certificate
subject=CN = mail.example.tdl
issuer=C = US, O = Let's Encrypt, CN = R3
....
....
250 CHUNKING
....
read R BLOCK
quit
221 2.0.0 Bye
Zertifikat Ablaufdatum anzeigen
Um sich das Ablaufdatum der Zertifikate anzeigen zu lassen einfach folgendes eingeben, den Port entsprechend tauschen:
# openssl s_client -showcerts -connect <mail.example.tdl>:993 -servername <mail.example.tdl> | openssl x509 -enddate -noout
Die Ausgabe sieht dann z.B. wie folgt aus:
notAfter=Jul 23 06:42:30 2022 GMT
Thats it … Have Fun!
danke gut zusammengefasst