devutils/ATFQ/book ATFQ git

Part I · How it works

11.3 Certificates: how HTTPS proves who it is

alsocertificatecertificatesx509x.509cacertificate authorityca certificatesca bundleself-signedself-signed certificatelet's encryptcertificate expiredupdate-ca-certificatesopenssl s_clientssl certificateunable to get local issuer certificatecertificate verify failed

TL;DR

  • A certificate says "this public key belongs to example.com", signed by a certificate authority (CA). Your system trusts 100 to 150 root CAs.
  • During the TLS handshake the server sends its certificate and the intermediates; your client checks the chain up to a trusted root, the name, and the dates.
  • Let's Encrypt gives free certificates that renew automatically; their lifetime is short, and getting shorter across the industry.
openssl s_client -connect example.com:443 </dev/null   # chain, dates
openssl x509 -in cert.pem -noout -subject -issuer -dates

On your machine

alice@laptopexample
$ atfq 11.3
  Trusted   3 certificate authorities, in /etc/ssl/certs/ca-certificates.crt
  AES       aes-aesni, with the CPU's AES instructions · SHA-256: sha256-ni
  RNG       hardware generator tpm-rng-0 feeds the kernel
  TPM       version 2: can hold keys and seal disk keys

An example: Alice's laptop, one of the test machines. In your terminal, this block shows your own machine, read live.

Pitfalls

Deep dive 2 questions

Why trust a chain?

Root CAs keep their keys offline and sign a few intermediate CAs, which sign servers' certificates. Your client only stores the roots; each link's signature proves the next was approved by the one above. Every certificate issued is also logged publicly (Certificate Transparency), so a CA issuing one for your domain behind your back gets noticed.

What does a CA check before signing?

That the requester controls the domain: by serving a token on the site over HTTP, or creating a DNS record (the ACME protocol automates it). Basic certificates prove nothing more, not who runs the site, just that you're talking to whoever controls the name.

Commands
openssl curl update-ca-certificates update-ca-trust
Paths
/etc/ssl/certs/ /etc/pki/tls/certs/ /usr/local/share/ca-certificates/
See also
6.2 What happens when you open a website
11.2 Public-key cryptography
10.2 Keeping the clock right: NTP