1*a399b765Szf162725#pragma ident "%Z%%M% %I% %E% SMI" 2*a399b765Szf162725 3*a399b765Szf162725WPA Supplicant 4*a399b765Szf162725============== 5*a399b765Szf162725 6*a399b765Szf162725Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi> 7*a399b765Szf162725All Rights Reserved. 8*a399b765Szf162725 9*a399b765Szf162725Sun elects to license this software under the BSD license. 10*a399b765Szf162725 11*a399b765Szf162725 12*a399b765Szf162725License 13*a399b765Szf162725------- 14*a399b765Szf162725 15*a399b765Szf162725BSD license: 16*a399b765Szf162725 17*a399b765Szf162725Redistribution and use in source and binary forms, with or without 18*a399b765Szf162725modification, are permitted provided that the following conditions are 19*a399b765Szf162725met: 20*a399b765Szf162725 21*a399b765Szf1627251. Redistributions of source code must retain the above copyright 22*a399b765Szf162725 notice, this list of conditions and the following disclaimer. 23*a399b765Szf162725 24*a399b765Szf1627252. Redistributions in binary form must reproduce the above copyright 25*a399b765Szf162725 notice, this list of conditions and the following disclaimer in the 26*a399b765Szf162725 documentation and/or other materials provided with the distribution. 27*a399b765Szf162725 28*a399b765Szf1627253. Neither the name(s) of the above-listed copyright holder(s) nor the 29*a399b765Szf162725 names of its contributors may be used to endorse or promote products 30*a399b765Szf162725 derived from this software without specific prior written permission. 31*a399b765Szf162725 32*a399b765Szf162725THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 33*a399b765Szf162725"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 34*a399b765Szf162725LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 35*a399b765Szf162725A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 36*a399b765Szf162725OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 37*a399b765Szf162725SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38*a399b765Szf162725LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 39*a399b765Szf162725DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 40*a399b765Szf162725THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 41*a399b765Szf162725(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 42*a399b765Szf162725OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43*a399b765Szf162725 44*a399b765Szf162725 45*a399b765Szf162725 46*a399b765Szf162725Features 47*a399b765Szf162725-------- 48*a399b765Szf162725 49*a399b765Szf162725Supported WPA/IEEE 802.11i features: 50*a399b765Szf162725- WPA-PSK ("WPA-Personal") 51*a399b765Szf162725- WPA with EAP (e.g., with RADIUS authentication server) ("WPA-Enterprise") 52*a399b765Szf162725 Following authentication methods are supported with an integrate IEEE 802.1X 53*a399b765Szf162725 Supplicant: 54*a399b765Szf162725 * EAP-TLS 55*a399b765Szf162725 * EAP-PEAP/MSCHAPv2 (both PEAPv0 and PEAPv1) 56*a399b765Szf162725 * EAP-PEAP/TLS (both PEAPv0 and PEAPv1) 57*a399b765Szf162725 * EAP-PEAP/GTC (both PEAPv0 and PEAPv1) 58*a399b765Szf162725 * EAP-PEAP/OTP (both PEAPv0 and PEAPv1) 59*a399b765Szf162725 * EAP-PEAP/MD5-Challenge (both PEAPv0 and PEAPv1) 60*a399b765Szf162725 * EAP-TTLS/EAP-MD5-Challenge 61*a399b765Szf162725 * EAP-TTLS/EAP-GTC 62*a399b765Szf162725 * EAP-TTLS/EAP-OTP 63*a399b765Szf162725 * EAP-TTLS/EAP-MSCHAPv2 64*a399b765Szf162725 * EAP-TTLS/EAP-TLS 65*a399b765Szf162725 * EAP-TTLS/MSCHAPv2 66*a399b765Szf162725 * EAP-TTLS/MSCHAP 67*a399b765Szf162725 * EAP-TTLS/PAP 68*a399b765Szf162725 * EAP-TTLS/CHAP 69*a399b765Szf162725 * EAP-SIM 70*a399b765Szf162725 * LEAP (note: only with WEP keys, i.e., not for WPA; in addition, LEAP 71*a399b765Szf162725 requires special support from the driver for IEEE 802.11 72*a399b765Szf162725 authentication) 73*a399b765Szf162725 (following methods are supported, but since they do not generate keying 74*a399b765Szf162725 material, they cannot be used with WPA or IEEE 802.1X WEP keying) 75*a399b765Szf162725 * EAP-MD5-Challenge 76*a399b765Szf162725 * EAP-MSCHAPv2 77*a399b765Szf162725 * EAP-GTC 78*a399b765Szf162725 * EAP-OTP 79*a399b765Szf162725 Alternatively, an external program, e.g., Xsupplicant, can be used for EAP 80*a399b765Szf162725 authentication. 81*a399b765Szf162725- key management for CCMP, TKIP, WEP104, WEP40 82*a399b765Szf162725- RSN/WPA2 (IEEE 802.11i) 83*a399b765Szf162725 * pre-authentication 84*a399b765Szf162725 * PMKSA caching 85*a399b765Szf162725 86*a399b765Szf162725 87*a399b765Szf162725 88*a399b765Szf162725Requirements 89*a399b765Szf162725------------ 90*a399b765Szf162725 91*a399b765Szf162725Current hardware/software requirements: 92*a399b765Szf162725- Linux kernel 2.4.x or 2.6.x 93*a399b765Szf162725- Linux Wireless Extensions v15 or newer 94*a399b765Szf162725- drivers: 95*a399b765Szf162725 Host AP driver for Prism2/2.5/3 (development snapshot/v0.2.x) 96*a399b765Szf162725 in Managed mode ('iwconfig wlan0 mode managed'). Please note that 97*a399b765Szf162725 station firmware version needs to be 1.7.0 or newer to work in 98*a399b765Szf162725 WPA mode. 99*a399b765Szf162725 100*a399b765Szf162725 Linuxant DriverLoader (http://www.linuxant.com/driverloader/) 101*a399b765Szf162725 with Windows NDIS driver for your wlan card supporting WPA. 102*a399b765Szf162725 103*a399b765Szf162725 Agere Systems Inc. Linux Driver 104*a399b765Szf162725 (http://www.agere.com/support/drivers/) 105*a399b765Szf162725 Please note that the driver interface file (driver_hermes.c) and 106*a399b765Szf162725 hardware specific include files are not included in the 107*a399b765Szf162725 wpa_supplicant distribution. You will need to copy these from the 108*a399b765Szf162725 source package of the Agere driver. 109*a399b765Szf162725 110*a399b765Szf162725 madwifi driver for cards based on Atheros chip set (ar521x) 111*a399b765Szf162725 (http://sourceforge.net/projects/madwifi/) 112*a399b765Szf162725 Please note that you will need to modify the wpa_supplicant Makefile 113*a399b765Szf162725 to use correct path for madwifi driver root directory 114*a399b765Szf162725 (CFLAGS += -I../madwifi/wpa line in Makefile). 115*a399b765Szf162725 116*a399b765Szf162725 ATMEL AT76C5XXx driver for USB and PCMCIA cards 117*a399b765Szf162725 (http://atmelwlandriver.sourceforge.net/). 118*a399b765Szf162725 119*a399b765Szf162725 Linux ndiswrapper (http://ndiswrapper.sourceforge.net/) with 120*a399b765Szf162725 Windows NDIS driver. 121*a399b765Szf162725 122*a399b765Szf162725 In theory, any driver that supports Linux wireless extensions can be 123*a399b765Szf162725 used with IEEE 802.1X (i.e., not WPA) when using ap_scan=0 option in 124*a399b765Szf162725 configuration file. 125*a399b765Szf162725 126*a399b765Szf162725wpa_supplicant was designed to be portable for different drivers and 127*a399b765Szf162725operating systems. Hopefully, support for more wlan cards will be 128*a399b765Szf162725added in the future. See developer.txt for more information about the 129*a399b765Szf162725design of wpa_supplicant and porting to other drivers. One main goal 130*a399b765Szf162725is to add full WPA/WPA2 support to Linux wireless extensions to allow 131*a399b765Szf162725new drivers to be supported without having to implement new 132*a399b765Szf162725driver-specific interface code in wpa_supplicant. 133*a399b765Szf162725 134*a399b765Szf162725Optional libraries for layer2 packet processing: 135*a399b765Szf162725- libpcap (tested with 0.7.2, most relatively recent versions assumed to work, 136*a399b765Szf162725 this is likely to be available with most distributions, 137*a399b765Szf162725 http://tcpdump.org/) 138*a399b765Szf162725- libdnet (tested with v1.4, most versions assumed to work, 139*a399b765Szf162725 http://libdnet.sourceforge.net/) 140*a399b765Szf162725 141*a399b765Szf162725These libraries are _not_ used in the default build. Instead, internal 142*a399b765Szf162725Linux specific implementation is used. libpcap/libdnet are more 143*a399b765Szf162725portable and they can be used by modifying Makefile (define 144*a399b765Szf162725USE_DNET_PCAP and link with these libraries). 145*a399b765Szf162725 146*a399b765Szf162725 147*a399b765Szf162725Optional libraries for EAP-TLS, EAP-PEAP, and EAP-TTLS: 148*a399b765Szf162725- openssl (tested with 0.9.7c and 0.9.7d, assumed to work with most 149*a399b765Szf162725 relatively recent versions; this is likely to be available with most 150*a399b765Szf162725 distributions, http://www.openssl.org/) 151*a399b765Szf162725 152*a399b765Szf162725This library is only needed when EAP-TLS, EAP-PEAP, or EAP-TTLS 153*a399b765Szf162725support is enabled. WPA-PSK mode does not require this or EAPOL/EAP 154*a399b765Szf162725implementation. A configuration file, .config, for compilation is 155*a399b765Szf162725needed to enable IEEE 802.1X/EAPOL and EAP methods. Note that EAP-MD5, 156*a399b765Szf162725EAP-GTC, EAP-OTP, and EAP-MSCHAPV2 cannot be used alone with WPA, so 157*a399b765Szf162725they should only be enabled if testing the EAPOL/EAP state 158*a399b765Szf162725machines. However, there can be used as inner authentication 159*a399b765Szf162725algorithms with EAP-PEAP and EAP-TTLS. 160*a399b765Szf162725 161*a399b765Szf162725See Building and installing section below for more detailed 162*a399b765Szf162725information about the wpa_supplicant build time configuration. 163*a399b765Szf162725 164*a399b765Szf162725 165*a399b765Szf162725 166*a399b765Szf162725WPA 167*a399b765Szf162725--- 168*a399b765Szf162725 169*a399b765Szf162725The original security mechanism of IEEE 802.11 standard was not 170*a399b765Szf162725designed to be strong and has proved to be insufficient for most 171*a399b765Szf162725networks that require some kind of security. Task group I (Security) 172*a399b765Szf162725of IEEE 802.11 working group (http://www.ieee802.org/11/) has worked 173*a399b765Szf162725to address the flaws of the base standard and has in practice 174*a399b765Szf162725completed its work in May 2004. The IEEE 802.11i amendment to the IEEE 175*a399b765Szf162725802.11 standard was approved in June 2004 and this amendment is likely 176*a399b765Szf162725to be published in July 2004. 177*a399b765Szf162725 178*a399b765Szf162725Wi-Fi Alliance (http://www.wi-fi.org/) used a draft version of the 179*a399b765Szf162725IEEE 802.11i work (draft 3.0) to define a subset of the security 180*a399b765Szf162725enhancements that can be implemented with existing wlan hardware. This 181*a399b765Szf162725is called Wi-Fi Protected Access<TM> (WPA). This has now become a 182*a399b765Szf162725mandatory component of interoperability testing and certification done 183*a399b765Szf162725by Wi-Fi Alliance. Wi-Fi provides information about WPA at its web 184*a399b765Szf162725site (http://www.wi-fi.org/OpenSection/protected_access.asp). 185*a399b765Szf162725 186*a399b765Szf162725IEEE 802.11 standard defined wired equivalent privacy (WEP) algorithm 187*a399b765Szf162725for protecting wireless networks. WEP uses RC4 with 40-bit keys, 188*a399b765Szf16272524-bit initialization vector (IV), and CRC32 to protect against packet 189*a399b765Szf162725forgery. All these choice have proved to be insufficient: key space is 190*a399b765Szf162725too small against current attacks, RC4 key scheduling is insufficient 191*a399b765Szf162725(beginning of the pseudorandom stream should be skipped), IV space is 192*a399b765Szf162725too small and IV reuse makes attacks easier, there is no replay 193*a399b765Szf162725protection, and non-keyed authentication does not protect against bit 194*a399b765Szf162725flipping packet data. 195*a399b765Szf162725 196*a399b765Szf162725WPA is an intermediate solution for the security issues. It uses 197*a399b765Szf162725temporal key integrity protocol (TKIP) to replace WEP. TKIP is a 198*a399b765Szf162725compromise on strong security and possibility to use existing 199*a399b765Szf162725hardware. It still uses RC4 for the encryption like WEP, but with 200*a399b765Szf162725per-packet RC4 keys. In addition, it implements replay protection, 201*a399b765Szf162725keyed packet authentication mechanism (Michael MIC). 202*a399b765Szf162725 203*a399b765Szf162725Keys can be managed using two different mechanisms. WPA can either use 204*a399b765Szf162725an external authentication server (e.g., RADIUS) and EAP just like 205*a399b765Szf162725IEEE 802.1X is using or pre-shared keys without need for additional 206*a399b765Szf162725servers. Wi-Fi calls these "WPA-Enterprise" and "WPA-Personal", 207*a399b765Szf162725respectively. Both mechanisms will generate a master session key for 208*a399b765Szf162725the Authenticator (AP) and Supplicant (client station). 209*a399b765Szf162725 210*a399b765Szf162725WPA implements a new key handshake (4-Way Handshake and Group Key 211*a399b765Szf162725Handshake) for generating and exchanging data encryption keys between 212*a399b765Szf162725the Authenticator and Supplicant. This handshake is also used to 213*a399b765Szf162725verify that both Authenticator and Supplicant know the master session 214*a399b765Szf162725key. These handshakes are identical regardless of the selected key 215*a399b765Szf162725management mechanism (only the method for generating master session 216*a399b765Szf162725key changes). 217*a399b765Szf162725 218*a399b765Szf162725 219*a399b765Szf162725 220*a399b765Szf162725IEEE 802.11i / WPA2 221*a399b765Szf162725------------------- 222*a399b765Szf162725 223*a399b765Szf162725The design for parts of IEEE 802.11i that were not included in WPA has 224*a399b765Szf162725finished (May 2004) and this amendment to IEEE 802.11 was approved in 225*a399b765Szf162725June 2004. Wi-Fi Alliance is using the final IEEE 802.11i as a new 226*a399b765Szf162725version of WPA called WPA2. This includes, e.g., support for more 227*a399b765Szf162725robust encryption algorithm (CCMP: AES in Counter mode with CBC-MAC) 228*a399b765Szf162725to replace TKIP and optimizations for handoff (reduced number of 229*a399b765Szf162725messages in initial key handshake, pre-authentication, key caching). 230*a399b765Szf162725 231*a399b765Szf162725Some wireless LAN vendors are already providing support for CCMP in 232*a399b765Szf162725their WPA products. There is no "official" interoperability 233*a399b765Szf162725certification for CCMP and/or mixed modes using both TKIP and CCMP, so 234*a399b765Szf162725some interoperability issues can be expected even though many 235*a399b765Szf162725combinations seem to be working with equipment from different vendors. 236*a399b765Szf162725Certification for WPA2 is likely to start during the second half of 237*a399b765Szf1627252004. 238*a399b765Szf162725 239*a399b765Szf162725 240*a399b765Szf162725 241*a399b765Szf162725wpa_supplicant 242*a399b765Szf162725-------------- 243*a399b765Szf162725 244*a399b765Szf162725wpa_supplicant is an implementation of the WPA Supplicant component, 245*a399b765Szf162725i.e., the part that runs in the client stations. It implements WPA key 246*a399b765Szf162725negotiation with a WPA Authenticator and EAP authentication with 247*a399b765Szf162725Authentication Server. In addition, it controls the roaming and IEEE 248*a399b765Szf162725802.11 authentication/association of the wlan driver. 249*a399b765Szf162725 250*a399b765Szf162725wpa_supplicant is designed to be a "daemon" program that runs in the 251*a399b765Szf162725background and acts as the backend component controlling the wireless 252*a399b765Szf162725connection. wpa_supplicant supports separate frontend programs and an 253*a399b765Szf162725example text-based frontend, wpa_cli, is included with wpa_supplicant. 254*a399b765Szf162725 255*a399b765Szf162725Following steps are used when associating with an AP using WPA: 256*a399b765Szf162725 257*a399b765Szf162725- wpa_supplicant requests the kernel driver to scan neighboring BSSes 258*a399b765Szf162725- wpa_supplicant selects a BSS based on its configuration 259*a399b765Szf162725- wpa_supplicant requests the kernel driver to associate with the chosen 260*a399b765Szf162725 BSS 261*a399b765Szf162725- If WPA-EAP: integrated IEEE 802.1X Supplicant or external Xsupplicant 262*a399b765Szf162725 completes EAP authentication with the authentication server (proxied 263*a399b765Szf162725 by the Authenticator in the AP) 264*a399b765Szf162725- If WPA-EAP: master key is received from the IEEE 802.1X Supplicant 265*a399b765Szf162725- If WPA-PSK: wpa_supplicant uses PSK as the master session key 266*a399b765Szf162725- wpa_supplicant completes WPA 4-Way Handshake and Group Key Handshake 267*a399b765Szf162725 with the Authenticator (AP) 268*a399b765Szf162725- wpa_supplicant configures encryption keys for unicast and broadcast 269*a399b765Szf162725- normal data packets can be transmitted and received 270*a399b765Szf162725 271*a399b765Szf162725 272*a399b765Szf162725 273*a399b765Szf162725Building and installing 274*a399b765Szf162725----------------------- 275*a399b765Szf162725 276*a399b765Szf162725In order to be able to build wpa_supplicant, you will first need to 277*a399b765Szf162725select which parts of it will be included. This is done by creating a 278*a399b765Szf162725build time configuration file, .config, in the wpa_supplicant root 279*a399b765Szf162725directory. Configuration options are text lines using following 280*a399b765Szf162725format: CONFIG_<option>=y. Lines starting with # are considered 281*a399b765Szf162725comments and are ignored. 282*a399b765Szf162725 283*a399b765Szf162725The build time configuration can be used to select only the needed 284*a399b765Szf162725features and limit the binary size and requirements for external 285*a399b765Szf162725libraries. The main configuration parts are the selection of which 286*a399b765Szf162725driver interfaces (e.g., hostap, madwifi, ..) and which authentication 287*a399b765Szf162725methods (e.g., EAP-TLS, EAP-PEAP, ..) are included. 288*a399b765Szf162725 289*a399b765Szf162725Following build time configuration options are used to control IEEE 290*a399b765Szf162725802.1X/EAPOL and EAP state machines and all EAP methods. Including 291*a399b765Szf162725TLS, PEAP, or TTLS will require linking wpa_supplicant with openssl 292*a399b765Szf162725library for TLS implementation. 293*a399b765Szf162725 294*a399b765Szf162725CONFIG_IEEE8021X_EAPOL=y 295*a399b765Szf162725CONFIG_EAP_MD5=y 296*a399b765Szf162725CONFIG_MSCHAPV2=y 297*a399b765Szf162725CONFIG_EAP_TLS=y 298*a399b765Szf162725CONFIG_EAP_PEAP=y 299*a399b765Szf162725CONFIG_EAP_TTLS=y 300*a399b765Szf162725CONFIG_EAP_GTC=y 301*a399b765Szf162725CONFIG_EAP_OTP=y 302*a399b765Szf162725CONFIG_EAP_SIM=y 303*a399b765Szf162725CONFIG_EAP_LEAP=y 304*a399b765Szf162725 305*a399b765Szf162725Following option can be used to include GSM SIM/USIM interface for GSM 306*a399b765Szf162725authentication algorithm (for EAP-SIM). This requires pcsc-lite 307*a399b765Szf162725(http://www.linuxnet.com/) for smart card access. 308*a399b765Szf162725 309*a399b765Szf162725CONFIG_PCSC=y 310*a399b765Szf162725 311*a399b765Szf162725Following options can be added to .config to select which driver 312*a399b765Szf162725interfaces are included. Prism54.org driver is not yet complete and 313*a399b765Szf162725Hermes driver interface needs to be downloaded from Agere (see above). 314*a399b765Szf162725Most Linux driver need to include CONFIG_WIRELESS_EXTENSION. 315*a399b765Szf162725 316*a399b765Szf162725CONFIG_WIRELESS_EXTENSION=y 317*a399b765Szf162725CONFIG_DRIVER_HOSTAP=y 318*a399b765Szf162725CONFIG_DRIVER_PRISM54=y 319*a399b765Szf162725CONFIG_DRIVER_HERMES=y 320*a399b765Szf162725CONFIG_DRIVER_MADWIFI=y 321*a399b765Szf162725CONFIG_DRIVER_ATMEL=y 322*a399b765Szf162725CONFIG_DRIVER_WEXT=y 323*a399b765Szf162725CONFIG_DRIVER_NDISWRAPPER=y 324*a399b765Szf162725 325*a399b765Szf162725Following example includes all features and driver interfaces that are 326*a399b765Szf162725included in the wpa_supplicant package: 327*a399b765Szf162725 328*a399b765Szf162725CONFIG_DRIVER_HOSTAP=y 329*a399b765Szf162725CONFIG_DRIVER_PRISM54=y 330*a399b765Szf162725CONFIG_DRIVER_HERMES=y 331*a399b765Szf162725CONFIG_DRIVER_MADWIFI=y 332*a399b765Szf162725CONFIG_DRIVER_ATMEL=y 333*a399b765Szf162725CONFIG_DRIVER_WEXT=y 334*a399b765Szf162725CONFIG_DRIVER_NDISWRAPPER=y 335*a399b765Szf162725CONFIG_WIRELESS_EXTENSION=y 336*a399b765Szf162725CONFIG_IEEE8021X_EAPOL=y 337*a399b765Szf162725CONFIG_EAP_MD5=y 338*a399b765Szf162725CONFIG_MSCHAPV2=y 339*a399b765Szf162725CONFIG_EAP_TLS=y 340*a399b765Szf162725CONFIG_EAP_PEAP=y 341*a399b765Szf162725CONFIG_EAP_TTLS=y 342*a399b765Szf162725CONFIG_EAP_GTC=y 343*a399b765Szf162725CONFIG_EAP_OTP=y 344*a399b765Szf162725CONFIG_EAP_SIM=y 345*a399b765Szf162725CONFIG_EAP_LEAP=y 346*a399b765Szf162725CONFIG_PCSC=y 347*a399b765Szf162725 348*a399b765Szf162725EAP-PEAP and EAP-TTLS will automatically include configured EAP 349*a399b765Szf162725methods (MD5, OTP, GTC, MSCHAPV2) for inner authentication selection. 350*a399b765Szf162725 351*a399b765Szf162725 352*a399b765Szf162725After you have created a configuration file, you can build 353*a399b765Szf162725wpa_supplicant and wpa_cli with 'make' command. You may then install 354*a399b765Szf162725the binaries to a suitable system directory, e.g., /usr/local/bin. 355*a399b765Szf162725 356*a399b765Szf162725Example commands: 357*a399b765Szf162725 358*a399b765Szf162725# build wpa_supplicant and wpa_cli 359*a399b765Szf162725make 360*a399b765Szf162725# install binaries (this may need root privileges) 361*a399b765Szf162725cp wpa_cli wpa_supplicant /usr/local/bin 362*a399b765Szf162725 363*a399b765Szf162725 364*a399b765Szf162725You will need to make a configuration file, e.g., 365*a399b765Szf162725/etc/wpa_supplicant.conf, with network configuration for the networks 366*a399b765Szf162725you are going to use. Configuration file section below includes 367*a399b765Szf162725explanation fo the configuration file format and includes various 368*a399b765Szf162725examples. Once the configuration is ready, you can test whether the 369*a399b765Szf162725configuration work by first running wpa_supplicant with following 370*a399b765Szf162725command to start it on foreground with debugging enabled: 371*a399b765Szf162725 372*a399b765Szf162725wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d 373*a399b765Szf162725 374*a399b765Szf162725Assuming everything goes fine, you can start using following command 375*a399b765Szf162725to start wpa_supplicant on background without debugging: 376*a399b765Szf162725 377*a399b765Szf162725wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B 378*a399b765Szf162725 379*a399b765Szf162725Please note that if you included more than one driver interface in the 380*a399b765Szf162725build time configuration (.config), you may need to specify which 381*a399b765Szf162725interface to use by including -D<driver name> option on the command 382*a399b765Szf162725line. See following section for more details on command line options 383*a399b765Szf162725for wpa_supplicant. 384*a399b765Szf162725 385*a399b765Szf162725 386*a399b765Szf162725 387*a399b765Szf162725Command line options 388*a399b765Szf162725-------------------- 389*a399b765Szf162725 390*a399b765Szf162725usage: 391*a399b765Szf162725 wpa_supplicant [-BddehLqqvw] -i<ifname> -c<config file> [-D<driver>] 392*a399b765Szf162725 393*a399b765Szf162725options: 394*a399b765Szf162725 -B = run daemon in the background 395*a399b765Szf162725 -d = increase debugging verbosity (-dd even more) 396*a399b765Szf162725 -e = use external IEEE 802.1X Supplicant (e.g., xsupplicant) 397*a399b765Szf162725 (this disables the internal Supplicant) 398*a399b765Szf162725 -h = show this help text 399*a399b765Szf162725 -L = show license (GPL and BSD) 400*a399b765Szf162725 -q = decrease debugging verbosity (-qq even less) 401*a399b765Szf162725 -v = show version 402*a399b765Szf162725 -w = wait for interface to be added, if needed 403*a399b765Szf162725 404*a399b765Szf162725drivers: 405*a399b765Szf162725 hostap = Host AP driver (Intersil Prism2/2.5/3) [default] 406*a399b765Szf162725 (this can also be used with Linuxant DriverLoader) 407*a399b765Szf162725 prism54 = Prism54.org driver (Intersil Prism GT/Duette/Indigo) 408*a399b765Szf162725 not yet fully implemented 409*a399b765Szf162725 hermes = Agere Systems Inc. driver (Hermes-I/Hermes-II) 410*a399b765Szf162725 madwifi = MADWIFI 802.11 support (Atheros, etc.) 411*a399b765Szf162725 atmel = ATMEL AT76C5XXx (USB, PCMCIA) 412*a399b765Szf162725 wext = Linux wireless extensions (generic) 413*a399b765Szf162725 ndiswrapper = Linux ndiswrapper 414*a399b765Szf162725 415*a399b765Szf162725In most common cases, wpa_supplicant is started with 416*a399b765Szf162725 417*a399b765Szf162725wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -iwlan0 418*a399b765Szf162725 419*a399b765Szf162725This makes the process fork into background and wait for the wlan0 420*a399b765Szf162725interface if it is not available at startup time. 421*a399b765Szf162725 422*a399b765Szf162725 423*a399b765Szf162725 424*a399b765Szf162725Configuration file 425*a399b765Szf162725------------------ 426*a399b765Szf162725 427*a399b765Szf162725wpa_supplicant is configured using a text file that lists all accepted 428*a399b765Szf162725networks and security policies, including pre-shared keys. See 429*a399b765Szf162725example configuration file, wpa_supplicant.conf, for detailed 430*a399b765Szf162725information about the configuration format and supported fields. 431*a399b765Szf162725 432*a399b765Szf162725Changes to configuration file can be reloaded be sending SIGHUP signal 433*a399b765Szf162725to wpa_supplicant ('killall -HUP wpa_supplicant'). Similarily, 434*a399b765Szf162725reloading can be triggered with 'wpa_cli reconfigure' command. 435*a399b765Szf162725 436*a399b765Szf162725Configuration file can include one or more network blocks, e.g., one 437*a399b765Szf162725for each used SSID. wpa_supplicant will automatically select the best 438*a399b765Szf162725betwork based on the order of network blocks in the configuration 439*a399b765Szf162725file, network security level (WPA/WPA2 is prefered), and signal 440*a399b765Szf162725strength. 441*a399b765Szf162725 442*a399b765Szf162725Example configuration files for some common configurations: 443*a399b765Szf162725 444*a399b765Szf1627251) WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work 445*a399b765Szf162725 network 446*a399b765Szf162725 447*a399b765Szf162725# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group 448*a399b765Szf162725ctrl_interface=/var/run/wpa_supplicant 449*a399b765Szf162725ctrl_interface_group=wheel 450*a399b765Szf162725# 451*a399b765Szf162725# home network; allow all valid ciphers 452*a399b765Szf162725network={ 453*a399b765Szf162725 ssid="home" 454*a399b765Szf162725 scan_ssid=1 455*a399b765Szf162725 key_mgmt=WPA-PSK 456*a399b765Szf162725 psk="very secret passphrase" 457*a399b765Szf162725} 458*a399b765Szf162725# 459*a399b765Szf162725# work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers 460*a399b765Szf162725network={ 461*a399b765Szf162725 ssid="work" 462*a399b765Szf162725 scan_ssid=1 463*a399b765Szf162725 key_mgmt=WPA-EAP 464*a399b765Szf162725 pairwise=CCMP TKIP 465*a399b765Szf162725 group=CCMP TKIP 466*a399b765Szf162725 eap=TLS 467*a399b765Szf162725 identity="user@example.com" 468*a399b765Szf162725 ca_cert="/etc/cert/ca.pem" 469*a399b765Szf162725 client_cert="/etc/cert/user.pem" 470*a399b765Szf162725 private_key="/etc/cert/user.prv" 471*a399b765Szf162725 private_key_passwd="password" 472*a399b765Szf162725} 473*a399b765Szf162725 474*a399b765Szf162725 475*a399b765Szf1627252) WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that use old peaplabel 476*a399b765Szf162725 (e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-Series) 477*a399b765Szf162725 478*a399b765Szf162725ctrl_interface=/var/run/wpa_supplicant 479*a399b765Szf162725ctrl_interface_group=wheel 480*a399b765Szf162725network={ 481*a399b765Szf162725 ssid="example" 482*a399b765Szf162725 scan_ssid=1 483*a399b765Szf162725 key_mgmt=WPA-EAP 484*a399b765Szf162725 eap=PEAP 485*a399b765Szf162725 identity="user@example.com" 486*a399b765Szf162725 password="foobar" 487*a399b765Szf162725 ca_cert="/etc/cert/ca.pem" 488*a399b765Szf162725 phase1="peaplabel=0" 489*a399b765Szf162725 phase2="auth=MSCHAPV2" 490*a399b765Szf162725} 491*a399b765Szf162725 492*a399b765Szf162725 493*a399b765Szf1627253) EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the 494*a399b765Szf162725 unencrypted use. Real identity is sent only within an encrypted TLS tunnel. 495*a399b765Szf162725 496*a399b765Szf162725ctrl_interface=/var/run/wpa_supplicant 497*a399b765Szf162725ctrl_interface_group=wheel 498*a399b765Szf162725network={ 499*a399b765Szf162725 ssid="example" 500*a399b765Szf162725 scan_ssid=1 501*a399b765Szf162725 key_mgmt=WPA-EAP 502*a399b765Szf162725 eap=TTLS 503*a399b765Szf162725 identity="user@example.com" 504*a399b765Szf162725 anonymous_identity="anonymous@example.com" 505*a399b765Szf162725 password="foobar" 506*a399b765Szf162725 ca_cert="/etc/cert/ca.pem" 507*a399b765Szf162725 phase2="auth=MD5" 508*a399b765Szf162725} 509*a399b765Szf162725 510*a399b765Szf162725 511*a399b765Szf1627254) IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and 512*a399b765Szf162725 broadcast); use EAP-TLS for authentication 513*a399b765Szf162725 514*a399b765Szf162725ctrl_interface=/var/run/wpa_supplicant 515*a399b765Szf162725ctrl_interface_group=wheel 516*a399b765Szf162725network={ 517*a399b765Szf162725 ssid="1x-test" 518*a399b765Szf162725 scan_ssid=1 519*a399b765Szf162725 key_mgmt=IEEE8021X 520*a399b765Szf162725 eap=TLS 521*a399b765Szf162725 identity="user@example.com" 522*a399b765Szf162725 ca_cert="/etc/cert/ca.pem" 523*a399b765Szf162725 client_cert="/etc/cert/user.pem" 524*a399b765Szf162725 private_key="/etc/cert/user.prv" 525*a399b765Szf162725 private_key_passwd="password" 526*a399b765Szf162725 eapol_flags=3 527*a399b765Szf162725} 528*a399b765Szf162725 529*a399b765Szf162725 530*a399b765Szf1627255) Catch all example that allows more or less all configuration modes. The 531*a399b765Szf162725 configuration options are used based on what security policy is used in the 532*a399b765Szf162725 selected SSID. This is mostly for testing and is not recommended for normal 533*a399b765Szf162725 use. 534*a399b765Szf162725 535*a399b765Szf162725ctrl_interface=/var/run/wpa_supplicant 536*a399b765Szf162725ctrl_interface_group=wheel 537*a399b765Szf162725network={ 538*a399b765Szf162725 ssid="example" 539*a399b765Szf162725 scan_ssid=1 540*a399b765Szf162725 key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE 541*a399b765Szf162725 pairwise=CCMP TKIP 542*a399b765Szf162725 group=CCMP TKIP WEP104 WEP40 543*a399b765Szf162725 psk="very secret passphrase" 544*a399b765Szf162725 eap=TTLS PEAP TLS 545*a399b765Szf162725 identity="user@example.com" 546*a399b765Szf162725 password="foobar" 547*a399b765Szf162725 ca_cert="/etc/cert/ca.pem" 548*a399b765Szf162725 client_cert="/etc/cert/user.pem" 549*a399b765Szf162725 private_key="/etc/cert/user.prv" 550*a399b765Szf162725 private_key_passwd="password" 551*a399b765Szf162725 phase1="peaplabel=0" 552*a399b765Szf162725 ca_cert2="/etc/cert/ca2.pem" 553*a399b765Szf162725 client_cert2="/etc/cer/user.pem" 554*a399b765Szf162725 private_key2="/etc/cer/user.prv" 555*a399b765Szf162725 private_key2_passwd="password" 556*a399b765Szf162725} 557*a399b765Szf162725 558*a399b765Szf162725 559*a399b765Szf162725 560*a399b765Szf162725Certificates 561*a399b765Szf162725------------ 562*a399b765Szf162725 563*a399b765Szf162725Some EAP authentication methods require use of certificates. EAP-TLS 564*a399b765Szf162725uses both server side and client certificates whereas EAP-PEAP and 565*a399b765Szf162725EAP-TTLS only require the server side certificate. When client 566*a399b765Szf162725certificate is used, a matching private key file has to also be 567*a399b765Szf162725included in configuration. If the private key uses a passphrase, this 568*a399b765Szf162725has to be configured in wpa_supplicant.conf ("private_key_passwd"). 569*a399b765Szf162725 570*a399b765Szf162725wpa_supplicant supports X.509 certificates in PEM and DER 571*a399b765Szf162725formats. User certificate and private key can be included in the same 572*a399b765Szf162725file. 573*a399b765Szf162725 574*a399b765Szf162725If the user certificate and private key is received in PKCS#12/PFX 575*a399b765Szf162725format, they need to be converted to suitable PEM/DER format for 576*a399b765Szf162725wpa_supplicant. This can be done, e.g., with following commands: 577*a399b765Szf162725 578*a399b765Szf162725# convert client certificate and private key to PEM format 579*a399b765Szf162725openssl pkcs12 -in example.pfx -out user.pem -clcerts 580*a399b765Szf162725# convert CA certificate (if included in PFX file) to PEM format 581*a399b765Szf162725openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys 582*a399b765Szf162725 583*a399b765Szf162725 584*a399b765Szf162725 585*a399b765Szf162725wpa_cli 586*a399b765Szf162725------- 587*a399b765Szf162725 588*a399b765Szf162725wpa_cli is a text-based frontend program for interacting with 589*a399b765Szf162725wpa_supplicant. It is used to query current status, change 590*a399b765Szf162725configuration, trigger events, and request interactive user input. 591*a399b765Szf162725 592*a399b765Szf162725wpa_cli can show the current authentication status, selected security 593*a399b765Szf162725mode, dot11 and dot1x MIBs, etc. In addition, it can configuring some 594*a399b765Szf162725variables like EAPOL state machine parameters and trigger events like 595*a399b765Szf162725reassociation and IEEE 802.1X logoff/logon. wpa_cli provides a user 596*a399b765Szf162725interface to request authentication information, like username and 597*a399b765Szf162725password, if these are not included in the configuration. This can be 598*a399b765Szf162725used to implement, e.g., one-time-passwords or generic token card 599*a399b765Szf162725authentication where the authentication is based on a 600*a399b765Szf162725challenge-response that uses an external device for generating the 601*a399b765Szf162725response. 602*a399b765Szf162725 603*a399b765Szf162725The control interface of wpa_supplicant can be configured to allow 604*a399b765Szf162725non-root user access (ctrl_interface_group in the configuration 605*a399b765Szf162725file). This makes it possible to run wpa_cli with a normal user 606*a399b765Szf162725account. 607*a399b765Szf162725 608*a399b765Szf162725wpa_cli supports two modes: interactive and command line. Both modes 609*a399b765Szf162725share the same command set and the main difference is in interactive 610*a399b765Szf162725mode providing access to unsolicited messages (event messages, 611*a399b765Szf162725username/password requests). 612*a399b765Szf162725 613*a399b765Szf162725Interactive mode is started when wpa_cli is executed without including 614*a399b765Szf162725the command as a command line parameter. Commands are then entered on 615*a399b765Szf162725the wpa_cli prompt. In command line mode, the same commands are 616*a399b765Szf162725entered as command line arguments for wpa_cli. 617*a399b765Szf162725 618*a399b765Szf162725 619*a399b765Szf162725Interactive authentication parameters request 620*a399b765Szf162725 621*a399b765Szf162725When wpa_supplicant need authentication parameters, like username and 622*a399b765Szf162725password, which are not present in the configuration file, it sends a 623*a399b765Szf162725request message to all attached frontend programs, e.g., wpa_cli in 624*a399b765Szf162725interactive mode. wpa_cli shows these requests with 625*a399b765Szf162725"CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, or 626*a399b765Szf162725OTP (one-time-password). <id> is a unique identifier for the current 627*a399b765Szf162725network. <text> is description of the request. In case of OTP request, 628*a399b765Szf162725it includes the challenge from the authentication server. 629*a399b765Szf162725 630*a399b765Szf162725The reply to these requests can be given with 'identity', 'password', 631*a399b765Szf162725and 'otp' commands. <id> needs to be copied from the the matching 632*a399b765Szf162725request. 'password' and 'otp' commands can be used regardless of 633*a399b765Szf162725whether the request was for PASSWORD or OTP. The main difference 634*a399b765Szf162725between these two commands is that values given with 'password' are 635*a399b765Szf162725remembered as long as wpa_supplicant is running whereas values given 636*a399b765Szf162725with 'otp' are used only once and then forgotten, i.e., wpa_supplicant 637*a399b765Szf162725will ask frontend for a new value for every use. This can be used to 638*a399b765Szf162725implement one-time-password lists and generic token card -based 639*a399b765Szf162725authentication. 640*a399b765Szf162725 641*a399b765Szf162725Example request for password and a matching reply: 642*a399b765Szf162725 643*a399b765Szf162725CTRL-REQ-PASSWORD-1:Password needed for SSID foobar 644*a399b765Szf162725> password 1 mysecretpassword 645*a399b765Szf162725 646*a399b765Szf162725Example request for generic token card challenge-response: 647*a399b765Szf162725 648*a399b765Szf162725CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar 649*a399b765Szf162725> otp 2 9876 650*a399b765Szf162725 651*a399b765Szf162725 652*a399b765Szf162725wpa_cli commands 653*a399b765Szf162725 654*a399b765Szf162725 status = get current WPA/EAPOL/EAP status 655*a399b765Szf162725 mib = get MIB variables (dot1x, dot11) 656*a399b765Szf162725 help = show this usage help 657*a399b765Szf162725 interface [ifname] = show interfaces/select interface 658*a399b765Szf162725 level <debug level> = change debug level 659*a399b765Szf162725 license = show full wpa_cli license 660*a399b765Szf162725 logoff = IEEE 802.1X EAPOL state machine logoff 661*a399b765Szf162725 logon = IEEE 802.1X EAPOL state machine logon 662*a399b765Szf162725 set = set variables (shows list of variables when run without arguments) 663*a399b765Szf162725 pmksa = show PMKSA cache 664*a399b765Szf162725 reassociate = force reassociation 665*a399b765Szf162725 reconfigure = force wpa_supplicant to re-read its configuration file 666*a399b765Szf162725 preauthenticate <BSSID> = force preauthentication 667*a399b765Szf162725 identity <network id> <identity> = configure identity for an SSID 668*a399b765Szf162725 password <network id> <password> = configure password for an SSID 669*a399b765Szf162725 otp <network id> <password> = configure one-time-password for an SSID 670*a399b765Szf162725 quit = exit wpa_cli 671*a399b765Szf162725 672*a399b765Szf162725 673*a399b765Szf162725 674*a399b765Szf162725Integrating with pcmcia-cs/cardmgr scripts 675*a399b765Szf162725------------------------------------------ 676*a399b765Szf162725 677*a399b765Szf162725wpa_supplicant needs to be running when using a wireless network with 678*a399b765Szf162725WPA. It can be started either from system startup scripts or from 679*a399b765Szf162725pcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must be 680*a399b765Szf162725completed before data frames can be exchanged, so wpa_supplicant 681*a399b765Szf162725should be started before DHCP client. 682*a399b765Szf162725 683*a399b765Szf162725Command line option '-w' can be used if wpa_supplicant is started 684*a399b765Szf162725before the wireless LAN interface is present (e.g., before inserting 685*a399b765Szf162725the PC Card) or is not yet up. 686*a399b765Szf162725 687*a399b765Szf162725For example, following small changes to pcmcia-cs scripts can be used 688*a399b765Szf162725to enable WPA support: 689*a399b765Szf162725 690*a399b765Szf162725Add MODE="Managed" and WPA="y" to the network scheme in 691*a399b765Szf162725/etc/pcmcia/wireless.opts. 692*a399b765Szf162725 693*a399b765Szf162725Add the following block to the end of 'start' action handler in 694*a399b765Szf162725/etc/pcmcia/wireless: 695*a399b765Szf162725 696*a399b765Szf162725 if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then 697*a399b765Szf162725 /usr/local/bin/wpa_supplicant -Bw -c/etc/wpa_supplicant.conf \ 698*a399b765Szf162725 -i$DEVICE 699*a399b765Szf162725 fi 700*a399b765Szf162725 701*a399b765Szf162725Add the following block to the end of 'stop' action handler (may need 702*a399b765Szf162725to be separated from other actions) in /etc/pcmcia/wireless: 703*a399b765Szf162725 704*a399b765Szf162725 if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then 705*a399b765Szf162725 killall wpa_supplicant 706*a399b765Szf162725 fi 707*a399b765Szf162725 708*a399b765Szf162725This will make cardmgr start wpa_supplicant when the card is plugged 709*a399b765Szf162725in. wpa_supplicant will wait until the interface is set up--either 710*a399b765Szf162725when a static IP address is configured or when DHCP client is 711*a399b765Szf162725started--and will then negotiate keys with the AP. 712*a399b765Szf162725 713*a399b765Szf162725 714*a399b765Szf162725 715*a399b765Szf162725Optional integration with Xsupplicant 716*a399b765Szf162725------------------------------------- 717*a399b765Szf162725 718*a399b765Szf162725wpa_supplicant has an integrated IEEE 802.1X Supplicant that supports 719*a399b765Szf162725most commonly used EAP methods. In addition, wpa_supplicant has an 720*a399b765Szf162725experimental interface for integrating it with Xsupplicant 721*a399b765Szf162725(http://www.open1x.org/) for the WPA with EAP authentication. 722*a399b765Szf162725 723*a399b765Szf162725Xsupplicant needs to be modified to send master session key to 724*a399b765Szf162725wpa_supplicant after successful EAP authentication. The included patch 725*a399b765Szf162725(xsupplicant.patch) shows the changes needed. This was merged into 726*a399b765Szf162725xsupplicant CVS on February 6, 2004, so any snapshot after that should 727*a399b765Szf162725have the needed functionality already included. 728*a399b765Szf162725 729*a399b765Szf162725When using WPA-EAP, both wpa_supplicant and Xsupplicant must be 730*a399b765Szf162725configured with the network security policy. See Xsupplicant documents 731*a399b765Szf162725for information about its configuration. Please also note, that a new 732*a399b765Szf162725command line option -W (enable WPA; added by xsupplicant.patch) must 733*a399b765Szf162725be used when starting xsupplicant. 734*a399b765Szf162725 735*a399b765Szf162725Example configuration for xsupplicant: 736*a399b765Szf162725 737*a399b765Szf162725network_list = all 738*a399b765Szf162725default_netname = jkm 739*a399b765Szf162725 740*a399b765Szf162725jkm 741*a399b765Szf162725{ 742*a399b765Szf162725 type = wireless 743*a399b765Szf162725 allow_types = eap_peap 744*a399b765Szf162725 identity = <BEGIN_ID>jkm<END_ID> 745*a399b765Szf162725 eap-peap { 746*a399b765Szf162725 random_file = /dev/urandom 747*a399b765Szf162725 root_cert = /home/jkm/CA.pem 748*a399b765Szf162725 chunk_size = 1398 749*a399b765Szf162725 allow_types = eap_mschapv2 750*a399b765Szf162725 eap-mschapv2 { 751*a399b765Szf162725 username = <BEGIN_UNAME>jkm<END_UNAME> 752*a399b765Szf162725 password = <BEGIN_PASS>jkm<END_PASS> 753*a399b765Szf162725 } 754*a399b765Szf162725 } 755*a399b765Szf162725} 756*a399b765Szf162725 757*a399b765Szf162725 758*a399b765Szf162725Example configuration for wpa_supplicant: 759*a399b765Szf162725 760*a399b765Szf162725network={ 761*a399b765Szf162725 ssid="jkm" 762*a399b765Szf162725 key_mgmt=WPA-EAP 763*a399b765Szf162725} 764*a399b765Szf162725 765*a399b765Szf162725 766*a399b765Szf162725Both wpa_supplicant and xsupplicant need to be started. Please remember 767*a399b765Szf162725to add '-W' option for xsupplicant in order to provide keying material 768*a399b765Szf162725for wpa_supplicant and '-e' option for wpa_supplicant to disable internal 769*a399b765Szf162725IEEE 802.1X implementation. 770*a399b765Szf162725 771*a399b765Szf162725wpa_supplicant -iwlan0 -cwpa_supplicant.conf -e 772*a399b765Szf162725xsupplicant -iwlan0 -cxsupplicant.conf -W 773