Sign inSign up free

1030. The Right Certificate Behind a Shared IP

medium 20 XP ~11 minHands-on lab

The load balancer at 127.0.0.1:9600 serves several sites and chooses the certificate by SNI, the name the client sends in the TLS handshake. The current check script connects without SNI and always reports the default certificate. Start the test server with /srv/lab/bin/start-sni; it knows a.example.test and b.example.test.

Task

Create the executable script /home/student/bin/peer-cert.sh HOST PORT [SNI] that connects to HOST:PORT, sends SNI (or HOST when SNI isn't given) as server name, and prints exactly four lines about the certificate the server presents:

subject: CN=a.example.test
issuer: CN=Example Test CA
not_after: 2027-11-06T10:00:00Z
dns_names: a.example.test,www.a.example.test
  • subject and issuer in RFC 2253 form (as openssl … -nameopt RFC2253 prints them),
  • not_after in UTC as YYYY-MM-DDTHH:MM:SSZ,
  • dns_names: the DNS names from the Subject Alternative Names, in certificate order, comma-separated (empty if none).

It exits non-zero if no TLS connection could be made.

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: Which Hostnames Does This Certificate Cover?

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.