Encoding your WiFi access point password into a QR code
Up until recently, it was a pain to defend againt WPA2 brute-force attacks by using a random 63-character password (the maximum in WPA-Personal) mode). Thanks to Android and now iOS 11 supporting reading WiFi passwords from a QR code, this is finally a practical defense.
Generating the QR code
After installing the
qrencode package, run the following:
qrencode -o wifi.png "WIFI:T:WPA;S:<SSID>;P:<PASSWORD>;;"
<SSID> for the name of your WiFi network and
<PASSWORD> for the 63-character password you hopefully generated with
pwgen -s 63.
The only pitfall I ran into is that if you include a trailing newline character (for example piping
echo "..." into
qrencode as opposed to
echo -n "...") then it will fail on both iOS and Android.
Scanning the QR code
On iOS, simply open the camera app and scan the QR code to bring up a notification which allows you to connect to the WiFi network:
On Android, go into the WiFi settings and tap on the WiFi network you want to join:
then click the QR icon in the password field and scan the code: