0

How do I properly issue Let's Encrypt certificate for my Postfix mail server? Right now I have a self-signed certificate and I get these messages it cannot be trusted.

I did certbot --nginx certonly -d mail.example.org and apparently it is self-signed.

2
  • Why do you believe it's self signed? Commented Mar 21, 2024 at 22:16
  • 1
    You did NOTHING to tell Postfix about the certificate? Commented Mar 22, 2024 at 9:59

2 Answers 2

2

Dan is correct - the --certonly option tells certbot to get the certificate but do nothing with it. The script will have told you where that certificate is now, most likely /etc/letsencrypt/live/mail.example.org, as files named cert.pem, chain.pem, fullchain.pem, and privkey.pem. You would go into configuration for Postfix, and change the certificate paths to point to those files. Once you've done that, of course, you would restart Postfix.

6
  • I have done that in /etc/dovecot/dovecot.conf Commented Mar 21, 2024 at 22:58
  • Dovecot is for talking to your mail clients and handles IMAP and POP. You also have to do it for Postfix which is your mailer and handles SMTP. Commented Mar 21, 2024 at 23:00
  • where do I find the relevant config file ? Commented Mar 22, 2024 at 0:01
  • sudo postconf -d will show you where the config directory is. You're looking for either main.cf or master.cf. Strong suggestion: man postfix and read a lot. Commented Mar 22, 2024 at 0:10
  • Found it! Thank you guys a lot!!! Commented Mar 22, 2024 at 0:13
1

Let's Encrypt, since Certbot 2.0, issues ECC certificates by default. Some sending mail systems do not yet support those, but only RSA certificates.Therefore, to properly issue certificates for a Postfix mailserver, you would need two sets of certificate+key files:

smtpd_tls_chain_files = /etc/letsencrypt/live/mail.example.com-ecdsa/privkey.pem, /etc/letsencrypt/live/mail.example.com-ecdsa/fullchain.pem, /etc/letsencrypt/live/mail.example.com-rsa/privkey.pem, /etc/letsencrypt/live/mail.example.com-rsa/fullchain.pem 

You can get them by commenting out key-type in /etc/letsencrypt/cli.ini and then issuing the certificates with the --key-type option in command line. That part is crucial, because the settings in cli.ini will override those in /etc/letsencrypt/renewal/*.conf, which will break things on the next automatic renewal. E.g.,

sudo certbot certonly \ --cert-name mail.example.com-ecdsa \ -d mail.example.com \ --key-type ecdsa sudo certbot certonly \ --cert-name mail.example.com-rsa \ -d mail.example.com \ --key-type rsa 

A more elaborate answer:

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.