>_ IzzyLab

Hands-on task

This task is step 7 of the course “TLS and certificates”

openssl: CSR with SAN

medium~7 min

Generate a private key and a certificate signing request (CSR) /root/req.csr for CN=shop.local with a subjectAltName field containing DNS:shop.local and DNS:www.shop.local.

There can be many names in a certificate, so they're described in a config: the template /root/shop.cnf is open in the Editor tab — fill in its sections and pass the config to openssl req. You can also do without a config, using command-line options.

What you'll practise:
  • openssl
  • csr
  • subjectAltName
  • pki
  • certificate extensions
  • openssl.cnf

Topic breakdown

Modern clients ignore the hostname in the CN field and look only at the subjectAltName (SAN) — the list of DNS names and IPs for which the certificate is valid. That's why the SAN is baked into the certificate signing request (CSR), so the CA carries it over into the resulting cert; one certificate thus covers several names at once. You practice generating a key and a CSR with a tool from the openssl family and, most importantly, adding the SAN extension with multiple names — a typical mistake here is to rely on a single CN and forget the SAN.

What's checked

  1. CSR contains SAN shop.local
  2. CSR contains SAN www.shop.local
  3. CN is shop.local

What it looks like