Commands / Services and tunnels

Services and tunnels

hostapd_cli

Also hostapd, authenticator, 802.1x switch

Asks hostapd, the 802.1X authenticator on a switch port or access point, about the devices it has logged in.

hostapd keeps an 802.1X state machine per device ("station"). all_sta lists each one by MAC with flags=[AUTHORIZED] once RADIUS accepted it, the user name (dot1xAuthSessionUserName), the EAP method and counters of EAPOL frames and RADIUS answers. With -a SCRIPT it runs a script on each event (AP-STA-CONNECTED, AP-STA-DISCONNECTED), which is how a software switch can open and close a port.

hostapd_cli command usage

hostapd_cli [-p DIR] -i PORT all_sta|sta MAC
hostapd_cli [-p DIR] -i PORT -a SCRIPT

Options

-p /run/hostapd
where hostapd's control sockets are
-i PORT
the port (interface) to ask about
all_sta
every device on the port, with its 802.1X state
-a SCRIPT
run SCRIPT with port, event and MAC on each event

hostapd_cli examples

hostapd_cli -p /run/hostapd -i laptop all_sta
Shows who is logged in on the laptop's port, as which user and with which EAP method.

Pitfalls

  • A device that only stops its supplicant stays AUTHORIZED until it logs off, its link drops or the next reauthentication fails.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab