Skip to content
Module 05

EAP-TLS with FreeRADIUS

Use certificates instead of passwords to join Wi-Fi or wired networks.

EAP-TLSAdvanced 45 min

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.

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.

Supplicantlaptop / deviceAuthenticatorswitch / Wi-Fi APRADIUS serverFreeRADIUSEAPOLRADIUSCertificates exchanged end-to-end inside EAP
  • 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.

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:

terminal
sudo apt install -y freeradius eapoltest

Then stop the background service:

terminal
sudo systemctl stop freeradius

2. 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:

wifi.tpl
{
"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:

terminal
step ca provisioner add wifi --type JWK --create \
--x509-template wifi.tpl \
--x509-default-dur 168h --x509-max-dur 720h

Choose a password for the new provisioner when asked.

Expected output
✔ 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:

terminal
pkill -HUP -x step-ca

3. Issue the server and client certificates

Section titled “3. Issue the server and client certificates”

Make a working folder:

terminal
mkdir -p ~/pki-lab/eap && cd ~/pki-lab/eap

Issue the RADIUS server certificate. --set role=server picks the server branch of the template:

terminal
step ca certificate radius.example.com radius.crt radius.key \
--provisioner wifi --set role=server
Expected output
✔ Provisioner: wifi (JWK) [kid: c703dzooi6hSNFaz00eax8xRxcQuzObfwvOAbKiInGA]
✔ CA: https://localhost:9000
✔ Certificate: radius.crt
✔ Private Key: radius.key

Issue a client certificate for Alice’s laptop:

terminal
step ca certificate alice@example.com alice.crt alice.key --provisioner wifi

Check the EKUs:

terminal
openssl x509 -in radius.crt -noout -ext extendedKeyUsage
Expected output
X509v3 Extended Key Usage:
TLS Web Server Authentication
terminal
openssl x509 -in alice.crt -noout -ext extendedKeyUsage
Expected output
X509v3 Extended Key Usage:
TLS Web Client Authentication

Copy the root next to them:

terminal
cp $(step path)/certs/root_ca.crt .

Make a folder FreeRADIUS can read:

terminal
sudo mkdir -p /etc/freeradius/3.0/certs/pki-lab

Copy the server certificate, its key and the root:

terminal
sudo cp radius.crt radius.key root_ca.crt /etc/freeradius/3.0/certs/pki-lab/

Give the files to the freerad user:

terminal
sudo chown -R freerad:freerad /etc/freeradius/3.0/certs/pki-lab

Make the key unreadable to everyone else:

terminal
sudo chmod 640 /etc/freeradius/3.0/certs/pki-lab/radius.key

Open the EAP module config:

terminal
sudoedit /etc/freeradius/3.0/mods-available/eap

Make 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:

terminal
sudo freeradius -XC | tail -1
Expected output
Configuration appears to be OK
terminal
sudo freeradius -X
Expected output (last lines)
Listening on proxy address * port 42839
Ready to process requests

Leave it running. Debug mode prints every step of every request. It’s the best EAP teacher there is.

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:

eaptls.conf
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_cert and domain_match are how the laptop checks the server. Both matter.
  • identity is the outer EAP name. It’s not the certificate. Keep it free of @domain for now. You’ll see why below.

Run the test. testing123 is the shared secret FreeRADIUS ships for localhost:

terminal
eapol_test -c eaptls.conf -a 127.0.0.1 -s testing123
Expected output (excerpt)
CTRL-EVENT-EAP-STARTED EAP authentication started
CTRL-EVENT-EAP-METHOD EAP vendor 0 method 13 (TLS) selected
CTRL-EVENT-EAP-PEER-CERT depth=2 subject='/O=Lab CA/CN=Lab CA Root CA' hash=0681c596b1048ed34c10c4f1e67aff7c79b0a411e092f146edd3e75618f19bd5
CTRL-EVENT-EAP-PEER-CERT depth=1 subject='/O=Lab CA/CN=Lab CA Intermediate CA' hash=fec784d7112b3a5467c43a95a970589d2cd085f59e859e8f498479c197006c6b
CTRL-EVENT-EAP-PEER-CERT depth=0 subject='/CN=radius.example.com' hash=a542894cc27f892f748dda5756bd9f6360a5311aec74657e5362641708bf16d7
CTRL-EVENT-EAP-PEER-ALT depth=0 DNS:radius.example.com
CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
...
MPPE keys OK: 1 mismatch: 0
SUCCESS

Read 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:

FreeRADIUS debug output (excerpt)
(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 173

FreeRADIUS turned the certificate into attributes. A real deployment uses them in policy, for example to put a device on the right VLAN.

Run each test from the eapol_test terminal. Watch both outputs.

Make a copy of the config without the server checks:

terminal
grep -v -e ca_cert -e domain_match eaptls.conf > noverify.conf
terminal
eapol_test -c noverify.conf -a 127.0.0.1 -s testing123
Expected output (excerpt)
TLS: 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 successfully
SUCCESS

It 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.

Change the expected name:

terminal
sed 's/radius.example.com/wifi.example.com/' eaptls.conf > mismatch.conf
terminal
eapol_test -c mismatch.conf -a 127.0.0.1 -s testing123
Expected output (excerpt)
TLS: Domain match 'wifi.example.com' not found
CTRL-EVENT-EAP-TLS-CERT-ERROR reason=10 depth=0 subject='/CN=radius.example.com' err='Domain mismatch'
...
FAILURE

Good. The root alone isn’t enough, because it signs laptops too. The name check is what pins the server.

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:

terminal
sed -e 's/alice.crt/other.crt/' -e 's/alice.key/other.key/' eaptls.conf > otherca.conf
terminal
eapol_test -c otherca.conf -a 127.0.0.1 -s testing123

FreeRADIUS logs:

FreeRADIUS debug output (excerpt)
(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 CA

Point the laptop at the RADIUS server’s own certificate and key:

terminal
sed -e 's/alice.crt/radius.crt/' -e 's/alice.key/radius.key/' eaptls.conf > servercert.conf
terminal
eapol_test -c servercert.conf -a 127.0.0.1 -s testing123
FreeRADIUS debug output (excerpt)
(21) eap_tls: ERROR: (TLS) OpenSSL says error 26 : unsuitable certificate purpose
(21) eap_tls: ERROR: (TLS) TLS - Alert write:fatal:unsupported certificate

The signature is valid, but the EKU says serverAuth only. This is why the strict template in step 2 matters.

Change the outer identity to include a domain:

terminal
sed 's/identity="alice"/identity="alice@example.com"/' eaptls.conf > realm.conf
terminal
eapol_test -c realm.conf -a 127.0.0.1 -s testing123
FreeRADIUS debug output (excerpt)
(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.

The lab above is the hard part. A real network adds three things:

  1. 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.
  2. Set the SSID or switch port to WPA2/WPA3-Enterprise or 802.1X, pointing at the FreeRADIUS address.
  3. Configure each device with the root certificate, the server name (radius.example.com), and its client certificate. Many systems import a .p12 bundle. step certificate p12 makes 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.

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.

Check yourself

Tap a card to flip it. Nothing is scored or saved.

Progress is saved in this browser only.