>_ IzzyLab

Hands-on task

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

TLS for the metrics service

medium~20 min

The internal metrics page from /srv/metrics-site must open over HTTPS only. Issue a self-signed certificate for metrics.internal: the name must be both in the CN and in the SAN (DNS:metrics.internal); put the key and the certificate into /etc/ssl/metrics/. Set nginx up to serve this site over HTTPS on port 9443 with that certificate.

What you'll practise:
  • openssl req -x509
  • subjectAltName
  • self-signed
  • nginx ssl
  • https

Topic breakdown

A self-signed certificate is signed with its own key: browsers don't trust it, but the channel is fully encrypted — for internal services and staging boxes that's enough. Modern clients match the host name not against the CN but against the SAN (Subject Alternative Name) extension, so the name goes into both places: openssl req -x509 issues the key and certificate in one command, and -addext adds the SAN. In nginx TLS is turned on with the ssl parameter of listen and two directives with the paths to the certificate and the private key; the port can be anything — HTTPS doesn't have to live on 443.

What's checked

  1. HTTPS on 9443 serves the metrics page
  2. the certificate CN is metrics.internal
  3. the SAN has DNS:metrics.internal
  4. the key and certificate are in /etc/ssl/metrics

What it looks like