Difference between revisions of "wpa supplicant"
From Noah.org
Jump to navigationJump to searchm (→script) |
m (→examples) |
||
Line 105: | Line 105: | ||
key_mgmt=WPA-PSK | key_mgmt=WPA-PSK | ||
} | } | ||
+ | </pre> | ||
+ | |||
+ | Finally, start '''wpa_supplicant''' to connect to the AP. | ||
+ | <pre> | ||
+ | wpa_supplicant -Dwext -iwlan0 -cMy | ||
+ | dhclient walnut | ||
</pre> | </pre> |
Revision as of 23:13, 23 June 2014
script
This is similar to running wpa_pas expect that it adds scan_ssid=1 to the config and it deletes the plantext password..
#!/bin/bash # # This creates a wpa_supplicant.conf file and # starts the wpa_supplicant daemon to serve it. # TARGET_SSID=$1 PASSWORD=$2 IWFACE=$3 echo "You must add authorized users to 'netdev' group." (echo "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev"; \ wpa_passphrase "${TARGET_SSID}" "${PASSWORD}" | \ grep -v \#psk | sed '/ssid/a \\tscan_ssid=1') > wpa_${TARGET_SSID}.conf chmod 600 wpa_${TARGET_SSID}.conf ifconfig ${IWFACE} down sleep 1 wpa_supplicant -B -cwpa_${TARGET_SSID}.conf -i${IWFACE} -Dwext sleep 1 ifconfig ${IWFACE} up dhclient ${IWFACE} # vim:set sr et ts=4 sw=4 ft=sh: // See Vim, :help 'modeline'
simplest
# Note that the key, psk, is in plaintext. network={ ssid="omega" scan_ssid=1 psk="wifipassword" }
simple, with restriction on the key type
# Note that the key, psk, is in plaintext. network={ ssid="omega" scan_ssid=1 key_mgmt=WPA-PSK psk="wifipassword" }
examples
cat /proc/net/dev cat /proc/net/wireless ifconfig ra0 up iwlist ra0 scan
# iwlist ra0 scan ra0 Scan completed : Cell 01 - Address: 00:14:BF:28:FA:76 ESSID:"homebase" Mode:Managed Channel:1 Quality:76/100 Signal level:-60 dBm Noise level:-97 dBm Encryption key:on Bit Rates:54 Mb/s IE: WPA Version 1 Group Cipher : TKIP Pairwise Ciphers (2) : CCMP TKIP Authentication Suites (1) : PSK IE: IEEE 802.11i/WPA2 Version 1 Group Cipher : TKIP Pairwise Ciphers (2) : CCMP TKIP Authentication Suites (1) : PSK
# wpa_passphrase homebase foobar77 network={ ssid="homebase" #psk="foobar77" psk=6d17e9c2946eae02e0dbb65b23bff89397396cdfb244df31fc10fd68dd004efa }
# allow frontend (wpa_cli) to be used by all users in 'admin' group ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=admin network={ ssid="homebase" psk=6d17e9c2946eae02e0dbb65b23bff89397396cdfb244df31fc10fd68dd004efa scan_ssid=1 key_mgmt=WPA-PSK }
Finally, start wpa_supplicant to connect to the AP.
wpa_supplicant -Dwext -iwlan0 -cMy dhclient walnut