EAP-TLS with FreeRADIUS
Use certificates instead of passwords to join Wi-Fi or wired networks.
EAP-TLS is how many organisations let devices onto a network without passwords. The device presents a certificate, a RADIUS server checks it, and the switch or access point opens the port.
In this lab you’ll build the server side with FreeRADIUS and test it with eapol_test. You don’t need an access point. Everything runs in the lab VM.
Why certificates for network access?
Section titled “Why certificates for network access?”Most networks still join with a shared secret:
- WPA2/WPA3-Personal (PSK) gives everyone the same password. When one person leaves, you change it for everyone.
- PEAP-MSCHAPv2 gives each user a password, sent inside a TLS tunnel. MSCHAPv2 has known weaknesses, and Microsoft warns that Credential Guard in Windows 11 can break it.
- EAP-TLS gives each device its own certificate. There is no password to phish or reuse. You revoke one device without touching the rest.
There’s a second reason to run your own CA for this. Public CAs are moving away from client certificates. Let’s Encrypt stopped issuing the Client Authentication EKU in 2026. Network login is a job for a private PKI.
The three roles
Section titled “The three roles”- The supplicant is the device that wants to connect. It runs EAP client software.
- The authenticator is the switch or access point. It doesn’t check certificates. It relays EAP messages to RADIUS and opens the port when told to.
- The authentication server is RADIUS. Here, that’s FreeRADIUS. It runs the TLS handshake with the supplicant and decides.
The TLS handshake runs end to end between the device and FreeRADIUS. The access point only carries the packets.
1. Get the tools ready
Section titled “1. Get the tools ready”The lab VM already has FreeRADIUS and eapol_test, with the FreeRADIUS service turned off. You’ll run FreeRADIUS by hand so you can watch it work.
On a host install, install the tools:
sudo apt install -y freeradius eapoltestThen stop the background service:
sudo systemctl stop freeradius2. Add a provisioner for network certificates
Section titled “2. Add a provisioner for network certificates”The default step-ca template gives every certificate both Server and Client Authentication. That’s convenient, but loose. A laptop certificate should never be able to pose as your RADIUS server.
Create a template that sets one EKU, chosen by a role value:
{ "subject": {{ toJson .Subject }}, "sans": {{ toJson .SANs }}, "keyUsage": ["digitalSignature"],{{- if eq .Insecure.User.role "server" }} "extKeyUsage": ["serverAuth"]{{- else }} "extKeyUsage": ["clientAuth"]{{- end }}}Add a provisioner named wifi that uses it. Network certificates get a one-week default lifetime:
step ca provisioner add wifi --type JWK --create \ --x509-template wifi.tpl \ --x509-default-dur 168h --x509-max-dur 720hChoose a password for the new provisioner when asked.
✔ CA Configuration: /home/ubuntu/.step/config/ca.json
Success! Your `step-ca` config has been updated. To pick up the new configuration SIGHUP (kill -1 <pid>) or restart the step-ca process.Tell step-ca to reload its config:
pkill -HUP -x step-ca3. Issue the server and client certificates
Section titled “3. Issue the server and client certificates”Make a working folder:
mkdir -p ~/pki-lab/eap && cd ~/pki-lab/eapIssue the RADIUS server certificate. --set role=server picks the server branch of the template:
step ca certificate radius.example.com radius.crt radius.key \ --provisioner wifi --set role=server✔ Provisioner: wifi (JWK) [kid: c703dzooi6hSNFaz00eax8xRxcQuzObfwvOAbKiInGA]✔ CA: https://localhost:9000✔ Certificate: radius.crt✔ Private Key: radius.keyIssue a client certificate for Alice’s laptop:
step ca certificate alice@example.com alice.crt alice.key --provisioner wifiCheck the EKUs:
openssl x509 -in radius.crt -noout -ext extendedKeyUsageX509v3 Extended Key Usage: TLS Web Server Authenticationopenssl x509 -in alice.crt -noout -ext extendedKeyUsageX509v3 Extended Key Usage: TLS Web Client AuthenticationCopy the root next to them:
cp $(step path)/certs/root_ca.crt .4. Give FreeRADIUS its certificates
Section titled “4. Give FreeRADIUS its certificates”Make a folder FreeRADIUS can read:
sudo mkdir -p /etc/freeradius/3.0/certs/pki-labCopy the server certificate, its key and the root:
sudo cp radius.crt radius.key root_ca.crt /etc/freeradius/3.0/certs/pki-lab/Give the files to the freerad user:
sudo chown -R freerad:freerad /etc/freeradius/3.0/certs/pki-labMake the key unreadable to everyone else:
sudo chmod 640 /etc/freeradius/3.0/certs/pki-lab/radius.key5. Configure the EAP module
Section titled “5. Configure the EAP module”Open the EAP module config:
sudoedit /etc/freeradius/3.0/mods-available/eapMake five changes. Each line already exists in the file.
| Setting | Change it to | Why |
|---|---|---|
default_eap_type (first one, near the top) |
tls |
Offer EAP-TLS first. |
private_key_password = whatever |
comment it out with # |
step keys on disk aren’t encrypted here. |
private_key_file |
${certdir}/pki-lab/radius.key |
The server’s private key. |
certificate_file |
${certdir}/pki-lab/radius.crt |
The server certificate. step already put the intermediate in it. |
ca_file |
${certdir}/pki-lab/root_ca.crt |
The only CA allowed to issue client certificates. |
Check the config for errors:
sudo freeradius -XC | tail -1Configuration appears to be OK6. Start FreeRADIUS in debug mode
Section titled “6. Start FreeRADIUS in debug mode”sudo freeradius -XListening on proxy address * port 42839Ready to process requestsLeave it running. Debug mode prints every step of every request. It’s the best EAP teacher there is.
7. Act as the laptop with eapol_test
Section titled “7. Act as the laptop with eapol_test”eapol_test is a test build of the same supplicant Linux uses for Wi-Fi. It talks RADIUS directly, so it plays the device and the access point.
Open a new terminal in ~/pki-lab/eap. Create the supplicant config:
network={ key_mgmt=WPA-EAP eap=TLS identity="alice" ca_cert="root_ca.crt" domain_match="radius.example.com" client_cert="alice.crt" private_key="alice.key" eapol_flags=0}ca_certanddomain_matchare how the laptop checks the server. Both matter.identityis the outer EAP name. It’s not the certificate. Keep it free of@domainfor now. You’ll see why below.
Run the test. testing123 is the shared secret FreeRADIUS ships for localhost:
eapol_test -c eaptls.conf -a 127.0.0.1 -s testing123CTRL-EVENT-EAP-STARTED EAP authentication startedCTRL-EVENT-EAP-METHOD EAP vendor 0 method 13 (TLS) selectedCTRL-EVENT-EAP-PEER-CERT depth=2 subject='/O=Lab CA/CN=Lab CA Root CA' hash=0681c596b1048ed34c10c4f1e67aff7c79b0a411e092f146edd3e75618f19bd5CTRL-EVENT-EAP-PEER-CERT depth=1 subject='/O=Lab CA/CN=Lab CA Intermediate CA' hash=fec784d7112b3a5467c43a95a970589d2cd085f59e859e8f498479c197006c6bCTRL-EVENT-EAP-PEER-CERT depth=0 subject='/CN=radius.example.com' hash=a542894cc27f892f748dda5756bd9f6360a5311aec74657e5362641708bf16d7CTRL-EVENT-EAP-PEER-ALT depth=0 DNS:radius.example.comCTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully...MPPE keys OK: 1 mismatch: 0SUCCESSRead it from the laptop’s point of view. It checked the server’s chain to your root, matched the name, then sent its own certificate. MPPE keys OK means both sides derived the same Wi-Fi encryption keys from the TLS session.
Now look at the FreeRADIUS terminal:
(3) eap_tls: TLS-Client-Cert-Serial := "c5ef56b76aac228f0fa5fb8e820047ee"(3) eap_tls: TLS-Client-Cert-Subject := "/CN=alice@example.com"(3) eap_tls: TLS-Client-Cert-Issuer := "/O=Lab CA/CN=Lab CA Intermediate CA"(3) eap_tls: TLS-Client-Cert-Subject-Alt-Name-Email := "alice@example.com"(3) eap_tls: TLS-Client-Cert-X509v3-Extended-Key-Usage += "TLS Web Client Authentication"...(4) Sent Access-Accept Id 4 from 127.0.0.1:1812 to 127.0.0.1:42326 length 173FreeRADIUS turned the certificate into attributes. A real deployment uses them in policy, for example to put a device on the right VLAN.
Break it
Section titled “Break it”Run each test from the eapol_test terminal. Watch both outputs.
A laptop that doesn’t check the server
Section titled “A laptop that doesn’t check the server”Make a copy of the config without the server checks:
grep -v -e ca_cert -e domain_match eaptls.conf > noverify.confeapol_test -c noverify.conf -a 127.0.0.1 -s testing123TLS: tls_verify_cb - preverify_ok=1 err=20 (unable to get local issuer certificate) ca_cert_verify=0 depth=0 buf='/CN=radius.example.com'CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfullySUCCESSIt worked. That’s the problem. The laptop noticed it couldn’t verify the server, then connected anyway. An attacker with a fake access point and any certificate gets the same result. This is the “evil twin” attack. Every managed device needs both the root and the server name configured.
The wrong server name
Section titled “The wrong server name”Change the expected name:
sed 's/radius.example.com/wifi.example.com/' eaptls.conf > mismatch.confeapol_test -c mismatch.conf -a 127.0.0.1 -s testing123TLS: Domain match 'wifi.example.com' not foundCTRL-EVENT-EAP-TLS-CERT-ERROR reason=10 depth=0 subject='/CN=radius.example.com' err='Domain mismatch'...FAILUREGood. The root alone isn’t enough, because it signs laptops too. The name check is what pins the server.
A client certificate from another CA
Section titled “A client certificate from another CA”Any certificate from a CA that isn’t in ca_file fails. If you have a second test CA, issue a client certificate from it as other.crt and other.key. Point a copy of the config at it:
sed -e 's/alice.crt/other.crt/' -e 's/alice.key/other.key/' eaptls.conf > otherca.confeapol_test -c otherca.conf -a 127.0.0.1 -s testing123FreeRADIUS logs:
(17) eap_tls: ERROR: (TLS) OpenSSL says error 20 : unable to get local issuer certificate(17) eap_tls: ERROR: (TLS) TLS - Alert write:fatal:unknown CAA server certificate used as a client
Section titled “A server certificate used as a client”Point the laptop at the RADIUS server’s own certificate and key:
sed -e 's/alice.crt/radius.crt/' -e 's/alice.key/radius.key/' eaptls.conf > servercert.confeapol_test -c servercert.conf -a 127.0.0.1 -s testing123(21) eap_tls: ERROR: (TLS) OpenSSL says error 26 : unsuitable certificate purpose(21) eap_tls: ERROR: (TLS) TLS - Alert write:fatal:unsupported certificateThe signature is valid, but the EKU says serverAuth only. This is why the strict template in step 2 matters.
An identity with a realm
Section titled “An identity with a realm”Change the outer identity to include a domain:
sed 's/identity="alice"/identity="alice@example.com"/' eaptls.conf > realm.confeapol_test -c realm.conf -a 127.0.0.1 -s testing123(22) suffix: Looking up realm "example.com" for User-Name = "alice@example.com"(22) suffix: Found realm "example.com"(22) suffix: Proxying request from user alice to realm example.com...(22) eap: Request is supposed to be proxied to Realm example.com. Not doing EAP.The sample proxy.conf defines a realm called example.com, so FreeRADIUS forwards the request instead of handling it. Real deployments use realms to route users between organisations, as eduroam does. Know where your identities go.
Connect real hardware
Section titled “Connect real hardware”The lab above is the hard part. A real network adds three things:
- Register the access point or switch as a RADIUS client in
/etc/freeradius/3.0/clients.conf, with its IP address and a long random shared secret. - Set the SSID or switch port to WPA2/WPA3-Enterprise or 802.1X, pointing at the FreeRADIUS address.
- Configure each device with the root certificate, the server name (
radius.example.com), and its client certificate. Many systems import a.p12bundle.step certificate p12makes one.
At scale, an MDM pushes the root, the certificate and the Wi-Fi profile to each device. Some platforms can also prove the key lives in the device’s TPM or secure enclave through ACME device attestation.
Lifecycle
Section titled “Lifecycle”Your client certificates last one week. A laptop renews its own with step ca renew before then, using the current certificate to authenticate. A lost laptop simply doesn’t renew. See module 6 for renewal and revocation, including CRLs.
Go deeper
Section titled “Go deeper”- RFC 5216 — the EAP-TLS authentication protocol.
- RFC 9190 — EAP-TLS with TLS 1.3.
- RFC 3580 — how 802.1X uses RADIUS.
- FreeRADIUS documentation
- wpa_supplicant — the project
eapol_testcomes from. - step-ca certificate templates
Check yourself
Tap a card to flip it. Nothing is scored or saved.
Progress is saved in this browser only.