I have a Postfix Ubuntu VM acting as a mail relay server, which accepts mail on port 25 and forwards it on to Microsoft Exchange online for delivery. This has been working fine for months.
Now I need to allow an SMTP client, which must use TLS, to also send e-mails via the relay. I have added the following to my Postfix main.cf:
smtpd_tls_security_level = may
smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1
smtpd_tls_chain_files =
${cert_path}/cert.pem,
${cert_path}/chain.pem
However when I try swaks with the --tls-on-connect flag I get a "Connection refused" on ports 465 and 587. The old non-encrypted port 25 stuff still works. The pem files are generated by Let's Encrypt and the private key counter parts work for encrypting the outgoing mail to Exchange online. I have verified them with:
openssl verify -purpose sslserver -partial_chain -CAfile /etc/letsencrypt/live/<server FQDN>/chain.pem /etc/letsencrypt/live/<server FQDN>/cert.pem
However, when I attempt to make a TLS connections from a SMTP client this appears in the log:
Mar 18 14:41:49 hermes postfix/smtpd[578652]: warning: error loading chain from /etc/letsencrypt/live/<server FQDN>/cert.pem: key not first
Mar 18 14:41:49 hermes postfix/smtpd[578652]: warning: error loading private keys and certificates from: /etc/letsencrypt/live/<server FQDN>/cert.pem,?/etc/letsencrypt/live/<server FQDN>/chain.pem: disabling TLS support
I suppose the question I am facing is how to use the Let's Encrypt SSL certificate for enabling TLS on my mail relay server.