15. Certificate Revocation and Fast Reconnection

Scenario: some time after the enterprise Wi-Fi of chapter 3 goes live, two things come up:

  • A laptop is lost. Its certificate has two years left before it expires. Disabling it in the table stops logins, but the security policy requires the certificate itself to be revoked, and the same certificate may be used by other systems too.
  • Devices roaming between access points do a full TLS handshake at every new one. At busy times the server’s CPU goes into signatures, and users feel a hiccup when they change access point. With several nodes, a device that reaches another node starts from scratch again.

This chapter adds three things to certificate logins (EAP-TLS): revocation lists (CRL), online revocation checks (OCSP), and resuming the previous session (session resumption).

Example directory: rradius-server/examples/scenarios/wifi-certs/

FileContents
rradius.tomlcrl_file, resumption_ms and shared_tickets in [radius.eap]
setup.shCreates a demo CA, a server certificate, two laptop certificates (one revoked), a revocation list and ticket.seal
migrations/devices (devices and VLANs), accounting, and two demo laptops

The checks a certificate login passes

Handshake: signed by client_ca_file? expired? in crl_file?
  │      (resuming an old session skips the handshake, but checks the certificate again against the current CA and CRL)
  ▼
OCSP (when configured): ask the CA's responder for this certificate's status
  ▼
Name: does the EAP Identity match a name on the certificate?
  ▼
Authentication chain: does certificate_query find this device?
  ▼
Access-Accept

Each check can stop a device, at different speeds:

ApproachHow soon it takes effectSuits
Disabled in the table (enabled = 0)The next login, across the clusterEveryday disabling. Stops it only at rradius
Revocation list (CRL)Once the new list is on every node and SIGHUP has been sentCAs that publish CRLs
OCSPOnce the answer obtained earlier expires (set by the CA, commonly hours to days)CAs that offer only OCSP

Steps

1. Create the certificates and key

cd rradius-server
examples/scenarios/wifi-certs/setup.sh

This creates certs/ (the CA, the server certificate, laptop-001, the revoked laptop-002, ca.crl) and ticket.seal in the scenario directory. For testing only. Existing files are not overwritten.

2. Start

For local testing, change the address of wlc to 127.0.0.1.

./target/release/rradius-server --config examples/scenarios/wifi-certs/rradius.toml

3. Test

Use eapol_test (chapter 3 explains how to install it), with a configuration like eapol/tls.conf from chapter 3, changing the certificate to certs/laptop-001.pem and certs/laptop-001.key here and identity to laptop-001.corp.example.com. This chapter does not include its own eapol_test configuration and has not run this scenario with it.

The automated test plays the laptop itself, goes through the whole EAP-TLS exchange, and checks:

SituationResult
laptop-001 logs in for the first timeAccess-Accept, VLAN 10, full handshake
laptop-001 logs in againAccess-Accept, resuming the previous session
laptop-002 (in the revocation list)Access-Reject
laptop-001’s certificate, but claiming to be laptop-002Access-Reject: the name does not match the certificate
After user disable laptop-001.corp.example.comAccess-Reject, even for a resumed session
After user enable ...Access-Accept

Revocation lists (CRL)

[radius.eap]
client_ca_file = "certs/ca.pem"
crl_file = "certs/ca.crl"
  • Certificates on the list fail the handshake.
  • After updating the list, send SIGHUP so it is read again; every node needs the updated file and the signal. New conversations use the new list, and conversations in progress finish with the old one (two minutes at most).
  • The lists must cover every CA in the chain. With an intermediate CA, concatenate the root and intermediate CRLs into one file (PEM). When one is missing, every device is rejected, with UnknownRevocationStatus in the log.
  • When the list expires, EAP-TLS keeps using it, so make sure it is updated regularly yourself; certificates revoked after it expired would be missed.
  • Scheduled updates: use cron or a systemd timer to download the CRL from the CA regularly, convert it to PEM, put it at crl_file’s location, and send SIGHUP. When the download fails, keep the old file; never put an empty file in place.

The example’s setup.sh shows how to revoke a certificate and produce a CRL with openssl ca; the notes at the top of the file have the commands for revoking another one later.

OCSP: when the CA publishes no revocation list

[radius.eap]
ocsp = "soft"
ocsp_url = "http://ocsp.corp.example.com/"   # optional

OCSP asks the CA’s server (the responder) in real time “is this certificate still valid”. In the example configuration these two lines are comments, because the demo CA has no responder.

SettingResponder says goodSays revokedSays unknown, does not answer, or answers wrongly
"off" (default)Not askedNot askedNot asked
"soft"Let throughRejectedLet through, logging OCSP: no answer, let through
"hard"Let throughRejectedRejected
  • "soft" or "hard": with "hard", as soon as the responder goes down, every certificate login fails, which ties Wi-Fi availability to the CA’s OCSP service. "soft" does not, but someone who can block the connection between rradius and the responder can make revocation ineffective. When revocation must take effect, use "hard" and make sure the responder is reliable enough.
  • Who is asked: the responder address in the certificate, or ocsp_url (which is used for every certificate in the chain, so it must know the whole chain). The CAs in client_ca_file themselves are not checked.
  • Answers are remembered until the expiry time they state. The same device logging in again is not asked about again, so revocation takes effect only once the old answer has expired.
  • A down responder does not make every login wait: one query waits at most 3 seconds, and certificates with no answer are not asked about again for 90 seconds.
  • Nodes must be able to reach the responder, usually HTTP on port 80. Proxies set in environment variables are not used.
  • CRL and OCSP can be set together; both must pass.
  • Limits: answer signatures are supported only for RSA (2048 bits or more) and ECDSA P-256/P-384. When client_ca_file has a CA with another kind of key, setting ocsp makes startup fail, naming which CA it is.

RadSec ([radius.tls]) and TACACS+ over TLS ([tacacs.tls]) have the same ocsp and ocsp_url, for checking NAS and device certificates, in the same way; the difference is that open connections are looked at again about once a minute. The full rules are under “OCSP” in usage section 2.12.

Fast reconnection (session resumption)

[radius.eap]
resumption_ms = 3600000
shared_tickets = true
ticket_seal_file = "ticket.seal"

A device’s first login does a full TLS handshake. When it reconnects within resumption_ms (roaming to another access point, waking from sleep), both sides resume directly with the secret negotiated last time, skipping the certificate exchange and the signatures.

  • Security checks are not skipped: on resumption, the previous certificate is checked again against the current client_ca_file and crl_file, and OCSP too when configured; the name check and authentication chain that follow are the same as for a full handshake. So revocation and disabling are just as effective for resumed sessions.
  • resumption_ms defaults to 0 (no resumption), at most one day. How long to set it depends on how long you can accept a device not presenting its certificate again.

resumption_ms alone

Sessions are kept in each node’s memory.

  • Only TLS 1.2 can resume.
  • A device reaching another node finds no record there and does a full handshake.
  • Cleared by a restart or SIGHUP.

That is enough for a single node, or when the NAS always reaches the same node (primary/backup).

Adding shared_tickets = true

rradius also issues session tickets: the data needed for resumption, encrypted and handed to the device to keep, which the device brings back on its next connection.

  • Devices can resume on any node, because every node can decrypt them.

  • TLS 1.3 can resume too.

  • The keys that encrypt tickets are rotated by the cluster itself: one per resumption_ms period, stored in a cluster table and shared by the nodes. There is no key rotation to schedule yourself.

  • ticket_seal_file (required): the ticket keys in the table are encrypted again with this file. It is not in the database, so someone who has only the database or a backup cannot decrypt the ticket keys, and so cannot forge tickets to impersonate a device.

    (umask 077; openssl rand -hex 32 > ticket.seal)
    

    Every node needs the same file, with permissions such as 0600, 0640 or 0400. A node with different contents cannot open keys written by the others, logging does not open with ticket_seal_file; that node neither issues tickets nor accepts tickets issued by other nodes, and devices do a full handshake instead. Logins still complete, only more slowly.

  • When the database cannot be read for a moment, the same applies: that login issues no ticket and completes as usual, logging EAP session ticket keys: ....

Which methods resume

MethodResumes?
EAP-TLSYes. With shared_tickets, across nodes and with TLS 1.3 too
PEAPSaves only the outer handshake; the inner password is still checked. It issues no tickets, so only on the same node
EAP-TTLSDoes not resume
EAP-AKA'Not applicable; it has no TLS

Changing ticket.seal

On every node, set the new file as ticket_seal_file and the old one as previous_ticket_seal_file, and send SIGHUP. New keys are then encrypted with the new file, those encrypted with the old file still open, and tickets already issued stay valid.

  • All nodes must change within the same resumption_ms period. Nodes not yet changed cannot open keys written by changed nodes, and issue no tickets during that time.
  • Once all are changed, wait three more resumption_ms periods before removing previous_ticket_seal_file.
  • Changing without previous_ticket_seal_file also works, at the cost of tickets issued in up to two periods becoming invalid, so devices do one full handshake.

Other ways to save CPU

With a high login volume, switch the server certificate to ECDSA P-256: on the same machine, each full handshake uses about a third of the CPU of RSA 2048. Use the P-256 curve, not P-384 (old Android versions have been reported not to support it). The server uses one certificate at a time, so connect once with every kind of device before switching. Measurements and compatibility notes are in usage section 2.12.

Before going live

  • Protect ticket.seal like a certificate private key. Losing it loses no data (generate a new one, and devices do one full handshake), but leaking it together with the database lets someone forge tickets.
  • TLS 1.2 tickets carry more risk: a ticket contains the main secret of that connection, and someone who obtains the key of the time can compute that connection’s wireless encryption keys. TLS 1.3 resumption always exchanges keys anew and does not have this problem. When every device supports TLS 1.3, the risk is much smaller.
  • Monitoring: a sudden rise in rradius_eap_sessions_total{method="tls",result="reject"} may mean a missing CRL for some CA, or OCSP set to "hard" with the responder down.
  • Not tested:
    • OCSP is not in the scenario test, because it needs a responder. The project’s interoperability tests (docker/interop/run.sh) have tested EAP-TLS with OpenSSL’s responder.
    • Resumption across nodes is not in the scenario test: the scenario test has one node, and checks that a second login on the same node resumes the session, that the revocation list stops the revoked certificate, and that a disabled device is rejected on resumption too.
    • Real access points and every operating system. Whether devices bring tickets back, and how they resume, differs between clients.
    • The part of setup.sh that creates certificates and the revocation list has been run with LibreSSL 3.3 (macOS) and OpenSSL 3.5 (a Linux container).

Common problems

SymptomCause
After setting crl_file, every device is rejected, with UnknownRevocationStatus in the logThe CRL of some CA is missing, or a CRL of another CA was put in place
A revoked certificate can still log inCRL: the new list is not yet on that node, or no SIGHUP was sent. OCSP: the old answer has not expired, or it is "soft" and the responder did not answer
OCSP: no good answer: ... in the logWith "hard", no answer was obtained. The reason follows: the responder cannot be reached, the answer has expired, or the signature is wrong
OCSP: no answer, let through keeps appearing in the logWith "soft", the responder does not answer; can the node reach it?
Startup fails, mentioning ticket_seal_fileshared_tickets is set but the file does not exist, its permissions are too broad, or resumption_ms is not set
Startup fails, mentioning ticket_key_fileAn old setting that has been removed. Use shared_tickets and a newly created ticket_seal_file; do not rename the old file and reuse it
does not open with ticket_seal_file in the logThis node’s ticket.seal differs from the other nodes’. Logins work, but do not resume
the certificate of a resumed session no longer passes in the logThe check on resumption found the certificate revoked or expired. This is a normal reject
resumption_ms is set but every login is a full handshakeThe device reached another node without shared_tickets; it uses TTLS; or the device itself does not resume
Built with Hugo
Theme Stack designed by Jimmy