xref: /freebsd/contrib/wpa/wpa_supplicant/README (revision 39beb93c3f8bdbf72a61fda42300b5ebed7390c8)
1WPA Supplicant
2==============
3
4Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi> and contributors
5All Rights Reserved.
6
7This program is dual-licensed under both the GPL version 2 and BSD
8license. Either license may be used at your option.
9
10
11
12License
13-------
14
15GPL v2:
16
17This program is free software; you can redistribute it and/or modify
18it under the terms of the GNU General Public License version 2 as
19published by the Free Software Foundation.
20
21This program is distributed in the hope that it will be useful,
22but WITHOUT ANY WARRANTY; without even the implied warranty of
23MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24GNU General Public License for more details.
25
26You should have received a copy of the GNU General Public License
27along with this program; if not, write to the Free Software
28Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
29
30(this copy of the license is in COPYING file)
31
32
33Alternatively, this software may be distributed, used, and modified
34under the terms of BSD license:
35
36Redistribution and use in source and binary forms, with or without
37modification, are permitted provided that the following conditions are
38met:
39
401. Redistributions of source code must retain the above copyright
41   notice, this list of conditions and the following disclaimer.
42
432. Redistributions in binary form must reproduce the above copyright
44   notice, this list of conditions and the following disclaimer in the
45   documentation and/or other materials provided with the distribution.
46
473. Neither the name(s) of the above-listed copyright holder(s) nor the
48   names of its contributors may be used to endorse or promote products
49   derived from this software without specific prior written permission.
50
51THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
54A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
55OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
56SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62
63
64
65Features
66--------
67
68Supported WPA/IEEE 802.11i features:
69- WPA-PSK ("WPA-Personal")
70- WPA with EAP (e.g., with RADIUS authentication server) ("WPA-Enterprise")
71  Following authentication methods are supported with an integrate IEEE 802.1X
72  Supplicant:
73  * EAP-TLS
74  * EAP-PEAP/MSCHAPv2 (both PEAPv0 and PEAPv1)
75  * EAP-PEAP/TLS (both PEAPv0 and PEAPv1)
76  * EAP-PEAP/GTC (both PEAPv0 and PEAPv1)
77  * EAP-PEAP/OTP (both PEAPv0 and PEAPv1)
78  * EAP-PEAP/MD5-Challenge (both PEAPv0 and PEAPv1)
79  * EAP-TTLS/EAP-MD5-Challenge
80  * EAP-TTLS/EAP-GTC
81  * EAP-TTLS/EAP-OTP
82  * EAP-TTLS/EAP-MSCHAPv2
83  * EAP-TTLS/EAP-TLS
84  * EAP-TTLS/MSCHAPv2
85  * EAP-TTLS/MSCHAP
86  * EAP-TTLS/PAP
87  * EAP-TTLS/CHAP
88  * EAP-SIM
89  * EAP-AKA
90  * EAP-PSK
91  * EAP-PAX
92  * EAP-SAKE
93  * EAP-IKEv2
94  * EAP-GPSK
95  * LEAP (note: requires special support from the driver for IEEE 802.11
96	  authentication)
97  (following methods are supported, but since they do not generate keying
98   material, they cannot be used with WPA or IEEE 802.1X WEP keying)
99  * EAP-MD5-Challenge
100  * EAP-MSCHAPv2
101  * EAP-GTC
102  * EAP-OTP
103- key management for CCMP, TKIP, WEP104, WEP40
104- RSN/WPA2 (IEEE 802.11i)
105  * pre-authentication
106  * PMKSA caching
107
108Supported TLS/crypto libraries:
109- OpenSSL (default)
110- GnuTLS
111
112Internal TLS/crypto implementation (optional):
113- can be used in place of an external TLS/crypto library
114- TLSv1
115- X.509 certificate processing
116- PKCS #1
117- ASN.1
118- RSA
119- bignum
120- minimal size (ca. 50 kB binary, parts of which are already needed for WPA;
121  TLSv1/X.509/ASN.1/RSA/bignum parts are about 25 kB on x86)
122
123
124Requirements
125------------
126
127Current hardware/software requirements:
128- Linux kernel 2.4.x or 2.6.x with Linux Wireless Extensions v15 or newer
129- FreeBSD 6-CURRENT
130- NetBSD-current
131- Microsoft Windows with WinPcap (at least WinXP, may work with other versions)
132- drivers:
133	Linux drivers that support WPA/WPA2 configuration with the generic
134	Linux wireless extensions (WE-18 or newer). Even though there are
135	number of driver specific interface included in wpa_supplicant, please
136	note that Linux drivers are moving to use generic wireless extensions
137	and driver_wext (-Dwext on wpa_supplicant command line) should be the
138	default option to start with before falling back to driver specific
139	interface.
140
141	Host AP driver for Prism2/2.5/3 (development snapshot/v0.2.x)
142	(http://hostap.epitest.fi/)
143	Driver need to be set in Managed mode ('iwconfig wlan0 mode managed').
144	Please note that station firmware version needs to be 1.7.0 or newer
145	to work in WPA mode.
146
147	Linuxant DriverLoader (http://www.linuxant.com/driverloader/)
148	with Windows NDIS driver for your wlan card supporting WPA.
149
150	Agere Systems Inc. Linux Driver
151	(http://www.agere.com/support/drivers/)
152	Please note that the driver interface file (driver_hermes.c) and
153	hardware specific include files are not included in the
154	wpa_supplicant distribution. You will need to copy these from the
155	source package of the Agere driver.
156
157	madwifi driver for cards based on Atheros chip set (ar521x)
158	(http://sourceforge.net/projects/madwifi/)
159	Please note that you will need to modify the wpa_supplicant .config
160	file to use the correct path for the madwifi driver root directory
161	(CFLAGS += -I../madwifi/wpa line in example defconfig).
162
163	ATMEL AT76C5XXx driver for USB and PCMCIA cards
164	(http://atmelwlandriver.sourceforge.net/).
165
166	Linux ndiswrapper (http://ndiswrapper.sourceforge.net/) with
167	Windows NDIS driver.
168
169	Broadcom wl.o driver (old version only)
170	This is a generic Linux driver for Broadcom IEEE 802.11a/g cards.
171	However, it is proprietary driver that is not publicly available
172	except for couple of exceptions, mainly Broadcom-based APs/wireless
173	routers that use Linux. The driver binary can be downloaded, e.g.,
174	from Linksys support site (http://www.linksys.com/support/gpl.asp)
175	for Linksys WRT54G. The GPL tarball includes cross-compiler and
176	the needed header file, wlioctl.h, for compiling wpa_supplicant.
177	This driver support in wpa_supplicant is expected to work also with
178	other devices based on Broadcom driver (assuming the driver includes
179	client mode support). Please note that the newer Broadcom driver
180	("hybrid Linux driver") supports Linux wireless extensions and does
181	not need (or even work) with the specific driver wrapper. Use -Dwext
182	with that driver.
183
184	Intel ipw2100 driver
185	(http://sourceforge.net/projects/ipw2100/)
186
187	Intel ipw2200 driver
188	(http://sourceforge.net/projects/ipw2200/)
189
190	In theory, any driver that supports Linux wireless extensions can be
191	used with IEEE 802.1X (i.e., not WPA) when using ap_scan=0 option in
192	configuration file.
193
194	Wired Ethernet drivers (with ap_scan=0)
195
196	BSD net80211 layer (e.g., Atheros driver)
197	At the moment, this is for FreeBSD 6-CURRENT branch and NetBSD-current.
198
199	Windows NDIS
200	The current Windows port requires WinPcap (http://winpcap.polito.it/).
201	See README-Windows.txt for more information.
202
203wpa_supplicant was designed to be portable for different drivers and
204operating systems. Hopefully, support for more wlan cards and OSes will be
205added in the future. See developer's documentation
206(http://hostap.epitest.fi/wpa_supplicant/devel/) for more information about the
207design of wpa_supplicant and porting to other drivers. One main goal
208is to add full WPA/WPA2 support to Linux wireless extensions to allow
209new drivers to be supported without having to implement new
210driver-specific interface code in wpa_supplicant.
211
212Optional libraries for layer2 packet processing:
213- libpcap (tested with 0.7.2, most relatively recent versions assumed to work,
214	this is likely to be available with most distributions,
215	http://tcpdump.org/)
216- libdnet (tested with v1.4, most versions assumed to work,
217	http://libdnet.sourceforge.net/)
218
219These libraries are _not_ used in the default Linux build. Instead,
220internal Linux specific implementation is used. libpcap/libdnet are
221more portable and they can be used by adding CONFIG_L2_PACKET=pcap into
222.config. They may also be selected automatically for other operating
223systems. In case of Windows builds, WinPcap is used by default
224(CONFIG_L2_PACKET=winpcap).
225
226
227Optional libraries for EAP-TLS, EAP-PEAP, and EAP-TTLS:
228- OpenSSL (tested with 0.9.7c and 0.9.7d, and 0.9.8 versions; assumed to
229  work with most relatively recent versions; this is likely to be
230  available with most distributions, http://www.openssl.org/)
231- GnuTLS
232- internal TLSv1 implementation
233
234TLS options for EAP-FAST:
235- OpenSSL 0.9.8d _with_ openssl-0.9.8d-tls-extensions.patch applied
236  (i.e., the default OpenSSL package does not include support for
237  extensions needed for EAP-FAST)
238- internal TLSv1 implementation
239
240One of these libraries is needed when EAP-TLS, EAP-PEAP, EAP-TTLS, or
241EAP-FAST support is enabled. WPA-PSK mode does not require this or EAPOL/EAP
242implementation. A configuration file, .config, for compilation is
243needed to enable IEEE 802.1X/EAPOL and EAP methods. Note that EAP-MD5,
244EAP-GTC, EAP-OTP, and EAP-MSCHAPV2 cannot be used alone with WPA, so
245they should only be enabled if testing the EAPOL/EAP state
246machines. However, there can be used as inner authentication
247algorithms with EAP-PEAP and EAP-TTLS.
248
249See Building and installing section below for more detailed
250information about the wpa_supplicant build time configuration.
251
252
253
254WPA
255---
256
257The original security mechanism of IEEE 802.11 standard was not
258designed to be strong and has proven to be insufficient for most
259networks that require some kind of security. Task group I (Security)
260of IEEE 802.11 working group (http://www.ieee802.org/11/) has worked
261to address the flaws of the base standard and has in practice
262completed its work in May 2004. The IEEE 802.11i amendment to the IEEE
263802.11 standard was approved in June 2004 and published in July 2004.
264
265Wi-Fi Alliance (http://www.wi-fi.org/) used a draft version of the
266IEEE 802.11i work (draft 3.0) to define a subset of the security
267enhancements that can be implemented with existing wlan hardware. This
268is called Wi-Fi Protected Access<TM> (WPA). This has now become a
269mandatory component of interoperability testing and certification done
270by Wi-Fi Alliance. Wi-Fi provides information about WPA at its web
271site (http://www.wi-fi.org/OpenSection/protected_access.asp).
272
273IEEE 802.11 standard defined wired equivalent privacy (WEP) algorithm
274for protecting wireless networks. WEP uses RC4 with 40-bit keys,
27524-bit initialization vector (IV), and CRC32 to protect against packet
276forgery. All these choices have proven to be insufficient: key space is
277too small against current attacks, RC4 key scheduling is insufficient
278(beginning of the pseudorandom stream should be skipped), IV space is
279too small and IV reuse makes attacks easier, there is no replay
280protection, and non-keyed authentication does not protect against bit
281flipping packet data.
282
283WPA is an intermediate solution for the security issues. It uses
284Temporal Key Integrity Protocol (TKIP) to replace WEP. TKIP is a
285compromise on strong security and possibility to use existing
286hardware. It still uses RC4 for the encryption like WEP, but with
287per-packet RC4 keys. In addition, it implements replay protection,
288keyed packet authentication mechanism (Michael MIC).
289
290Keys can be managed using two different mechanisms. WPA can either use
291an external authentication server (e.g., RADIUS) and EAP just like
292IEEE 802.1X is using or pre-shared keys without need for additional
293servers. Wi-Fi calls these "WPA-Enterprise" and "WPA-Personal",
294respectively. Both mechanisms will generate a master session key for
295the Authenticator (AP) and Supplicant (client station).
296
297WPA implements a new key handshake (4-Way Handshake and Group Key
298Handshake) for generating and exchanging data encryption keys between
299the Authenticator and Supplicant. This handshake is also used to
300verify that both Authenticator and Supplicant know the master session
301key. These handshakes are identical regardless of the selected key
302management mechanism (only the method for generating master session
303key changes).
304
305
306
307IEEE 802.11i / WPA2
308-------------------
309
310The design for parts of IEEE 802.11i that were not included in WPA has
311finished (May 2004) and this amendment to IEEE 802.11 was approved in
312June 2004. Wi-Fi Alliance is using the final IEEE 802.11i as a new
313version of WPA called WPA2. This includes, e.g., support for more
314robust encryption algorithm (CCMP: AES in Counter mode with CBC-MAC)
315to replace TKIP and optimizations for handoff (reduced number of
316messages in initial key handshake, pre-authentication, and PMKSA caching).
317
318
319
320wpa_supplicant
321--------------
322
323wpa_supplicant is an implementation of the WPA Supplicant component,
324i.e., the part that runs in the client stations. It implements WPA key
325negotiation with a WPA Authenticator and EAP authentication with
326Authentication Server. In addition, it controls the roaming and IEEE
327802.11 authentication/association of the wlan driver.
328
329wpa_supplicant is designed to be a "daemon" program that runs in the
330background and acts as the backend component controlling the wireless
331connection. wpa_supplicant supports separate frontend programs and an
332example text-based frontend, wpa_cli, is included with wpa_supplicant.
333
334Following steps are used when associating with an AP using WPA:
335
336- wpa_supplicant requests the kernel driver to scan neighboring BSSes
337- wpa_supplicant selects a BSS based on its configuration
338- wpa_supplicant requests the kernel driver to associate with the chosen
339  BSS
340- If WPA-EAP: integrated IEEE 802.1X Supplicant completes EAP
341  authentication with the authentication server (proxied by the
342  Authenticator in the AP)
343- If WPA-EAP: master key is received from the IEEE 802.1X Supplicant
344- If WPA-PSK: wpa_supplicant uses PSK as the master session key
345- wpa_supplicant completes WPA 4-Way Handshake and Group Key Handshake
346  with the Authenticator (AP)
347- wpa_supplicant configures encryption keys for unicast and broadcast
348- normal data packets can be transmitted and received
349
350
351
352Building and installing
353-----------------------
354
355In order to be able to build wpa_supplicant, you will first need to
356select which parts of it will be included. This is done by creating a
357build time configuration file, .config, in the wpa_supplicant root
358directory. Configuration options are text lines using following
359format: CONFIG_<option>=y. Lines starting with # are considered
360comments and are ignored. See defconfig file for an example configuration
361and a list of available options and additional notes.
362
363The build time configuration can be used to select only the needed
364features and limit the binary size and requirements for external
365libraries. The main configuration parts are the selection of which
366driver interfaces (e.g., hostap, madwifi, ..) and which authentication
367methods (e.g., EAP-TLS, EAP-PEAP, ..) are included.
368
369Following build time configuration options are used to control IEEE
370802.1X/EAPOL and EAP state machines and all EAP methods. Including
371TLS, PEAP, or TTLS will require linking wpa_supplicant with OpenSSL
372library for TLS implementation. Alternatively, GnuTLS or the internal
373TLSv1 implementation can be used for TLS functionaly.
374
375CONFIG_IEEE8021X_EAPOL=y
376CONFIG_EAP_MD5=y
377CONFIG_EAP_MSCHAPV2=y
378CONFIG_EAP_TLS=y
379CONFIG_EAP_PEAP=y
380CONFIG_EAP_TTLS=y
381CONFIG_EAP_GTC=y
382CONFIG_EAP_OTP=y
383CONFIG_EAP_SIM=y
384CONFIG_EAP_AKA=y
385CONFIG_EAP_PSK=y
386CONFIG_EAP_SAKE=y
387CONFIG_EAP_GPSK=y
388CONFIG_EAP_PAX=y
389CONFIG_EAP_LEAP=y
390CONFIG_EAP_IKEV2=y
391
392Following option can be used to include GSM SIM/USIM interface for GSM/UMTS
393authentication algorithm (for EAP-SIM/EAP-AKA). This requires pcsc-lite
394(http://www.linuxnet.com/) for smart card access.
395
396CONFIG_PCSC=y
397
398Following options can be added to .config to select which driver
399interfaces are included. Hermes driver interface needs to be downloaded
400from Agere (see above). CONFIG_WIRELESS_EXTENSION will be used
401automatically if any of the selected drivers need it.
402
403CONFIG_WIRELESS_EXTENSION=y
404CONFIG_DRIVER_HOSTAP=y
405CONFIG_DRIVER_HERMES=y
406CONFIG_DRIVER_MADWIFI=y
407CONFIG_DRIVER_ATMEL=y
408CONFIG_DRIVER_WEXT=y
409CONFIG_DRIVER_RALINK=y
410CONFIG_DRIVER_NDISWRAPPER=y
411CONFIG_DRIVER_BROADCOM=y
412CONFIG_DRIVER_IPW=y
413CONFIG_DRIVER_BSD=y
414CONFIG_DRIVER_NDIS=y
415
416Following example includes all features and driver interfaces that are
417included in the wpa_supplicant package:
418
419CONFIG_DRIVER_HOSTAP=y
420CONFIG_DRIVER_HERMES=y
421CONFIG_DRIVER_MADWIFI=y
422CONFIG_DRIVER_ATMEL=y
423CONFIG_DRIVER_WEXT=y
424CONFIG_DRIVER_NDISWRAPPER=y
425CONFIG_DRIVER_BROADCOM=y
426CONFIG_DRIVER_IPW=y
427CONFIG_DRIVER_BSD=y
428CONFIG_DRIVER_NDIS=y
429CONFIG_WIRELESS_EXTENSION=y
430CONFIG_IEEE8021X_EAPOL=y
431CONFIG_EAP_MD5=y
432CONFIG_EAP_MSCHAPV2=y
433CONFIG_EAP_TLS=y
434CONFIG_EAP_PEAP=y
435CONFIG_EAP_TTLS=y
436CONFIG_EAP_GTC=y
437CONFIG_EAP_OTP=y
438CONFIG_EAP_SIM=y
439CONFIG_EAP_AKA=y
440CONFIG_EAP_PSK=y
441CONFIG_EAP_SAKE=y
442CONFIG_EAP_GPSK=y
443CONFIG_EAP_PAX=y
444CONFIG_EAP_LEAP=y
445CONFIG_EAP_IKEV2=y
446CONFIG_PCSC=y
447
448EAP-PEAP and EAP-TTLS will automatically include configured EAP
449methods (MD5, OTP, GTC, MSCHAPV2) for inner authentication selection.
450
451
452After you have created a configuration file, you can build
453wpa_supplicant and wpa_cli with 'make' command. You may then install
454the binaries to a suitable system directory, e.g., /usr/local/bin.
455
456Example commands:
457
458# build wpa_supplicant and wpa_cli
459make
460# install binaries (this may need root privileges)
461cp wpa_cli wpa_supplicant /usr/local/bin
462
463
464You will need to make a configuration file, e.g.,
465/etc/wpa_supplicant.conf, with network configuration for the networks
466you are going to use. Configuration file section below includes
467explanation fo the configuration file format and includes various
468examples. Once the configuration is ready, you can test whether the
469configuration work by first running wpa_supplicant with following
470command to start it on foreground with debugging enabled:
471
472wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d
473
474Assuming everything goes fine, you can start using following command
475to start wpa_supplicant on background without debugging:
476
477wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
478
479Please note that if you included more than one driver interface in the
480build time configuration (.config), you may need to specify which
481interface to use by including -D<driver name> option on the command
482line. See following section for more details on command line options
483for wpa_supplicant.
484
485
486
487Command line options
488--------------------
489
490usage:
491  wpa_supplicant [-BddfhKLqqtuvwW] [-P<pid file>] [-g<global ctrl>] \
492        -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
493        [-b<br_ifname> [-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
494        [-p<driver_param>] [-b<br_ifname>] ...]
495
496options:
497  -b = optional bridge interface name
498  -B = run daemon in the background
499  -c = Configuration file
500  -C = ctrl_interface parameter (only used if -c is not)
501  -i = interface name
502  -d = increase debugging verbosity (-dd even more)
503  -D = driver name
504  -f = Log output to default log location (normally /tmp)
505  -g = global ctrl_interface
506  -K = include keys (passwords, etc.) in debug output
507  -t = include timestamp in debug messages
508  -h = show this help text
509  -L = show license (GPL and BSD)
510  -p = driver parameters
511  -P = PID file
512  -q = decrease debugging verbosity (-qq even less)
513  -u = enable DBus control interface
514  -v = show version
515  -w = wait for interface to be added, if needed
516  -W = wait for a control interface monitor before starting
517  -N = start describing new interface
518
519drivers:
520  hostap = Host AP driver (Intersil Prism2/2.5/3) [default]
521	(this can also be used with Linuxant DriverLoader)
522  hermes = Agere Systems Inc. driver (Hermes-I/Hermes-II)
523  madwifi = MADWIFI 802.11 support (Atheros, etc.)
524  atmel = ATMEL AT76C5XXx (USB, PCMCIA)
525  wext = Linux wireless extensions (generic)
526  ralink = Ralink Client driver
527  ndiswrapper = Linux ndiswrapper
528  broadcom = Broadcom wl.o driver
529  ipw = Intel ipw2100/2200 driver (old; use wext with Linux 2.6.13 or newer)
530  wired = wpa_supplicant wired Ethernet driver
531  roboswitch = wpa_supplicant Broadcom switch driver
532  bsd = BSD 802.11 support (Atheros, etc.)
533  ndis = Windows NDIS driver
534
535In most common cases, wpa_supplicant is started with
536
537wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0
538
539This makes the process fork into background.
540
541The easiest way to debug problems, and to get debug log for bug
542reports, is to start wpa_supplicant on foreground with debugging
543enabled:
544
545wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d
546
547
548wpa_supplicant can control multiple interfaces (radios) either by
549running one process for each interface separately or by running just
550one process and list of options at command line. Each interface is
551separated with -N argument. As an example, following command would
552start wpa_supplicant for two interfaces:
553
554wpa_supplicant \
555	-c wpa1.conf -i wlan0 -D hostap -N \
556	-c wpa2.conf -i ath0 -D madwifi
557
558
559If the interface is added in a Linux bridge (e.g., br0), the bridge
560interface needs to be configured to wpa_supplicant in addition to the
561main interface:
562
563wpa_supplicant -cw.conf -Dmadwifi -iath0 -bbr0
564
565
566Configuration file
567------------------
568
569wpa_supplicant is configured using a text file that lists all accepted
570networks and security policies, including pre-shared keys. See
571example configuration file, wpa_supplicant.conf, for detailed
572information about the configuration format and supported fields.
573
574Changes to configuration file can be reloaded be sending SIGHUP signal
575to wpa_supplicant ('killall -HUP wpa_supplicant'). Similarly,
576reloading can be triggered with 'wpa_cli reconfigure' command.
577
578Configuration file can include one or more network blocks, e.g., one
579for each used SSID. wpa_supplicant will automatically select the best
580betwork based on the order of network blocks in the configuration
581file, network security level (WPA/WPA2 is preferred), and signal
582strength.
583
584Example configuration files for some common configurations:
585
5861) WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work
587   network
588
589# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
590ctrl_interface=/var/run/wpa_supplicant
591ctrl_interface_group=wheel
592#
593# home network; allow all valid ciphers
594network={
595	ssid="home"
596	scan_ssid=1
597	key_mgmt=WPA-PSK
598	psk="very secret passphrase"
599}
600#
601# work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
602network={
603	ssid="work"
604	scan_ssid=1
605	key_mgmt=WPA-EAP
606	pairwise=CCMP TKIP
607	group=CCMP TKIP
608	eap=TLS
609	identity="user@example.com"
610	ca_cert="/etc/cert/ca.pem"
611	client_cert="/etc/cert/user.pem"
612	private_key="/etc/cert/user.prv"
613	private_key_passwd="password"
614}
615
616
6172) WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that use old peaplabel
618   (e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-Series)
619
620ctrl_interface=/var/run/wpa_supplicant
621ctrl_interface_group=wheel
622network={
623	ssid="example"
624	scan_ssid=1
625	key_mgmt=WPA-EAP
626	eap=PEAP
627	identity="user@example.com"
628	password="foobar"
629	ca_cert="/etc/cert/ca.pem"
630	phase1="peaplabel=0"
631	phase2="auth=MSCHAPV2"
632}
633
634
6353) EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the
636   unencrypted use. Real identity is sent only within an encrypted TLS tunnel.
637
638ctrl_interface=/var/run/wpa_supplicant
639ctrl_interface_group=wheel
640network={
641	ssid="example"
642	scan_ssid=1
643	key_mgmt=WPA-EAP
644	eap=TTLS
645	identity="user@example.com"
646	anonymous_identity="anonymous@example.com"
647	password="foobar"
648	ca_cert="/etc/cert/ca.pem"
649	phase2="auth=MD5"
650}
651
652
6534) IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and
654   broadcast); use EAP-TLS for authentication
655
656ctrl_interface=/var/run/wpa_supplicant
657ctrl_interface_group=wheel
658network={
659	ssid="1x-test"
660	scan_ssid=1
661	key_mgmt=IEEE8021X
662	eap=TLS
663	identity="user@example.com"
664	ca_cert="/etc/cert/ca.pem"
665	client_cert="/etc/cert/user.pem"
666	private_key="/etc/cert/user.prv"
667	private_key_passwd="password"
668	eapol_flags=3
669}
670
671
6725) Catch all example that allows more or less all configuration modes. The
673   configuration options are used based on what security policy is used in the
674   selected SSID. This is mostly for testing and is not recommended for normal
675   use.
676
677ctrl_interface=/var/run/wpa_supplicant
678ctrl_interface_group=wheel
679network={
680	ssid="example"
681	scan_ssid=1
682	key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
683	pairwise=CCMP TKIP
684	group=CCMP TKIP WEP104 WEP40
685	psk="very secret passphrase"
686	eap=TTLS PEAP TLS
687	identity="user@example.com"
688	password="foobar"
689	ca_cert="/etc/cert/ca.pem"
690	client_cert="/etc/cert/user.pem"
691	private_key="/etc/cert/user.prv"
692	private_key_passwd="password"
693	phase1="peaplabel=0"
694	ca_cert2="/etc/cert/ca2.pem"
695	client_cert2="/etc/cer/user.pem"
696	private_key2="/etc/cer/user.prv"
697	private_key2_passwd="password"
698}
699
700
7016) Authentication for wired Ethernet. This can be used with 'wired' or
702   'roboswitch' interface (-Dwired or -Droboswitch on command line).
703
704ctrl_interface=/var/run/wpa_supplicant
705ctrl_interface_group=wheel
706ap_scan=0
707network={
708	key_mgmt=IEEE8021X
709	eap=MD5
710	identity="user"
711	password="password"
712	eapol_flags=0
713}
714
715
716
717Certificates
718------------
719
720Some EAP authentication methods require use of certificates. EAP-TLS
721uses both server side and client certificates whereas EAP-PEAP and
722EAP-TTLS only require the server side certificate. When client
723certificate is used, a matching private key file has to also be
724included in configuration. If the private key uses a passphrase, this
725has to be configured in wpa_supplicant.conf ("private_key_passwd").
726
727wpa_supplicant supports X.509 certificates in PEM and DER
728formats. User certificate and private key can be included in the same
729file.
730
731If the user certificate and private key is received in PKCS#12/PFX
732format, they need to be converted to suitable PEM/DER format for
733wpa_supplicant. This can be done, e.g., with following commands:
734
735# convert client certificate and private key to PEM format
736openssl pkcs12 -in example.pfx -out user.pem -clcerts
737# convert CA certificate (if included in PFX file) to PEM format
738openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys
739
740
741
742wpa_cli
743-------
744
745wpa_cli is a text-based frontend program for interacting with
746wpa_supplicant. It is used to query current status, change
747configuration, trigger events, and request interactive user input.
748
749wpa_cli can show the current authentication status, selected security
750mode, dot11 and dot1x MIBs, etc. In addition, it can configure some
751variables like EAPOL state machine parameters and trigger events like
752reassociation and IEEE 802.1X logoff/logon. wpa_cli provides a user
753interface to request authentication information, like username and
754password, if these are not included in the configuration. This can be
755used to implement, e.g., one-time-passwords or generic token card
756authentication where the authentication is based on a
757challenge-response that uses an external device for generating the
758response.
759
760The control interface of wpa_supplicant can be configured to allow
761non-root user access (ctrl_interface_group in the configuration
762file). This makes it possible to run wpa_cli with a normal user
763account.
764
765wpa_cli supports two modes: interactive and command line. Both modes
766share the same command set and the main difference is in interactive
767mode providing access to unsolicited messages (event messages,
768username/password requests).
769
770Interactive mode is started when wpa_cli is executed without including
771the command as a command line parameter. Commands are then entered on
772the wpa_cli prompt. In command line mode, the same commands are
773entered as command line arguments for wpa_cli.
774
775
776Interactive authentication parameters request
777
778When wpa_supplicant need authentication parameters, like username and
779password, which are not present in the configuration file, it sends a
780request message to all attached frontend programs, e.g., wpa_cli in
781interactive mode. wpa_cli shows these requests with
782"CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, or
783OTP (one-time-password). <id> is a unique identifier for the current
784network. <text> is description of the request. In case of OTP request,
785it includes the challenge from the authentication server.
786
787The reply to these requests can be given with 'identity', 'password',
788and 'otp' commands. <id> needs to be copied from the the matching
789request. 'password' and 'otp' commands can be used regardless of
790whether the request was for PASSWORD or OTP. The main difference
791between these two commands is that values given with 'password' are
792remembered as long as wpa_supplicant is running whereas values given
793with 'otp' are used only once and then forgotten, i.e., wpa_supplicant
794will ask frontend for a new value for every use. This can be used to
795implement one-time-password lists and generic token card -based
796authentication.
797
798Example request for password and a matching reply:
799
800CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
801> password 1 mysecretpassword
802
803Example request for generic token card challenge-response:
804
805CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
806> otp 2 9876
807
808
809wpa_cli commands
810
811  status = get current WPA/EAPOL/EAP status
812  mib = get MIB variables (dot1x, dot11)
813  help = show this usage help
814  interface [ifname] = show interfaces/select interface
815  level <debug level> = change debug level
816  license = show full wpa_cli license
817  logoff = IEEE 802.1X EAPOL state machine logoff
818  logon = IEEE 802.1X EAPOL state machine logon
819  set = set variables (shows list of variables when run without arguments)
820  pmksa = show PMKSA cache
821  reassociate = force reassociation
822  reconfigure = force wpa_supplicant to re-read its configuration file
823  preauthenticate <BSSID> = force preauthentication
824  identity <network id> <identity> = configure identity for an SSID
825  password <network id> <password> = configure password for an SSID
826  pin <network id> <pin> = configure pin for an SSID
827  otp <network id> <password> = configure one-time-password for an SSID
828  passphrase <network id> <passphrase> = configure private key passphrase
829    for an SSID
830  bssid <network id> <BSSID> = set preferred BSSID for an SSID
831  list_networks = list configured networks
832  select_network <network id> = select a network (disable others)
833  enable_network <network id> = enable a network
834  disable_network <network id> = disable a network
835  add_network = add a network
836  remove_network <network id> = remove a network
837  set_network <network id> <variable> <value> = set network variables (shows
838    list of variables when run without arguments)
839  get_network <network id> <variable> = get network variables
840  save_config = save the current configuration
841  disconnect = disconnect and wait for reassociate command before connecting
842  scan = request new BSS scan
843  scan_results = get latest scan results
844  get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = get capabilies
845  terminate = terminate wpa_supplicant
846  quit = exit wpa_cli
847
848
849wpa_cli command line options
850
851wpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvB] [-a<action file>] \
852        [-P<pid file>] [-g<global ctrl>]  [command..]
853  -h = help (show this usage text)
854  -v = shown version information
855  -a = run in daemon mode executing the action file based on events from
856       wpa_supplicant
857  -B = run a daemon in the background
858  default path: /var/run/wpa_supplicant
859  default interface: first interface found in socket path
860
861
862Using wpa_cli to run external program on connect/disconnect
863-----------------------------------------------------------
864
865wpa_cli can used to run external programs whenever wpa_supplicant
866connects or disconnects from a network. This can be used, e.g., to
867update network configuration and/or trigget DHCP client to update IP
868addresses, etc.
869
870One wpa_cli process in "action" mode needs to be started for each
871interface. For example, the following command starts wpa_cli for the
872default ingterface (-i can be used to select the interface in case of
873more than one interface being used at the same time):
874
875wpa_cli -a/sbin/wpa_action.sh -B
876
877The action file (-a option, /sbin/wpa_action.sh in this example) will
878be executed whenever wpa_supplicant completes authentication (connect
879event) or detects disconnection). The action script will be called
880with two command line arguments: interface name and event (CONNECTED
881or DISCONNECTED). If the action script needs to get more information
882about the current network, it can use 'wpa_cli status' to query
883wpa_supplicant for more information.
884
885Following example can be used as a simple template for an action
886script:
887
888#!/bin/sh
889
890IFNAME=$1
891CMD=$2
892
893if [ "$CMD" == "CONNECTED" ]; then
894    SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
895    # configure network, signal DHCP client, etc.
896fi
897
898if [ "$CMD" == "DISCONNECTED" ]; then
899    # remove network configuration, if needed
900fi
901
902
903
904Integrating with pcmcia-cs/cardmgr scripts
905------------------------------------------
906
907wpa_supplicant needs to be running when using a wireless network with
908WPA. It can be started either from system startup scripts or from
909pcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must be
910completed before data frames can be exchanged, so wpa_supplicant
911should be started before DHCP client.
912
913For example, following small changes to pcmcia-cs scripts can be used
914to enable WPA support:
915
916Add MODE="Managed" and WPA="y" to the network scheme in
917/etc/pcmcia/wireless.opts.
918
919Add the following block to the end of 'start' action handler in
920/etc/pcmcia/wireless:
921
922    if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
923	/usr/local/bin/wpa_supplicant -B -c/etc/wpa_supplicant.conf \
924		-i$DEVICE
925    fi
926
927Add the following block to the end of 'stop' action handler (may need
928to be separated from other actions) in /etc/pcmcia/wireless:
929
930    if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
931	killall wpa_supplicant
932    fi
933
934This will make cardmgr start wpa_supplicant when the card is plugged
935in.
936
937
938
939Dynamic interface add and operation without configuration files
940---------------------------------------------------------------
941
942wpa_supplicant can be started without any configuration files or
943network interfaces. When used in this way, a global (i.e., per
944wpa_supplicant process) control interface is used to add and remove
945network interfaces. Each network interface can then be configured
946through a per-network interface control interface. For example,
947following commands show how to start wpa_supplicant without any
948network interfaces and then add a network interface and configure a
949network (SSID):
950
951# Start wpa_supplicant in the background
952wpa_supplicant -g/var/run/wpa_supplicant-global -B
953
954# Add a new interface (wlan0, no configuration file, driver=wext, and
955# enable control interface)
956wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan0 \
957	"" wext /var/run/wpa_supplicant
958
959# Configure a network using the newly added network interface:
960wpa_cli -iwlan0 add_network
961wpa_cli -iwlan0 set_network 0 ssid '"test"'
962wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
963wpa_cli -iwlan0 set_network 0 psk '"12345678"'
964wpa_cli -iwlan0 set_network 0 pairwise TKIP
965wpa_cli -iwlan0 set_network 0 group TKIP
966wpa_cli -iwlan0 set_network 0 proto WPA
967wpa_cli -iwlan0 enable_network 0
968
969# At this point, the new network interface should start trying to associate
970# with the WPA-PSK network using SSID test.
971
972# Remove network interface
973wpa_cli -g/var/run/wpa_supplicant-global interface_remove wlan0
974
975
976Privilege separation
977--------------------
978
979To minimize the size of code that needs to be run with root privileges
980(e.g., to control wireless interface operation), wpa_supplicant
981supports optional privilege separation. If enabled, this separates the
982privileged operations into a separate process (wpa_priv) while leaving
983rest of the code (e.g., EAP authentication and WPA handshakes) into an
984unprivileged process (wpa_supplicant) that can be run as non-root
985user. Privilege separation restricts the effects of potential software
986errors by containing the majority of the code in an unprivileged
987process to avoid full system compromise.
988
989Privilege separation is not enabled by default and it can be enabled
990by adding CONFIG_PRIVSEP=y to the build configuration (.config). When
991enabled, the privileged operations (driver wrapper and l2_packet) are
992linked into a separate daemon program, wpa_priv. The unprivileged
993program, wpa_supplicant, will be built with a special driver/l2_packet
994wrappers that communicate with the privileged wpa_priv process to
995perform the needed operations. wpa_priv can control what privileged
996are allowed.
997
998wpa_priv needs to be run with network admin privileges (usually, root
999user). It opens a UNIX domain socket for each interface that is
1000included on the command line; any other interface will be off limits
1001for wpa_supplicant in this kind of configuration. After this,
1002wpa_supplicant can be run as a non-root user (e.g., all standard users
1003on a laptop or as a special non-privileged user account created just
1004for this purpose to limit access to user files even further).
1005
1006
1007Example configuration:
1008- create user group for users that are allowed to use wpa_supplicant
1009  ('wpapriv' in this example) and assign users that should be able to
1010  use wpa_supplicant into that group
1011- create /var/run/wpa_priv directory for UNIX domain sockets and control
1012  user access by setting it accessible only for the wpapriv group:
1013  mkdir /var/run/wpa_priv
1014  chown root:wpapriv /var/run/wpa_priv
1015  chmod 0750 /var/run/wpa_priv
1016- start wpa_priv as root (e.g., from system startup scripts) with the
1017  enabled interfaces configured on the command line:
1018  wpa_priv -B -P /var/run/wpa_priv.pid wext:ath0
1019- run wpa_supplicant as non-root with a user that is in wpapriv group:
1020  wpa_supplicant -i ath0 -c wpa_supplicant.conf
1021
1022wpa_priv does not use the network interface before wpa_supplicant is
1023started, so it is fine to include network interfaces that are not
1024available at the time wpa_priv is started. As an alternative, wpa_priv
1025can be started when an interface is added (hotplug/udev/etc. scripts).
1026wpa_priv can control multiple interface with one process, but it is
1027also possible to run multiple wpa_priv processes at the same time, if
1028desired.
1029