Sub topic 2
Certificate Authorities and the Chain of Trust
Assume you are comfortable with Linux, HTTPS, DNS, and basic public-key cryptography. You do not need to know the internal mathematics of digital signatures. You need to understand which party signs each certificate and what a browser checks.
Why a certificate authority matters
TLS encrypts traffic between a client and a server. It also lets the client check that it is connected to the intended domain. A server certificate contains:
- The domain names covered by the certificate, usually in the Subject Alternative Name field.
- The server's public key.
- The certificate authority that issued it.
- The validity period.
- A digital signature from the issuer.
A certificate authority, or CA, is an organization trusted to verify domain control and sign certificates. Let's Encrypt is a publicly trusted CA. Its signature tells a browser that the CA approved the certificate contents.
The signature does not prove that the server is safe or that its application has no vulnerabilities. It proves that a trusted CA validated control of the listed domain when it issued the certificate.
Building the chain of trust
Browsers and operating systems contain a trust store. A trust store is a local collection of root CA certificates that the platform already trusts.
A web server normally sends its own certificate and one or more intermediate certificates. It usually does not send the root certificate. The client builds a chain like this:
The root CA signs an intermediate CA certificate. The intermediate CA signs the server certificate. This arrangement limits exposure of the root's private key. The CA can keep the root key offline and use an intermediate for routine issuance.
The client checks each link:
- Each certificate signature is valid.
- The issuer of one certificate matches the subject of the next certificate.
- The server certificate names the requested hostname.
- The certificates are currently valid.
- The chain ends at a root in the local trust store.
- Key usage and certificate constraints allow the intended operation.
A missing intermediate certificate often causes errors even when the server certificate itself is valid. Configure nginx with fullchain.pem, which contains the server certificate followed by its intermediate chain.
Inspecting a certificate and its issuer
After Certbot obtains a certificate, inspect its subject, issuer, and dates:
sudo openssl x509 \
-in /etc/letsencrypt/live/example.com/cert.pem \
-noout -subject -issuer -datesThe subject or Subject Alternative Name identifies the covered domain. The issuer identifies the CA certificate that signed it. The date fields show when the certificate becomes valid and when it expires.
| Certificate | Signed by | Usually stored or supplied by |
|---|---|---|
| Server certificate | Intermediate CA | nginx, from `fullchain.pem` |
| Intermediate certificate | Root CA | nginx, from `fullchain.pem` |
| Root certificate | Itself | Browser or operating-system trust store |
Common errors
A hostname mismatch occurs when the requested name is not listed in the certificate. An expired certificate fails the validity check. An incomplete chain often appears as an “unable to get local issuer certificate” error. A private or internal CA works only when its root certificate has been deliberately installed in the client's trust store.
Let's Encrypt certificates are publicly trusted because its root and intermediate certificates are distributed through common trust stores. Certbot obtains them after Let's Encrypt validates control of the domain.
Exercise
Why does nginx normally use fullchain.pem instead of cert.pem alone?
Show answer
fullchain.pem includes the server certificate and the intermediate certificates that clients need to connect it to a trusted root CA.