Sign inSign up free

1033. Which Hostnames Does This Certificate Cover?

hard 40 XP ~14 minHands-on lab

Before each migration, the team lists the hostnames a service will be reached under and checks the certificate covers all of them. Doing it by eye went wrong twice.

Task

Create the executable script /home/student/bin/san-check.sh CERT HOST... that prints, for each HOST in order, OK <host> or MISSING <host> (as given), and exits 1 if any is missing, 0 otherwise. Follow what browsers do:

  • only the Subject Alternative Names count; the CN is ignored,
  • names compare case-insensitively,
  • a wildcard *.example.test matches exactly one label: a.example.test, but not example.test nor a.b.example.test,
  • an IP address matches only an IP Address SAN with the same address.

/home/student/pki/sample.pem is a certificate to try it on.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of Networking and TLS in Practice. Next step: Build a Full Certificate Chain

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.