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