GUIDE 12 / WEB SERVICES
HTTPS & certificates
Distinguish encrypted connections from verified server identity.
In this guide
Commands use class paths and example filenames. Replace placeholders and inspect the target before making changes.
Inspect certificate identity
A certificate contains a public key and identity information. Compare the requested hostname with the Subject Alternative Name (SAN), then check issuer and validity dates.
openssl x509 -in site.crt -noout -subject -issuer -dates
openssl x509 -in site.crt -noout -ext subjectAltName
openssl x509 -in site.crt -noout -serial -fingerprint -sha256The production class certificate is self-signed. A browser warning is expected until you explicitly trust the correct certificate or install a certificate from a trusted issuer.
Test trust and hostname separately
--cacert supplies a trust file while retaining hostname verification. A certificate for ulc-119.ulcert.uw.edu does not match localhost merely because both reach the same server.
curl --cacert site.crt -I https://ulc-119.ulcert.uw.edu
curl --cacert site.crt -I https://localhost
curl -k -I https://localhostThese examples assume site.crt is the correct certificate file. -k skips certificate verification; use it only for deliberate diagnostics, not proof of trusted identity.
Protect the private key
Nginx needs a certificate file and its matching private key. Keep the key outside the document root and Git, restrict access, and never publish its contents.
sudo ls -lZ /etc/pki/nginx /etc/pki/nginx/private
sudo lsattr /etc/pki/nginx/private/private_key_prod.key
sudo nginx -tIn this class setup the private directory is root-owned 700, the key is root-owned 600, and SELinux labels are cert_t. The immutable i attribute prevents ordinary modification until deliberately removed for replacement.
Check the full connection path
Nginx must listen on 443, the firewall must permit HTTPS, and an external client must reach it. Compare a certificate fingerprint through a separate trusted channel when checking a peer.
sudo ss -tlnp | grep :443
sudo firewall-cmd --zone=public --query-service=https
curl -I --max-time 5 https://ulc-119.ulcert.uw.eduWith the current self-signed class certificate, the last command may fail verification even when the connection works. Supply the trusted certificate with --cacert to verify identity.