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