On Thu, 22 Oct 2026, at 15:44, Olivier wrote:
I've got a Freeradius instance on a debian 13 host. It is used as a backend with a (rather old) Unifi WPA2 Entreprise. WiFi rely on PEAP/MSCHAPv2.
Which if I remember, Microsoft is mostly breaking this month with a security update[3].
My goal is to unit test connections from an Android device. I'm using the followiing script on the debian 13:
cat > ${TMP_CFG} << EOF network={ ssid="${SSID}" key_mgmt=WPA-EAP eap=PEAP identity="${CLIENT_ID2}" password="${CLIENT_PWD}" phase2="autheap=MSCHAPV2" ca_cert="${SYSTEM_CA_CERT}" domain_match="${DOMAIN}" } EOF eapol_test -v -c ${TMP_CFG} -a ${SERVER_IP} -A ${SERVER_IP} -s ${RADIUS_SECRET} >> ${LOG_FILE}
Last line returns 0 as exit code.
As a suggestion, a pattern I like to lean on in my Shell scripts: ---- TMP_CONF=$(mktemp) cleanup () { rm "$TMP_CONF" } trap cleanup EXIT INT ---- Means this is safe to run in parallel, plus no files are left behind when the script exits. Always a good idea to punt code through a linter, ShellCheck[1] is not a terrible choice here.
Now with my smartphone, I must disable CA Certificate validation to successfully connect to WiFi.
Then you need to install the root CA(s) on to your Android device.
1. What do you think of the above script ? Can I use it reliably to test WiFi connections from Android, Windows, iOS and MacOS devices ?
The script tests if EAP can authenticate over RADIUS, it does help you emulate real devices. In practice though this is what most (all?) of us use as if the wifi/wired leg is not working, that is unlikely to be a RADIUS/EAP issue and more "put your venduh kit (or device) in the bin". What you may find useful, I have some work[2] up on Github for automating testing Windows running in QEMU strapped to hostapd that then sends RADIUS packets to FreeRADIUS. This is probably as close as you can get for an end-to-end test as it exercises *wired* 802.1X pretty much true to form.
2. What could explain difference between live testing with a real Android device and the above script ?
Either your Android device is using the wrong CA(s) or the chain you are presenting to the device is broken. You should use 'openssl verify ...' to figure out if your cert chain is valid which means your server certificate at the top followed by the sub-CAs, but do not include the root CA at the end of the list as it will only slow down authentication and actually make it less reliable (IP fragmentation). Something like the following should start you off: openssl verify -show_chain -CApath /path/to/your/root/ca.pem -untrusted /path/to/the/sub/ca.pem -purpose sslserver -verify_hostname whatever.example.com /path/to/the/server.pem Inspect the output from the '-show_chain', it should tell you if you mixed things up. Also may be good to turn *off* 'auto_chain' in your eap.conf file to avoid any silly business from OpenSSL muddying the waters. Regards Alex [1] https://www.shellcheck.net/ [2] https://github.com/jimdigriz/winci/tree/main/examples/dot1x [3] https://www.theregister.com/security/2026/10/16/networking-problems-after-th...