So, everybody knows that WPS (Wi-Fi Protected Setup) is broken. But sometimes, you don't own the access point, and you'd just want the wireless to work. That happens for example when you're a guest in some place using an Orange Livebox and you don't have the WPA passphrase (usually because it's written somewhere you don't have access too, or because someone forgot to tell you).
Liveboxes WPS is the “press button” thing: you press a button on the front for one second, then any device can connect in the next two minutes. That works fine with Android devices, for example, but it didn't work with my laptop and NetworkManager, which doesn't support WPS at all.
Fortunately, the underlying piece of software (wpa_supplicant) does support WPS, and even the “push button” style. And you can nicely ask it to reveal the passphrase to you with the following trick.
- Disconnect NetworkManager from the network, disable the wireless link, stop it; just make sure wpa_supplicant is not running;
- Put a stub wpa_supplicant.conf file with only the following content:
update_config=1
- Start wpa_supplicant in the foreground with your stub config file:
wpa_supplicant -iwlan0 -c wpa_supplicant.conf
- Start wpa_cli
- Scan the network:
scan
- Get the results:
scan_results
and identity the bssid of the Livebox - Press the WPS button on the Livebox
- Run
wps_pbc <bssid>
; some text should appear in the wpa_cli window, and it should eventually connect successfully (at that point you can even run a dhclient on wlan0) - Run
save_config
The last command will update your stub configuration file, adding a new network block with the passphrase in the clear. You can then use that passphrase inside Network Manager if it's more convenient for you.
There might be something easier, but at least it worked just fine for me during the holidays.