xref: /onnv-gate/usr/src/cmd/cmd-inet/usr.lib/wpad/README (revision 4126:31652d91f33e)
1*4126Szf162725#pragma ident	"%Z%%M%	%I%	%E% SMI"
2*4126Szf162725
3*4126Szf162725WPA Supplicant
4*4126Szf162725==============
5*4126Szf162725
6*4126Szf162725Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi>
7*4126Szf162725All Rights Reserved.
8*4126Szf162725
9*4126Szf162725Sun elects to license this software under the BSD license.
10*4126Szf162725
11*4126Szf162725
12*4126Szf162725License
13*4126Szf162725-------
14*4126Szf162725
15*4126Szf162725BSD license:
16*4126Szf162725
17*4126Szf162725Redistribution and use in source and binary forms, with or without
18*4126Szf162725modification, are permitted provided that the following conditions are
19*4126Szf162725met:
20*4126Szf162725
21*4126Szf1627251. Redistributions of source code must retain the above copyright
22*4126Szf162725   notice, this list of conditions and the following disclaimer.
23*4126Szf162725
24*4126Szf1627252. Redistributions in binary form must reproduce the above copyright
25*4126Szf162725   notice, this list of conditions and the following disclaimer in the
26*4126Szf162725   documentation and/or other materials provided with the distribution.
27*4126Szf162725
28*4126Szf1627253. Neither the name(s) of the above-listed copyright holder(s) nor the
29*4126Szf162725   names of its contributors may be used to endorse or promote products
30*4126Szf162725   derived from this software without specific prior written permission.
31*4126Szf162725
32*4126Szf162725THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33*4126Szf162725"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34*4126Szf162725LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35*4126Szf162725A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36*4126Szf162725OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37*4126Szf162725SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38*4126Szf162725LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
39*4126Szf162725DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
40*4126Szf162725THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41*4126Szf162725(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42*4126Szf162725OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43*4126Szf162725
44*4126Szf162725
45*4126Szf162725
46*4126Szf162725Features
47*4126Szf162725--------
48*4126Szf162725
49*4126Szf162725Supported WPA/IEEE 802.11i features:
50*4126Szf162725- WPA-PSK ("WPA-Personal")
51*4126Szf162725- WPA with EAP (e.g., with RADIUS authentication server) ("WPA-Enterprise")
52*4126Szf162725  Following authentication methods are supported with an integrate IEEE 802.1X
53*4126Szf162725  Supplicant:
54*4126Szf162725  * EAP-TLS
55*4126Szf162725  * EAP-PEAP/MSCHAPv2 (both PEAPv0 and PEAPv1)
56*4126Szf162725  * EAP-PEAP/TLS (both PEAPv0 and PEAPv1)
57*4126Szf162725  * EAP-PEAP/GTC (both PEAPv0 and PEAPv1)
58*4126Szf162725  * EAP-PEAP/OTP (both PEAPv0 and PEAPv1)
59*4126Szf162725  * EAP-PEAP/MD5-Challenge (both PEAPv0 and PEAPv1)
60*4126Szf162725  * EAP-TTLS/EAP-MD5-Challenge
61*4126Szf162725  * EAP-TTLS/EAP-GTC
62*4126Szf162725  * EAP-TTLS/EAP-OTP
63*4126Szf162725  * EAP-TTLS/EAP-MSCHAPv2
64*4126Szf162725  * EAP-TTLS/EAP-TLS
65*4126Szf162725  * EAP-TTLS/MSCHAPv2
66*4126Szf162725  * EAP-TTLS/MSCHAP
67*4126Szf162725  * EAP-TTLS/PAP
68*4126Szf162725  * EAP-TTLS/CHAP
69*4126Szf162725  * EAP-SIM
70*4126Szf162725  * LEAP (note: only with WEP keys, i.e., not for WPA; in addition, LEAP
71*4126Szf162725	requires special support from the driver for IEEE 802.11
72*4126Szf162725	authentication)
73*4126Szf162725  (following methods are supported, but since they do not generate keying
74*4126Szf162725   material, they cannot be used with WPA or IEEE 802.1X WEP keying)
75*4126Szf162725  * EAP-MD5-Challenge
76*4126Szf162725  * EAP-MSCHAPv2
77*4126Szf162725  * EAP-GTC
78*4126Szf162725  * EAP-OTP
79*4126Szf162725  Alternatively, an external program, e.g., Xsupplicant, can be used for EAP
80*4126Szf162725  authentication.
81*4126Szf162725- key management for CCMP, TKIP, WEP104, WEP40
82*4126Szf162725- RSN/WPA2 (IEEE 802.11i)
83*4126Szf162725  * pre-authentication
84*4126Szf162725  * PMKSA caching
85*4126Szf162725
86*4126Szf162725
87*4126Szf162725
88*4126Szf162725Requirements
89*4126Szf162725------------
90*4126Szf162725
91*4126Szf162725Current hardware/software requirements:
92*4126Szf162725- Linux kernel 2.4.x or 2.6.x
93*4126Szf162725- Linux Wireless Extensions v15 or newer
94*4126Szf162725- drivers:
95*4126Szf162725	Host AP driver for Prism2/2.5/3 (development snapshot/v0.2.x)
96*4126Szf162725	in Managed mode ('iwconfig wlan0 mode managed'). Please note that
97*4126Szf162725	station firmware version needs to be 1.7.0 or newer to work in
98*4126Szf162725	WPA mode.
99*4126Szf162725
100*4126Szf162725	Linuxant DriverLoader (http://www.linuxant.com/driverloader/)
101*4126Szf162725	with Windows NDIS driver for your wlan card supporting WPA.
102*4126Szf162725
103*4126Szf162725	Agere Systems Inc. Linux Driver
104*4126Szf162725	(http://www.agere.com/support/drivers/)
105*4126Szf162725	Please note that the driver interface file (driver_hermes.c) and
106*4126Szf162725	hardware specific include files are not included in the
107*4126Szf162725	wpa_supplicant distribution. You will need to copy these from the
108*4126Szf162725	source package of the Agere driver.
109*4126Szf162725
110*4126Szf162725	madwifi driver for cards based on Atheros chip set (ar521x)
111*4126Szf162725	(http://sourceforge.net/projects/madwifi/)
112*4126Szf162725	Please note that you will need to modify the wpa_supplicant Makefile
113*4126Szf162725	to use correct path for madwifi driver root directory
114*4126Szf162725	(CFLAGS += -I../madwifi/wpa line in Makefile).
115*4126Szf162725
116*4126Szf162725	ATMEL AT76C5XXx driver for USB and PCMCIA cards
117*4126Szf162725	(http://atmelwlandriver.sourceforge.net/).
118*4126Szf162725
119*4126Szf162725	Linux ndiswrapper (http://ndiswrapper.sourceforge.net/) with
120*4126Szf162725	Windows NDIS driver.
121*4126Szf162725
122*4126Szf162725	In theory, any driver that supports Linux wireless extensions can be
123*4126Szf162725	used with IEEE 802.1X (i.e., not WPA) when using ap_scan=0 option in
124*4126Szf162725	configuration file.
125*4126Szf162725
126*4126Szf162725wpa_supplicant was designed to be portable for different drivers and
127*4126Szf162725operating systems. Hopefully, support for more wlan cards will be
128*4126Szf162725added in the future. See developer.txt for more information about the
129*4126Szf162725design of wpa_supplicant and porting to other drivers. One main goal
130*4126Szf162725is to add full WPA/WPA2 support to Linux wireless extensions to allow
131*4126Szf162725new drivers to be supported without having to implement new
132*4126Szf162725driver-specific interface code in wpa_supplicant.
133*4126Szf162725
134*4126Szf162725Optional libraries for layer2 packet processing:
135*4126Szf162725- libpcap (tested with 0.7.2, most relatively recent versions assumed to work,
136*4126Szf162725	this is likely to be available with most distributions,
137*4126Szf162725	http://tcpdump.org/)
138*4126Szf162725- libdnet (tested with v1.4, most versions assumed to work,
139*4126Szf162725	http://libdnet.sourceforge.net/)
140*4126Szf162725
141*4126Szf162725These libraries are _not_ used in the default build. Instead, internal
142*4126Szf162725Linux specific implementation is used. libpcap/libdnet are more
143*4126Szf162725portable and they can be used by modifying Makefile (define
144*4126Szf162725USE_DNET_PCAP and link with these libraries).
145*4126Szf162725
146*4126Szf162725
147*4126Szf162725Optional libraries for EAP-TLS, EAP-PEAP, and EAP-TTLS:
148*4126Szf162725- openssl (tested with 0.9.7c and 0.9.7d, assumed to work with most
149*4126Szf162725  relatively recent versions; this is likely to be available with most
150*4126Szf162725  distributions, http://www.openssl.org/)
151*4126Szf162725
152*4126Szf162725This library is only needed when EAP-TLS, EAP-PEAP, or EAP-TTLS
153*4126Szf162725support is enabled. WPA-PSK mode does not require this or EAPOL/EAP
154*4126Szf162725implementation. A configuration file, .config, for compilation is
155*4126Szf162725needed to enable IEEE 802.1X/EAPOL and EAP methods. Note that EAP-MD5,
156*4126Szf162725EAP-GTC, EAP-OTP, and EAP-MSCHAPV2 cannot be used alone with WPA, so
157*4126Szf162725they should only be enabled if testing the EAPOL/EAP state
158*4126Szf162725machines. However, there can be used as inner authentication
159*4126Szf162725algorithms with EAP-PEAP and EAP-TTLS.
160*4126Szf162725
161*4126Szf162725See Building and installing section below for more detailed
162*4126Szf162725information about the wpa_supplicant build time configuration.
163*4126Szf162725
164*4126Szf162725
165*4126Szf162725
166*4126Szf162725WPA
167*4126Szf162725---
168*4126Szf162725
169*4126Szf162725The original security mechanism of IEEE 802.11 standard was not
170*4126Szf162725designed to be strong and has proved to be insufficient for most
171*4126Szf162725networks that require some kind of security. Task group I (Security)
172*4126Szf162725of IEEE 802.11 working group (http://www.ieee802.org/11/) has worked
173*4126Szf162725to address the flaws of the base standard and has in practice
174*4126Szf162725completed its work in May 2004. The IEEE 802.11i amendment to the IEEE
175*4126Szf162725802.11 standard was approved in June 2004 and this amendment is likely
176*4126Szf162725to be published in July 2004.
177*4126Szf162725
178*4126Szf162725Wi-Fi Alliance (http://www.wi-fi.org/) used a draft version of the
179*4126Szf162725IEEE 802.11i work (draft 3.0) to define a subset of the security
180*4126Szf162725enhancements that can be implemented with existing wlan hardware. This
181*4126Szf162725is called Wi-Fi Protected Access<TM> (WPA). This has now become a
182*4126Szf162725mandatory component of interoperability testing and certification done
183*4126Szf162725by Wi-Fi Alliance. Wi-Fi provides information about WPA at its web
184*4126Szf162725site (http://www.wi-fi.org/OpenSection/protected_access.asp).
185*4126Szf162725
186*4126Szf162725IEEE 802.11 standard defined wired equivalent privacy (WEP) algorithm
187*4126Szf162725for protecting wireless networks. WEP uses RC4 with 40-bit keys,
188*4126Szf16272524-bit initialization vector (IV), and CRC32 to protect against packet
189*4126Szf162725forgery. All these choice have proved to be insufficient: key space is
190*4126Szf162725too small against current attacks, RC4 key scheduling is insufficient
191*4126Szf162725(beginning of the pseudorandom stream should be skipped), IV space is
192*4126Szf162725too small and IV reuse makes attacks easier, there is no replay
193*4126Szf162725protection, and non-keyed authentication does not protect against bit
194*4126Szf162725flipping packet data.
195*4126Szf162725
196*4126Szf162725WPA is an intermediate solution for the security issues. It uses
197*4126Szf162725temporal key integrity protocol (TKIP) to replace WEP. TKIP is a
198*4126Szf162725compromise on strong security and possibility to use existing
199*4126Szf162725hardware. It still uses RC4 for the encryption like WEP, but with
200*4126Szf162725per-packet RC4 keys. In addition, it implements replay protection,
201*4126Szf162725keyed packet authentication mechanism (Michael MIC).
202*4126Szf162725
203*4126Szf162725Keys can be managed using two different mechanisms. WPA can either use
204*4126Szf162725an external authentication server (e.g., RADIUS) and EAP just like
205*4126Szf162725IEEE 802.1X is using or pre-shared keys without need for additional
206*4126Szf162725servers. Wi-Fi calls these "WPA-Enterprise" and "WPA-Personal",
207*4126Szf162725respectively. Both mechanisms will generate a master session key for
208*4126Szf162725the Authenticator (AP) and Supplicant (client station).
209*4126Szf162725
210*4126Szf162725WPA implements a new key handshake (4-Way Handshake and Group Key
211*4126Szf162725Handshake) for generating and exchanging data encryption keys between
212*4126Szf162725the Authenticator and Supplicant. This handshake is also used to
213*4126Szf162725verify that both Authenticator and Supplicant know the master session
214*4126Szf162725key. These handshakes are identical regardless of the selected key
215*4126Szf162725management mechanism (only the method for generating master session
216*4126Szf162725key changes).
217*4126Szf162725
218*4126Szf162725
219*4126Szf162725
220*4126Szf162725IEEE 802.11i / WPA2
221*4126Szf162725-------------------
222*4126Szf162725
223*4126Szf162725The design for parts of IEEE 802.11i that were not included in WPA has
224*4126Szf162725finished (May 2004) and this amendment to IEEE 802.11 was approved in
225*4126Szf162725June 2004. Wi-Fi Alliance is using the final IEEE 802.11i as a new
226*4126Szf162725version of WPA called WPA2. This includes, e.g., support for more
227*4126Szf162725robust encryption algorithm (CCMP: AES in Counter mode with CBC-MAC)
228*4126Szf162725to replace TKIP and optimizations for handoff (reduced number of
229*4126Szf162725messages in initial key handshake, pre-authentication, key caching).
230*4126Szf162725
231*4126Szf162725Some wireless LAN vendors are already providing support for CCMP in
232*4126Szf162725their WPA products. There is no "official" interoperability
233*4126Szf162725certification for CCMP and/or mixed modes using both TKIP and CCMP, so
234*4126Szf162725some interoperability issues can be expected even though many
235*4126Szf162725combinations seem to be working with equipment from different vendors.
236*4126Szf162725Certification for WPA2 is likely to start during the second half of
237*4126Szf1627252004.
238*4126Szf162725
239*4126Szf162725
240*4126Szf162725
241*4126Szf162725wpa_supplicant
242*4126Szf162725--------------
243*4126Szf162725
244*4126Szf162725wpa_supplicant is an implementation of the WPA Supplicant component,
245*4126Szf162725i.e., the part that runs in the client stations. It implements WPA key
246*4126Szf162725negotiation with a WPA Authenticator and EAP authentication with
247*4126Szf162725Authentication Server. In addition, it controls the roaming and IEEE
248*4126Szf162725802.11 authentication/association of the wlan driver.
249*4126Szf162725
250*4126Szf162725wpa_supplicant is designed to be a "daemon" program that runs in the
251*4126Szf162725background and acts as the backend component controlling the wireless
252*4126Szf162725connection. wpa_supplicant supports separate frontend programs and an
253*4126Szf162725example text-based frontend, wpa_cli, is included with wpa_supplicant.
254*4126Szf162725
255*4126Szf162725Following steps are used when associating with an AP using WPA:
256*4126Szf162725
257*4126Szf162725- wpa_supplicant requests the kernel driver to scan neighboring BSSes
258*4126Szf162725- wpa_supplicant selects a BSS based on its configuration
259*4126Szf162725- wpa_supplicant requests the kernel driver to associate with the chosen
260*4126Szf162725  BSS
261*4126Szf162725- If WPA-EAP: integrated IEEE 802.1X Supplicant or external Xsupplicant
262*4126Szf162725  completes EAP authentication with the authentication server (proxied
263*4126Szf162725  by the Authenticator in the AP)
264*4126Szf162725- If WPA-EAP: master key is received from the IEEE 802.1X Supplicant
265*4126Szf162725- If WPA-PSK: wpa_supplicant uses PSK as the master session key
266*4126Szf162725- wpa_supplicant completes WPA 4-Way Handshake and Group Key Handshake
267*4126Szf162725  with the Authenticator (AP)
268*4126Szf162725- wpa_supplicant configures encryption keys for unicast and broadcast
269*4126Szf162725- normal data packets can be transmitted and received
270*4126Szf162725
271*4126Szf162725
272*4126Szf162725
273*4126Szf162725Building and installing
274*4126Szf162725-----------------------
275*4126Szf162725
276*4126Szf162725In order to be able to build wpa_supplicant, you will first need to
277*4126Szf162725select which parts of it will be included. This is done by creating a
278*4126Szf162725build time configuration file, .config, in the wpa_supplicant root
279*4126Szf162725directory. Configuration options are text lines using following
280*4126Szf162725format: CONFIG_<option>=y. Lines starting with # are considered
281*4126Szf162725comments and are ignored.
282*4126Szf162725
283*4126Szf162725The build time configuration can be used to select only the needed
284*4126Szf162725features and limit the binary size and requirements for external
285*4126Szf162725libraries. The main configuration parts are the selection of which
286*4126Szf162725driver interfaces (e.g., hostap, madwifi, ..) and which authentication
287*4126Szf162725methods (e.g., EAP-TLS, EAP-PEAP, ..) are included.
288*4126Szf162725
289*4126Szf162725Following build time configuration options are used to control IEEE
290*4126Szf162725802.1X/EAPOL and EAP state machines and all EAP methods. Including
291*4126Szf162725TLS, PEAP, or TTLS will require linking wpa_supplicant with openssl
292*4126Szf162725library for TLS implementation.
293*4126Szf162725
294*4126Szf162725CONFIG_IEEE8021X_EAPOL=y
295*4126Szf162725CONFIG_EAP_MD5=y
296*4126Szf162725CONFIG_MSCHAPV2=y
297*4126Szf162725CONFIG_EAP_TLS=y
298*4126Szf162725CONFIG_EAP_PEAP=y
299*4126Szf162725CONFIG_EAP_TTLS=y
300*4126Szf162725CONFIG_EAP_GTC=y
301*4126Szf162725CONFIG_EAP_OTP=y
302*4126Szf162725CONFIG_EAP_SIM=y
303*4126Szf162725CONFIG_EAP_LEAP=y
304*4126Szf162725
305*4126Szf162725Following option can be used to include GSM SIM/USIM interface for GSM
306*4126Szf162725authentication algorithm (for EAP-SIM). This requires pcsc-lite
307*4126Szf162725(http://www.linuxnet.com/) for smart card access.
308*4126Szf162725
309*4126Szf162725CONFIG_PCSC=y
310*4126Szf162725
311*4126Szf162725Following options can be added to .config to select which driver
312*4126Szf162725interfaces are included. Prism54.org driver is not yet complete and
313*4126Szf162725Hermes driver interface needs to be downloaded from Agere (see above).
314*4126Szf162725Most Linux driver need to include CONFIG_WIRELESS_EXTENSION.
315*4126Szf162725
316*4126Szf162725CONFIG_WIRELESS_EXTENSION=y
317*4126Szf162725CONFIG_DRIVER_HOSTAP=y
318*4126Szf162725CONFIG_DRIVER_PRISM54=y
319*4126Szf162725CONFIG_DRIVER_HERMES=y
320*4126Szf162725CONFIG_DRIVER_MADWIFI=y
321*4126Szf162725CONFIG_DRIVER_ATMEL=y
322*4126Szf162725CONFIG_DRIVER_WEXT=y
323*4126Szf162725CONFIG_DRIVER_NDISWRAPPER=y
324*4126Szf162725
325*4126Szf162725Following example includes all features and driver interfaces that are
326*4126Szf162725included in the wpa_supplicant package:
327*4126Szf162725
328*4126Szf162725CONFIG_DRIVER_HOSTAP=y
329*4126Szf162725CONFIG_DRIVER_PRISM54=y
330*4126Szf162725CONFIG_DRIVER_HERMES=y
331*4126Szf162725CONFIG_DRIVER_MADWIFI=y
332*4126Szf162725CONFIG_DRIVER_ATMEL=y
333*4126Szf162725CONFIG_DRIVER_WEXT=y
334*4126Szf162725CONFIG_DRIVER_NDISWRAPPER=y
335*4126Szf162725CONFIG_WIRELESS_EXTENSION=y
336*4126Szf162725CONFIG_IEEE8021X_EAPOL=y
337*4126Szf162725CONFIG_EAP_MD5=y
338*4126Szf162725CONFIG_MSCHAPV2=y
339*4126Szf162725CONFIG_EAP_TLS=y
340*4126Szf162725CONFIG_EAP_PEAP=y
341*4126Szf162725CONFIG_EAP_TTLS=y
342*4126Szf162725CONFIG_EAP_GTC=y
343*4126Szf162725CONFIG_EAP_OTP=y
344*4126Szf162725CONFIG_EAP_SIM=y
345*4126Szf162725CONFIG_EAP_LEAP=y
346*4126Szf162725CONFIG_PCSC=y
347*4126Szf162725
348*4126Szf162725EAP-PEAP and EAP-TTLS will automatically include configured EAP
349*4126Szf162725methods (MD5, OTP, GTC, MSCHAPV2) for inner authentication selection.
350*4126Szf162725
351*4126Szf162725
352*4126Szf162725After you have created a configuration file, you can build
353*4126Szf162725wpa_supplicant and wpa_cli with 'make' command. You may then install
354*4126Szf162725the binaries to a suitable system directory, e.g., /usr/local/bin.
355*4126Szf162725
356*4126Szf162725Example commands:
357*4126Szf162725
358*4126Szf162725# build wpa_supplicant and wpa_cli
359*4126Szf162725make
360*4126Szf162725# install binaries (this may need root privileges)
361*4126Szf162725cp wpa_cli wpa_supplicant /usr/local/bin
362*4126Szf162725
363*4126Szf162725
364*4126Szf162725You will need to make a configuration file, e.g.,
365*4126Szf162725/etc/wpa_supplicant.conf, with network configuration for the networks
366*4126Szf162725you are going to use. Configuration file section below includes
367*4126Szf162725explanation fo the configuration file format and includes various
368*4126Szf162725examples. Once the configuration is ready, you can test whether the
369*4126Szf162725configuration work by first running wpa_supplicant with following
370*4126Szf162725command to start it on foreground with debugging enabled:
371*4126Szf162725
372*4126Szf162725wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d
373*4126Szf162725
374*4126Szf162725Assuming everything goes fine, you can start using following command
375*4126Szf162725to start wpa_supplicant on background without debugging:
376*4126Szf162725
377*4126Szf162725wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
378*4126Szf162725
379*4126Szf162725Please note that if you included more than one driver interface in the
380*4126Szf162725build time configuration (.config), you may need to specify which
381*4126Szf162725interface to use by including -D<driver name> option on the command
382*4126Szf162725line. See following section for more details on command line options
383*4126Szf162725for wpa_supplicant.
384*4126Szf162725
385*4126Szf162725
386*4126Szf162725
387*4126Szf162725Command line options
388*4126Szf162725--------------------
389*4126Szf162725
390*4126Szf162725usage:
391*4126Szf162725  wpa_supplicant [-BddehLqqvw] -i<ifname> -c<config file> [-D<driver>]
392*4126Szf162725
393*4126Szf162725options:
394*4126Szf162725  -B = run daemon in the background
395*4126Szf162725  -d = increase debugging verbosity (-dd even more)
396*4126Szf162725  -e = use external IEEE 802.1X Supplicant (e.g., xsupplicant)
397*4126Szf162725       (this disables the internal Supplicant)
398*4126Szf162725  -h = show this help text
399*4126Szf162725  -L = show license (GPL and BSD)
400*4126Szf162725  -q = decrease debugging verbosity (-qq even less)
401*4126Szf162725  -v = show version
402*4126Szf162725  -w = wait for interface to be added, if needed
403*4126Szf162725
404*4126Szf162725drivers:
405*4126Szf162725  hostap = Host AP driver (Intersil Prism2/2.5/3) [default]
406*4126Szf162725	(this can also be used with Linuxant DriverLoader)
407*4126Szf162725  prism54 = Prism54.org driver (Intersil Prism GT/Duette/Indigo)
408*4126Szf162725	not yet fully implemented
409*4126Szf162725  hermes = Agere Systems Inc. driver (Hermes-I/Hermes-II)
410*4126Szf162725  madwifi = MADWIFI 802.11 support (Atheros, etc.)
411*4126Szf162725  atmel = ATMEL AT76C5XXx (USB, PCMCIA)
412*4126Szf162725  wext = Linux wireless extensions (generic)
413*4126Szf162725  ndiswrapper = Linux ndiswrapper
414*4126Szf162725
415*4126Szf162725In most common cases, wpa_supplicant is started with
416*4126Szf162725
417*4126Szf162725wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -iwlan0
418*4126Szf162725
419*4126Szf162725This makes the process fork into background and wait for the wlan0
420*4126Szf162725interface if it is not available at startup time.
421*4126Szf162725
422*4126Szf162725
423*4126Szf162725
424*4126Szf162725Configuration file
425*4126Szf162725------------------
426*4126Szf162725
427*4126Szf162725wpa_supplicant is configured using a text file that lists all accepted
428*4126Szf162725networks and security policies, including pre-shared keys. See
429*4126Szf162725example configuration file, wpa_supplicant.conf, for detailed
430*4126Szf162725information about the configuration format and supported fields.
431*4126Szf162725
432*4126Szf162725Changes to configuration file can be reloaded be sending SIGHUP signal
433*4126Szf162725to wpa_supplicant ('killall -HUP wpa_supplicant'). Similarily,
434*4126Szf162725reloading can be triggered with 'wpa_cli reconfigure' command.
435*4126Szf162725
436*4126Szf162725Configuration file can include one or more network blocks, e.g., one
437*4126Szf162725for each used SSID. wpa_supplicant will automatically select the best
438*4126Szf162725betwork based on the order of network blocks in the configuration
439*4126Szf162725file, network security level (WPA/WPA2 is prefered), and signal
440*4126Szf162725strength.
441*4126Szf162725
442*4126Szf162725Example configuration files for some common configurations:
443*4126Szf162725
444*4126Szf1627251) WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work
445*4126Szf162725   network
446*4126Szf162725
447*4126Szf162725# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
448*4126Szf162725ctrl_interface=/var/run/wpa_supplicant
449*4126Szf162725ctrl_interface_group=wheel
450*4126Szf162725#
451*4126Szf162725# home network; allow all valid ciphers
452*4126Szf162725network={
453*4126Szf162725	ssid="home"
454*4126Szf162725	scan_ssid=1
455*4126Szf162725	key_mgmt=WPA-PSK
456*4126Szf162725	psk="very secret passphrase"
457*4126Szf162725}
458*4126Szf162725#
459*4126Szf162725# work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
460*4126Szf162725network={
461*4126Szf162725	ssid="work"
462*4126Szf162725	scan_ssid=1
463*4126Szf162725	key_mgmt=WPA-EAP
464*4126Szf162725	pairwise=CCMP TKIP
465*4126Szf162725	group=CCMP TKIP
466*4126Szf162725	eap=TLS
467*4126Szf162725	identity="user@example.com"
468*4126Szf162725	ca_cert="/etc/cert/ca.pem"
469*4126Szf162725	client_cert="/etc/cert/user.pem"
470*4126Szf162725	private_key="/etc/cert/user.prv"
471*4126Szf162725	private_key_passwd="password"
472*4126Szf162725}
473*4126Szf162725
474*4126Szf162725
475*4126Szf1627252) WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that use old peaplabel
476*4126Szf162725   (e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-Series)
477*4126Szf162725
478*4126Szf162725ctrl_interface=/var/run/wpa_supplicant
479*4126Szf162725ctrl_interface_group=wheel
480*4126Szf162725network={
481*4126Szf162725	ssid="example"
482*4126Szf162725	scan_ssid=1
483*4126Szf162725	key_mgmt=WPA-EAP
484*4126Szf162725	eap=PEAP
485*4126Szf162725	identity="user@example.com"
486*4126Szf162725	password="foobar"
487*4126Szf162725	ca_cert="/etc/cert/ca.pem"
488*4126Szf162725	phase1="peaplabel=0"
489*4126Szf162725	phase2="auth=MSCHAPV2"
490*4126Szf162725}
491*4126Szf162725
492*4126Szf162725
493*4126Szf1627253) EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the
494*4126Szf162725   unencrypted use. Real identity is sent only within an encrypted TLS tunnel.
495*4126Szf162725
496*4126Szf162725ctrl_interface=/var/run/wpa_supplicant
497*4126Szf162725ctrl_interface_group=wheel
498*4126Szf162725network={
499*4126Szf162725	ssid="example"
500*4126Szf162725	scan_ssid=1
501*4126Szf162725	key_mgmt=WPA-EAP
502*4126Szf162725	eap=TTLS
503*4126Szf162725	identity="user@example.com"
504*4126Szf162725	anonymous_identity="anonymous@example.com"
505*4126Szf162725	password="foobar"
506*4126Szf162725	ca_cert="/etc/cert/ca.pem"
507*4126Szf162725	phase2="auth=MD5"
508*4126Szf162725}
509*4126Szf162725
510*4126Szf162725
511*4126Szf1627254) IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and
512*4126Szf162725   broadcast); use EAP-TLS for authentication
513*4126Szf162725
514*4126Szf162725ctrl_interface=/var/run/wpa_supplicant
515*4126Szf162725ctrl_interface_group=wheel
516*4126Szf162725network={
517*4126Szf162725	ssid="1x-test"
518*4126Szf162725	scan_ssid=1
519*4126Szf162725	key_mgmt=IEEE8021X
520*4126Szf162725	eap=TLS
521*4126Szf162725	identity="user@example.com"
522*4126Szf162725	ca_cert="/etc/cert/ca.pem"
523*4126Szf162725	client_cert="/etc/cert/user.pem"
524*4126Szf162725	private_key="/etc/cert/user.prv"
525*4126Szf162725	private_key_passwd="password"
526*4126Szf162725	eapol_flags=3
527*4126Szf162725}
528*4126Szf162725
529*4126Szf162725
530*4126Szf1627255) Catch all example that allows more or less all configuration modes. The
531*4126Szf162725   configuration options are used based on what security policy is used in the
532*4126Szf162725   selected SSID. This is mostly for testing and is not recommended for normal
533*4126Szf162725   use.
534*4126Szf162725
535*4126Szf162725ctrl_interface=/var/run/wpa_supplicant
536*4126Szf162725ctrl_interface_group=wheel
537*4126Szf162725network={
538*4126Szf162725	ssid="example"
539*4126Szf162725	scan_ssid=1
540*4126Szf162725	key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
541*4126Szf162725	pairwise=CCMP TKIP
542*4126Szf162725	group=CCMP TKIP WEP104 WEP40
543*4126Szf162725	psk="very secret passphrase"
544*4126Szf162725	eap=TTLS PEAP TLS
545*4126Szf162725	identity="user@example.com"
546*4126Szf162725	password="foobar"
547*4126Szf162725	ca_cert="/etc/cert/ca.pem"
548*4126Szf162725	client_cert="/etc/cert/user.pem"
549*4126Szf162725	private_key="/etc/cert/user.prv"
550*4126Szf162725	private_key_passwd="password"
551*4126Szf162725	phase1="peaplabel=0"
552*4126Szf162725	ca_cert2="/etc/cert/ca2.pem"
553*4126Szf162725	client_cert2="/etc/cer/user.pem"
554*4126Szf162725	private_key2="/etc/cer/user.prv"
555*4126Szf162725	private_key2_passwd="password"
556*4126Szf162725}
557*4126Szf162725
558*4126Szf162725
559*4126Szf162725
560*4126Szf162725Certificates
561*4126Szf162725------------
562*4126Szf162725
563*4126Szf162725Some EAP authentication methods require use of certificates. EAP-TLS
564*4126Szf162725uses both server side and client certificates whereas EAP-PEAP and
565*4126Szf162725EAP-TTLS only require the server side certificate. When client
566*4126Szf162725certificate is used, a matching private key file has to also be
567*4126Szf162725included in configuration. If the private key uses a passphrase, this
568*4126Szf162725has to be configured in wpa_supplicant.conf ("private_key_passwd").
569*4126Szf162725
570*4126Szf162725wpa_supplicant supports X.509 certificates in PEM and DER
571*4126Szf162725formats. User certificate and private key can be included in the same
572*4126Szf162725file.
573*4126Szf162725
574*4126Szf162725If the user certificate and private key is received in PKCS#12/PFX
575*4126Szf162725format, they need to be converted to suitable PEM/DER format for
576*4126Szf162725wpa_supplicant. This can be done, e.g., with following commands:
577*4126Szf162725
578*4126Szf162725# convert client certificate and private key to PEM format
579*4126Szf162725openssl pkcs12 -in example.pfx -out user.pem -clcerts
580*4126Szf162725# convert CA certificate (if included in PFX file) to PEM format
581*4126Szf162725openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys
582*4126Szf162725
583*4126Szf162725
584*4126Szf162725
585*4126Szf162725wpa_cli
586*4126Szf162725-------
587*4126Szf162725
588*4126Szf162725wpa_cli is a text-based frontend program for interacting with
589*4126Szf162725wpa_supplicant. It is used to query current status, change
590*4126Szf162725configuration, trigger events, and request interactive user input.
591*4126Szf162725
592*4126Szf162725wpa_cli can show the current authentication status, selected security
593*4126Szf162725mode, dot11 and dot1x MIBs, etc. In addition, it can configuring some
594*4126Szf162725variables like EAPOL state machine parameters and trigger events like
595*4126Szf162725reassociation and IEEE 802.1X logoff/logon. wpa_cli provides a user
596*4126Szf162725interface to request authentication information, like username and
597*4126Szf162725password, if these are not included in the configuration. This can be
598*4126Szf162725used to implement, e.g., one-time-passwords or generic token card
599*4126Szf162725authentication where the authentication is based on a
600*4126Szf162725challenge-response that uses an external device for generating the
601*4126Szf162725response.
602*4126Szf162725
603*4126Szf162725The control interface of wpa_supplicant can be configured to allow
604*4126Szf162725non-root user access (ctrl_interface_group in the configuration
605*4126Szf162725file). This makes it possible to run wpa_cli with a normal user
606*4126Szf162725account.
607*4126Szf162725
608*4126Szf162725wpa_cli supports two modes: interactive and command line. Both modes
609*4126Szf162725share the same command set and the main difference is in interactive
610*4126Szf162725mode providing access to unsolicited messages (event messages,
611*4126Szf162725username/password requests).
612*4126Szf162725
613*4126Szf162725Interactive mode is started when wpa_cli is executed without including
614*4126Szf162725the command as a command line parameter. Commands are then entered on
615*4126Szf162725the wpa_cli prompt. In command line mode, the same commands are
616*4126Szf162725entered as command line arguments for wpa_cli.
617*4126Szf162725
618*4126Szf162725
619*4126Szf162725Interactive authentication parameters request
620*4126Szf162725
621*4126Szf162725When wpa_supplicant need authentication parameters, like username and
622*4126Szf162725password, which are not present in the configuration file, it sends a
623*4126Szf162725request message to all attached frontend programs, e.g., wpa_cli in
624*4126Szf162725interactive mode. wpa_cli shows these requests with
625*4126Szf162725"CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, or
626*4126Szf162725OTP (one-time-password). <id> is a unique identifier for the current
627*4126Szf162725network. <text> is description of the request. In case of OTP request,
628*4126Szf162725it includes the challenge from the authentication server.
629*4126Szf162725
630*4126Szf162725The reply to these requests can be given with 'identity', 'password',
631*4126Szf162725and 'otp' commands. <id> needs to be copied from the the matching
632*4126Szf162725request. 'password' and 'otp' commands can be used regardless of
633*4126Szf162725whether the request was for PASSWORD or OTP. The main difference
634*4126Szf162725between these two commands is that values given with 'password' are
635*4126Szf162725remembered as long as wpa_supplicant is running whereas values given
636*4126Szf162725with 'otp' are used only once and then forgotten, i.e., wpa_supplicant
637*4126Szf162725will ask frontend for a new value for every use. This can be used to
638*4126Szf162725implement one-time-password lists and generic token card -based
639*4126Szf162725authentication.
640*4126Szf162725
641*4126Szf162725Example request for password and a matching reply:
642*4126Szf162725
643*4126Szf162725CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
644*4126Szf162725> password 1 mysecretpassword
645*4126Szf162725
646*4126Szf162725Example request for generic token card challenge-response:
647*4126Szf162725
648*4126Szf162725CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
649*4126Szf162725> otp 2 9876
650*4126Szf162725
651*4126Szf162725
652*4126Szf162725wpa_cli commands
653*4126Szf162725
654*4126Szf162725  status = get current WPA/EAPOL/EAP status
655*4126Szf162725  mib = get MIB variables (dot1x, dot11)
656*4126Szf162725  help = show this usage help
657*4126Szf162725  interface [ifname] = show interfaces/select interface
658*4126Szf162725  level <debug level> = change debug level
659*4126Szf162725  license = show full wpa_cli license
660*4126Szf162725  logoff = IEEE 802.1X EAPOL state machine logoff
661*4126Szf162725  logon = IEEE 802.1X EAPOL state machine logon
662*4126Szf162725  set = set variables (shows list of variables when run without arguments)
663*4126Szf162725  pmksa = show PMKSA cache
664*4126Szf162725  reassociate = force reassociation
665*4126Szf162725  reconfigure = force wpa_supplicant to re-read its configuration file
666*4126Szf162725  preauthenticate <BSSID> = force preauthentication
667*4126Szf162725  identity <network id> <identity> = configure identity for an SSID
668*4126Szf162725  password <network id> <password> = configure password for an SSID
669*4126Szf162725  otp <network id> <password> = configure one-time-password for an SSID
670*4126Szf162725  quit = exit wpa_cli
671*4126Szf162725
672*4126Szf162725
673*4126Szf162725
674*4126Szf162725Integrating with pcmcia-cs/cardmgr scripts
675*4126Szf162725------------------------------------------
676*4126Szf162725
677*4126Szf162725wpa_supplicant needs to be running when using a wireless network with
678*4126Szf162725WPA. It can be started either from system startup scripts or from
679*4126Szf162725pcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must be
680*4126Szf162725completed before data frames can be exchanged, so wpa_supplicant
681*4126Szf162725should be started before DHCP client.
682*4126Szf162725
683*4126Szf162725Command line option '-w' can be used if wpa_supplicant is started
684*4126Szf162725before the wireless LAN interface is present (e.g., before inserting
685*4126Szf162725the PC Card) or is not yet up.
686*4126Szf162725
687*4126Szf162725For example, following small changes to pcmcia-cs scripts can be used
688*4126Szf162725to enable WPA support:
689*4126Szf162725
690*4126Szf162725Add MODE="Managed" and WPA="y" to the network scheme in
691*4126Szf162725/etc/pcmcia/wireless.opts.
692*4126Szf162725
693*4126Szf162725Add the following block to the end of 'start' action handler in
694*4126Szf162725/etc/pcmcia/wireless:
695*4126Szf162725
696*4126Szf162725    if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
697*4126Szf162725	/usr/local/bin/wpa_supplicant -Bw -c/etc/wpa_supplicant.conf \
698*4126Szf162725		-i$DEVICE
699*4126Szf162725    fi
700*4126Szf162725
701*4126Szf162725Add the following block to the end of 'stop' action handler (may need
702*4126Szf162725to be separated from other actions) in /etc/pcmcia/wireless:
703*4126Szf162725
704*4126Szf162725    if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
705*4126Szf162725	killall wpa_supplicant
706*4126Szf162725    fi
707*4126Szf162725
708*4126Szf162725This will make cardmgr start wpa_supplicant when the card is plugged
709*4126Szf162725in. wpa_supplicant will wait until the interface is set up--either
710*4126Szf162725when a static IP address is configured or when DHCP client is
711*4126Szf162725started--and will then negotiate keys with the AP.
712*4126Szf162725
713*4126Szf162725
714*4126Szf162725
715*4126Szf162725Optional integration with Xsupplicant
716*4126Szf162725-------------------------------------
717*4126Szf162725
718*4126Szf162725wpa_supplicant has an integrated IEEE 802.1X Supplicant that supports
719*4126Szf162725most commonly used EAP methods. In addition, wpa_supplicant has an
720*4126Szf162725experimental interface for integrating it with Xsupplicant
721*4126Szf162725(http://www.open1x.org/) for the WPA with EAP authentication.
722*4126Szf162725
723*4126Szf162725Xsupplicant needs to be modified to send master session key to
724*4126Szf162725wpa_supplicant after successful EAP authentication. The included patch
725*4126Szf162725(xsupplicant.patch) shows the changes needed. This was merged into
726*4126Szf162725xsupplicant CVS on February 6, 2004, so any snapshot after that should
727*4126Szf162725have the needed functionality already included.
728*4126Szf162725
729*4126Szf162725When using WPA-EAP, both wpa_supplicant and Xsupplicant must be
730*4126Szf162725configured with the network security policy. See Xsupplicant documents
731*4126Szf162725for information about its configuration. Please also note, that a new
732*4126Szf162725command line option -W (enable WPA; added by xsupplicant.patch) must
733*4126Szf162725be used when starting xsupplicant.
734*4126Szf162725
735*4126Szf162725Example configuration for xsupplicant:
736*4126Szf162725
737*4126Szf162725network_list = all
738*4126Szf162725default_netname = jkm
739*4126Szf162725
740*4126Szf162725jkm
741*4126Szf162725{
742*4126Szf162725	type = wireless
743*4126Szf162725	allow_types = eap_peap
744*4126Szf162725	identity = <BEGIN_ID>jkm<END_ID>
745*4126Szf162725	eap-peap {
746*4126Szf162725		random_file = /dev/urandom
747*4126Szf162725		root_cert = /home/jkm/CA.pem
748*4126Szf162725		chunk_size = 1398
749*4126Szf162725		allow_types = eap_mschapv2
750*4126Szf162725		eap-mschapv2 {
751*4126Szf162725			username = <BEGIN_UNAME>jkm<END_UNAME>
752*4126Szf162725			password = <BEGIN_PASS>jkm<END_PASS>
753*4126Szf162725		}
754*4126Szf162725	}
755*4126Szf162725}
756*4126Szf162725
757*4126Szf162725
758*4126Szf162725Example configuration for wpa_supplicant:
759*4126Szf162725
760*4126Szf162725network={
761*4126Szf162725	ssid="jkm"
762*4126Szf162725	key_mgmt=WPA-EAP
763*4126Szf162725}
764*4126Szf162725
765*4126Szf162725
766*4126Szf162725Both wpa_supplicant and xsupplicant need to be started. Please remember
767*4126Szf162725to add '-W' option for xsupplicant in order to provide keying material
768*4126Szf162725for wpa_supplicant and '-e' option for wpa_supplicant to disable internal
769*4126Szf162725IEEE 802.1X implementation.
770*4126Szf162725
771*4126Szf162725wpa_supplicant -iwlan0 -cwpa_supplicant.conf -e
772*4126Szf162725xsupplicant -iwlan0 -cxsupplicant.conf -W
773