Key and request in one command
-newkey rsa:2048creates a new 2048-bit RSA key — the most common size and sufficient for mail servers.rsa:3072orrsa:4096work too but cost computation on every handshake.-noencwrites the key without a passphrase, the way a mail server needs it (-nodeswith OpenSSL before version 3). Background under Remove a key passphrase.-addext "subjectAltName=…"is the decisive part: clients check the name in the SAN, not the CN. A CSR without SAN leads many CAs to issue a certificate carrying only the CN — or to reject it.
With umask 077 in front, mail.key is created with the right permissions straight away.
Which names belong in it?
Every name the server is addressed by:
- the MX hostname from the MX record — for inbound mail,
- the name for submission and retrieval if it differs (
smtp.,imap.), - with several MX hosts sharing one certificate: all of them.
The mail domain alone (yourdomain.com) is not enough when the MX is mail.yourdomain.com — see Set up the MX certificate.
EC instead of RSA
A P-256 key is as strong as 3072-bit RSA and considerably faster in the handshake. All current mail servers handle it. If you must serve very old peers too, stay with RSA — or run both side by side (Postfix: smtpd_tls_chain_files with two pairs).
For an existing key
On a renewal with the same key — say because a DANE record with selector 1 points at it — the key stays and only the request is new:
How that interacts with the DANE record is covered in Set up DANE.
Checking the request before submitting
The first line reports Certificate request self-signature verify OK, the second shows the names entered. If one is missing, now is the moment to recreate the request — not after issuance.
Once the certificate comes back, Check certificate and key verifies that it matches the key and the chain is complete. If you need to serve Windows, build a PFX file from it.