Pcornel
Linux · Certificates & TLS

CSR

Cheat sheet · https://pcornel.dk/topic.php?topic=2869

Back to the Topic

Answer

A CSR (Certificate Signing Request) contains the public key and requested names, signed with the private key, and is sent to a CA to issue a certificate.

Remember

Put all names in subjectAltName — browsers ignore the CN. Generate: openssl req -new -newkey rsa:2048 -nodes -keyout key.pem -out req.csr -subj '/CN=<name>' -addext 'subjectAltName=DNS:<name>,DNS:<alt>'. Check before sending.

First checks

  • openssl x509 -in <cert> -noout -subject -issuer -dates -ext subjectAltName — certificate details
  • openssl s_client -connect <host>:443 -servername <name> </dev/null — live chain and verification
  • openssl verify -CAfile <ca> -untrusted <chain> <cert> — chain validation
  • trust list | head / ls /etc/ssl/certs — system trust store

Commands

openssl req -new -key www.key -config www.cnf -out www.csr
openssl req -x509 -key www.key -days 30 -subj "/CN=test.local" -out test.crt

Verify in this order

key pair → CSR with names → CA verifies and signs → certificate issued

Where it usually breaks

First mismatch in identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2869

Confirmation

Confirm action

Continue?