Skip to main content

Posts

Showing posts with the label SMTP

Note to self: Extract TLS certificate from SMTP mail server

Replace the server name and the port. Usually the port will be 25.  openssl s_client -connect <hostname>:<port> -starttls smtp eg:  openssl s_client -connect smtp.office365.com:587 -starttls smtp Copy the output section of the certificate that looks like below. -----BEGIN CERTIFICATE----- ###bunch of encoded text### -----END CERTIFICATE----- You can copy it and save it to a file with ".crt" or ".cert" extension and that's the mail server's certificate. Make sure to include the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- lines. Note: OpenSSL is required. Ubuntu:  sudo apt install openssl Other OSs:  https://wiki.openssl.org/index.php/Binaries