4
Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi> and contributors
7
This program is dual-licensed under both the GPL version 2 and BSD
8
license. Either license may be used at your option.
17
This program is free software; you can redistribute it and/or modify
18
it under the terms of the GNU General Public License version 2 as
19
published by the Free Software Foundation.
21
This program is distributed in the hope that it will be useful,
22
but WITHOUT ANY WARRANTY; without even the implied warranty of
23
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
GNU General Public License for more details.
26
You should have received a copy of the GNU General Public License
27
along with this program; if not, write to the Free Software
28
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30
(this copy of the license is in COPYING file)
33
Alternatively, this software may be distributed, used, and modified
34
under the terms of BSD license:
36
Redistribution and use in source and binary forms, with or without
37
modification, are permitted provided that the following conditions are
40
1. Redistributions of source code must retain the above copyright
41
notice, this list of conditions and the following disclaimer.
43
2. 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.
47
3. 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.
51
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
54
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
55
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
56
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68
Supported 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
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
82
* EAP-TTLS/EAP-MSCHAPv2
94
* LEAP (note: requires special support from the driver for IEEE 802.11
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)
102
- key management for CCMP, TKIP, WEP104, WEP40
103
- RSN/WPA2 (IEEE 802.11i)
107
Supported TLS/crypto libraries:
111
Internal TLS/crypto implementation (optional):
112
- can be used in place of an external TLS/crypto library
114
- X.509 certificate processing
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)
126
Current hardware/software requirements:
127
- Linux kernel 2.4.x or 2.6.x with Linux Wireless Extensions v15 or newer
130
- Microsoft Windows with WinPcap (at least WinXP, may work with other versions)
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
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
146
Linuxant DriverLoader (http://www.linuxant.com/driverloader/)
147
with Windows NDIS driver for your wlan card supporting WPA.
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.
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).
162
ATMEL AT76C5XXx driver for USB and PCMCIA cards
163
(http://atmelwlandriver.sourceforge.net/).
165
Linux ndiswrapper (http://ndiswrapper.sourceforge.net/) with
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).
181
(http://sourceforge.net/projects/ipw2100/)
184
(http://sourceforge.net/projects/ipw2200/)
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
190
Wired Ethernet drivers (with ap_scan=0)
192
BSD net80211 layer (e.g., Atheros driver)
193
At the moment, this is for FreeBSD 6-CURRENT branch and NetBSD-current.
196
The current Windows port requires WinPcap (http://winpcap.polito.it/).
197
See README-Windows.txt for more information.
199
wpa_supplicant was designed to be portable for different drivers and
200
operating systems. Hopefully, support for more wlan cards and OSes will be
201
added in the future. See developer's documentation
202
(http://hostap.epitest.fi/wpa_supplicant/devel/) for more information about the
203
design of wpa_supplicant and porting to other drivers. One main goal
204
is to add full WPA/WPA2 support to Linux wireless extensions to allow
205
new drivers to be supported without having to implement new
206
driver-specific interface code in wpa_supplicant.
208
Optional 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,
212
- libdnet (tested with v1.4, most versions assumed to work,
213
http://libdnet.sourceforge.net/)
215
These libraries are _not_ used in the default Linux build. Instead,
216
internal Linux specific implementation is used. libpcap/libdnet are
217
more portable and they can be used by adding CONFIG_L2_PACKET=pcap into
218
.config. They may also be selected automatically for other operating
219
systems. In case of Windows builds, WinPcap is used by default
220
(CONFIG_L2_PACKET=winpcap).
223
Optional 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/)
228
- internal TLSv1 implementation
230
TLS 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
236
One of these libraries is needed when EAP-TLS, EAP-PEAP, EAP-TTLS, or
237
EAP-FAST support is enabled. WPA-PSK mode does not require this or EAPOL/EAP
238
implementation. A configuration file, .config, for compilation is
239
needed to enable IEEE 802.1X/EAPOL and EAP methods. Note that EAP-MD5,
240
EAP-GTC, EAP-OTP, and EAP-MSCHAPV2 cannot be used alone with WPA, so
241
they should only be enabled if testing the EAPOL/EAP state
242
machines. However, there can be used as inner authentication
243
algorithms with EAP-PEAP and EAP-TTLS.
245
See Building and installing section below for more detailed
246
information about the wpa_supplicant build time configuration.
253
The original security mechanism of IEEE 802.11 standard was not
254
designed to be strong and has proven to be insufficient for most
255
networks that require some kind of security. Task group I (Security)
256
of IEEE 802.11 working group (http://www.ieee802.org/11/) has worked
257
to address the flaws of the base standard and has in practice
258
completed its work in May 2004. The IEEE 802.11i amendment to the IEEE
259
802.11 standard was approved in June 2004 and published in July 2004.
261
Wi-Fi Alliance (http://www.wi-fi.org/) used a draft version of the
262
IEEE 802.11i work (draft 3.0) to define a subset of the security
263
enhancements that can be implemented with existing wlan hardware. This
264
is called Wi-Fi Protected Access<TM> (WPA). This has now become a
265
mandatory component of interoperability testing and certification done
266
by Wi-Fi Alliance. Wi-Fi provides information about WPA at its web
267
site (http://www.wi-fi.org/OpenSection/protected_access.asp).
269
IEEE 802.11 standard defined wired equivalent privacy (WEP) algorithm
270
for protecting wireless networks. WEP uses RC4 with 40-bit keys,
271
24-bit initialization vector (IV), and CRC32 to protect against packet
272
forgery. All these choices have proven to be insufficient: key space is
273
too small against current attacks, RC4 key scheduling is insufficient
274
(beginning of the pseudorandom stream should be skipped), IV space is
275
too small and IV reuse makes attacks easier, there is no replay
276
protection, and non-keyed authentication does not protect against bit
277
flipping packet data.
279
WPA is an intermediate solution for the security issues. It uses
280
Temporal Key Integrity Protocol (TKIP) to replace WEP. TKIP is a
281
compromise on strong security and possibility to use existing
282
hardware. It still uses RC4 for the encryption like WEP, but with
283
per-packet RC4 keys. In addition, it implements replay protection,
284
keyed packet authentication mechanism (Michael MIC).
286
Keys can be managed using two different mechanisms. WPA can either use
287
an external authentication server (e.g., RADIUS) and EAP just like
288
IEEE 802.1X is using or pre-shared keys without need for additional
289
servers. Wi-Fi calls these "WPA-Enterprise" and "WPA-Personal",
290
respectively. Both mechanisms will generate a master session key for
291
the Authenticator (AP) and Supplicant (client station).
293
WPA implements a new key handshake (4-Way Handshake and Group Key
294
Handshake) for generating and exchanging data encryption keys between
295
the Authenticator and Supplicant. This handshake is also used to
296
verify that both Authenticator and Supplicant know the master session
297
key. These handshakes are identical regardless of the selected key
298
management mechanism (only the method for generating master session
306
The design for parts of IEEE 802.11i that were not included in WPA has
307
finished (May 2004) and this amendment to IEEE 802.11 was approved in
308
June 2004. Wi-Fi Alliance is using the final IEEE 802.11i as a new
309
version of WPA called WPA2. This includes, e.g., support for more
310
robust encryption algorithm (CCMP: AES in Counter mode with CBC-MAC)
311
to replace TKIP and optimizations for handoff (reduced number of
312
messages in initial key handshake, pre-authentication, and PMKSA caching).
319
wpa_supplicant is an implementation of the WPA Supplicant component,
320
i.e., the part that runs in the client stations. It implements WPA key
321
negotiation with a WPA Authenticator and EAP authentication with
322
Authentication Server. In addition, it controls the roaming and IEEE
323
802.11 authentication/association of the wlan driver.
325
wpa_supplicant is designed to be a "daemon" program that runs in the
326
background and acts as the backend component controlling the wireless
327
connection. wpa_supplicant supports separate frontend programs and an
328
example text-based frontend, wpa_cli, is included with wpa_supplicant.
330
Following steps are used when associating with an AP using WPA:
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
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
348
Building and installing
349
-----------------------
351
In order to be able to build wpa_supplicant, you will first need to
352
select which parts of it will be included. This is done by creating a
353
build time configuration file, .config, in the wpa_supplicant root
354
directory. Configuration options are text lines using following
355
format: CONFIG_<option>=y. Lines starting with # are considered
356
comments and are ignored. See defconfig file for an example configuration
357
and a list of available options and additional notes.
359
The build time configuration can be used to select only the needed
360
features and limit the binary size and requirements for external
361
libraries. The main configuration parts are the selection of which
362
driver interfaces (e.g., hostap, madwifi, ..) and which authentication
363
methods (e.g., EAP-TLS, EAP-PEAP, ..) are included.
365
Following build time configuration options are used to control IEEE
366
802.1X/EAPOL and EAP state machines and all EAP methods. Including
367
TLS, PEAP, or TTLS will require linking wpa_supplicant with OpenSSL
368
library for TLS implementation. Alternatively, GnuTLS or the internal
369
TLSv1 implementation can be used for TLS functionaly.
371
CONFIG_IEEE8021X_EAPOL=y
373
CONFIG_EAP_MSCHAPV2=y
387
Following option can be used to include GSM SIM/USIM interface for GSM/UMTS
388
authentication algorithm (for EAP-SIM/EAP-AKA). This requires pcsc-lite
389
(http://www.linuxnet.com/) for smart card access.
393
Following options can be added to .config to select which driver
394
interfaces are included. Hermes driver interface needs to be downloaded
395
from Agere (see above). CONFIG_WIRELESS_EXTENSION will be used
396
automatically if any of the selected drivers need it.
398
CONFIG_WIRELESS_EXTENSION=y
399
CONFIG_DRIVER_HOSTAP=y
400
CONFIG_DRIVER_HERMES=y
401
CONFIG_DRIVER_MADWIFI=y
402
CONFIG_DRIVER_ATMEL=y
404
CONFIG_DRIVER_RALINK=y
405
CONFIG_DRIVER_NDISWRAPPER=y
406
CONFIG_DRIVER_BROADCOM=y
411
Following example includes all features and driver interfaces that are
412
included in the wpa_supplicant package:
414
CONFIG_DRIVER_HOSTAP=y
415
CONFIG_DRIVER_HERMES=y
416
CONFIG_DRIVER_MADWIFI=y
417
CONFIG_DRIVER_ATMEL=y
419
CONFIG_DRIVER_NDISWRAPPER=y
420
CONFIG_DRIVER_BROADCOM=y
424
CONFIG_WIRELESS_EXTENSION=y
425
CONFIG_IEEE8021X_EAPOL=y
427
CONFIG_EAP_MSCHAPV2=y
442
EAP-PEAP and EAP-TTLS will automatically include configured EAP
443
methods (MD5, OTP, GTC, MSCHAPV2) for inner authentication selection.
446
After you have created a configuration file, you can build
447
wpa_supplicant and wpa_cli with 'make' command. You may then install
448
the binaries to a suitable system directory, e.g., /usr/local/bin.
452
# build wpa_supplicant and wpa_cli
454
# install binaries (this may need root privileges)
455
cp wpa_cli wpa_supplicant /usr/local/bin
458
You will need to make a configuration file, e.g.,
459
/etc/wpa_supplicant.conf, with network configuration for the networks
460
you are going to use. Configuration file section below includes
461
explanation fo the configuration file format and includes various
462
examples. Once the configuration is ready, you can test whether the
463
configuration work by first running wpa_supplicant with following
464
command to start it on foreground with debugging enabled:
466
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d
468
Assuming everything goes fine, you can start using following command
469
to start wpa_supplicant on background without debugging:
471
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
473
Please note that if you included more than one driver interface in the
474
build time configuration (.config), you may need to specify which
475
interface to use by including -D<driver name> option on the command
476
line. See following section for more details on command line options
485
wpa_supplicant [-BddhKLqqtuvwW] [-P<pid file>] [-g<global ctrl>] \
486
-i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
487
[-b<br_ifname> [-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
488
[-p<driver_param>] [-b<br_ifname>] ...]
491
-b = optional bridge interface name
492
-B = run daemon in the background
493
-c = Configuration file
494
-C = ctrl_interface parameter (only used if -c is not)
496
-d = increase debugging verbosity (-dd even more)
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
505
-q = decrease debugging verbosity (-qq even less)
506
-u = enable DBus control interface
508
-w = wait for interface to be added, if needed
509
-W = wait for a control interface monitor before starting
510
-N = start describing new interface
513
hostap = Host AP driver (Intersil Prism2/2.5/3) [default]
514
(this can also be used with Linuxant DriverLoader)
515
hermes = Agere Systems Inc. driver (Hermes-I/Hermes-II)
516
madwifi = MADWIFI 802.11 support (Atheros, etc.)
517
atmel = ATMEL AT76C5XXx (USB, PCMCIA)
518
wext = Linux wireless extensions (generic)
519
ralink = Ralink Client driver
520
ndiswrapper = Linux ndiswrapper
521
broadcom = Broadcom wl.o driver
522
ipw = Intel ipw2100/2200 driver (old; use wext with Linux 2.6.13 or newer)
523
wired = wpa_supplicant wired Ethernet driver
524
bsd = BSD 802.11 support (Atheros, etc.)
525
ndis = Windows NDIS driver
527
In most common cases, wpa_supplicant is started with
529
wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -iwlan0
531
This makes the process fork into background and wait for the wlan0
532
interface if it is not available at startup time.
534
The easiest way to debug problems, and to get debug log for bug
535
reports, is to start wpa_supplicant on foreground with debugging
538
wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d
541
wpa_supplicant can control multiple interfaces (radios) either by
542
running one process for each interface separately or by running just
543
one process and list of options at command line. Each interface is
544
separated with -N argument. As an example, following command would
545
start wpa_supplicant for two interfaces:
548
-c wpa1.conf -i wlan0 -D hostap -N \
549
-c wpa2.conf -i ath0 -D madwifi
552
If the interface is added in a Linux bridge (e.g., br0), the bridge
553
interface needs to be configured to wpa_supplicant in addition to the
556
wpa_supplicant -cw.conf -Dmadwifi -iath0 -bbr0
562
wpa_supplicant is configured using a text file that lists all accepted
563
networks and security policies, including pre-shared keys. See
564
example configuration file, wpa_supplicant.conf, for detailed
565
information about the configuration format and supported fields.
567
Changes to configuration file can be reloaded be sending SIGHUP signal
568
to wpa_supplicant ('killall -HUP wpa_supplicant'). Similarly,
569
reloading can be triggered with 'wpa_cli reconfigure' command.
571
Configuration file can include one or more network blocks, e.g., one
572
for each used SSID. wpa_supplicant will automatically select the best
573
betwork based on the order of network blocks in the configuration
574
file, network security level (WPA/WPA2 is preferred), and signal
577
Example configuration files for some common configurations:
579
1) WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work
582
# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
583
ctrl_interface=/var/run/wpa_supplicant
584
ctrl_interface_group=wheel
586
# home network; allow all valid ciphers
591
psk="very secret passphrase"
594
# work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
602
identity="user@example.com"
603
ca_cert="/etc/cert/ca.pem"
604
client_cert="/etc/cert/user.pem"
605
private_key="/etc/cert/user.prv"
606
private_key_passwd="password"
610
2) WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that use old peaplabel
611
(e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-Series)
613
ctrl_interface=/var/run/wpa_supplicant
614
ctrl_interface_group=wheel
620
identity="user@example.com"
622
ca_cert="/etc/cert/ca.pem"
624
phase2="auth=MSCHAPV2"
628
3) EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the
629
unencrypted use. Real identity is sent only within an encrypted TLS tunnel.
631
ctrl_interface=/var/run/wpa_supplicant
632
ctrl_interface_group=wheel
638
identity="user@example.com"
639
anonymous_identity="anonymous@example.com"
641
ca_cert="/etc/cert/ca.pem"
646
4) IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and
647
broadcast); use EAP-TLS for authentication
649
ctrl_interface=/var/run/wpa_supplicant
650
ctrl_interface_group=wheel
656
identity="user@example.com"
657
ca_cert="/etc/cert/ca.pem"
658
client_cert="/etc/cert/user.pem"
659
private_key="/etc/cert/user.prv"
660
private_key_passwd="password"
665
5) Catch all example that allows more or less all configuration modes. The
666
configuration options are used based on what security policy is used in the
667
selected SSID. This is mostly for testing and is not recommended for normal
670
ctrl_interface=/var/run/wpa_supplicant
671
ctrl_interface_group=wheel
675
key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
677
group=CCMP TKIP WEP104 WEP40
678
psk="very secret passphrase"
680
identity="user@example.com"
682
ca_cert="/etc/cert/ca.pem"
683
client_cert="/etc/cert/user.pem"
684
private_key="/etc/cert/user.prv"
685
private_key_passwd="password"
687
ca_cert2="/etc/cert/ca2.pem"
688
client_cert2="/etc/cer/user.pem"
689
private_key2="/etc/cer/user.prv"
690
private_key2_passwd="password"
694
6) Authentication for wired Ethernet. This can be used with 'wired' interface
695
(-Dwired on command line).
697
ctrl_interface=/var/run/wpa_supplicant
698
ctrl_interface_group=wheel
713
Some EAP authentication methods require use of certificates. EAP-TLS
714
uses both server side and client certificates whereas EAP-PEAP and
715
EAP-TTLS only require the server side certificate. When client
716
certificate is used, a matching private key file has to also be
717
included in configuration. If the private key uses a passphrase, this
718
has to be configured in wpa_supplicant.conf ("private_key_passwd").
720
wpa_supplicant supports X.509 certificates in PEM and DER
721
formats. User certificate and private key can be included in the same
724
If the user certificate and private key is received in PKCS#12/PFX
725
format, they need to be converted to suitable PEM/DER format for
726
wpa_supplicant. This can be done, e.g., with following commands:
728
# convert client certificate and private key to PEM format
729
openssl pkcs12 -in example.pfx -out user.pem -clcerts
730
# convert CA certificate (if included in PFX file) to PEM format
731
openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys
738
wpa_cli is a text-based frontend program for interacting with
739
wpa_supplicant. It is used to query current status, change
740
configuration, trigger events, and request interactive user input.
742
wpa_cli can show the current authentication status, selected security
743
mode, dot11 and dot1x MIBs, etc. In addition, it can configure some
744
variables like EAPOL state machine parameters and trigger events like
745
reassociation and IEEE 802.1X logoff/logon. wpa_cli provides a user
746
interface to request authentication information, like username and
747
password, if these are not included in the configuration. This can be
748
used to implement, e.g., one-time-passwords or generic token card
749
authentication where the authentication is based on a
750
challenge-response that uses an external device for generating the
753
The control interface of wpa_supplicant can be configured to allow
754
non-root user access (ctrl_interface_group in the configuration
755
file). This makes it possible to run wpa_cli with a normal user
758
wpa_cli supports two modes: interactive and command line. Both modes
759
share the same command set and the main difference is in interactive
760
mode providing access to unsolicited messages (event messages,
761
username/password requests).
763
Interactive mode is started when wpa_cli is executed without including
764
the command as a command line parameter. Commands are then entered on
765
the wpa_cli prompt. In command line mode, the same commands are
766
entered as command line arguments for wpa_cli.
769
Interactive authentication parameters request
771
When wpa_supplicant need authentication parameters, like username and
772
password, which are not present in the configuration file, it sends a
773
request message to all attached frontend programs, e.g., wpa_cli in
774
interactive mode. wpa_cli shows these requests with
775
"CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, or
776
OTP (one-time-password). <id> is a unique identifier for the current
777
network. <text> is description of the request. In case of OTP request,
778
it includes the challenge from the authentication server.
780
The reply to these requests can be given with 'identity', 'password',
781
and 'otp' commands. <id> needs to be copied from the the matching
782
request. 'password' and 'otp' commands can be used regardless of
783
whether the request was for PASSWORD or OTP. The main difference
784
between these two commands is that values given with 'password' are
785
remembered as long as wpa_supplicant is running whereas values given
786
with 'otp' are used only once and then forgotten, i.e., wpa_supplicant
787
will ask frontend for a new value for every use. This can be used to
788
implement one-time-password lists and generic token card -based
791
Example request for password and a matching reply:
793
CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
794
> password 1 mysecretpassword
796
Example request for generic token card challenge-response:
798
CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
804
status = get current WPA/EAPOL/EAP status
805
mib = get MIB variables (dot1x, dot11)
806
help = show this usage help
807
interface [ifname] = show interfaces/select interface
808
level <debug level> = change debug level
809
license = show full wpa_cli license
810
logoff = IEEE 802.1X EAPOL state machine logoff
811
logon = IEEE 802.1X EAPOL state machine logon
812
set = set variables (shows list of variables when run without arguments)
813
pmksa = show PMKSA cache
814
reassociate = force reassociation
815
reconfigure = force wpa_supplicant to re-read its configuration file
816
preauthenticate <BSSID> = force preauthentication
817
identity <network id> <identity> = configure identity for an SSID
818
password <network id> <password> = configure password for an SSID
819
pin <network id> <pin> = configure pin for an SSID
820
otp <network id> <password> = configure one-time-password for an SSID
821
passphrase <network id> <passphrase> = configure private key passphrase
823
bssid <network id> <BSSID> = set preferred BSSID for an SSID
824
list_networks = list configured networks
825
select_network <network id> = select a network (disable others)
826
enable_network <network id> = enable a network
827
disable_network <network id> = disable a network
828
add_network = add a network
829
remove_network <network id> = remove a network
830
set_network <network id> <variable> <value> = set network variables (shows
831
list of variables when run without arguments)
832
get_network <network id> <variable> = get network variables
833
save_config = save the current configuration
834
disconnect = disconnect and wait for reassociate command before connecting
835
scan = request new BSS scan
836
scan_results = get latest scan results
837
get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = get capabilies
838
terminate = terminate wpa_supplicant
842
wpa_cli command line options
844
wpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvB] [-a<action file>] \
845
[-P<pid file>] [-g<global ctrl>] [command..]
846
-h = help (show this usage text)
847
-v = shown version information
848
-a = run in daemon mode executing the action file based on events from
850
-B = run a daemon in the background
851
default path: /var/run/wpa_supplicant
852
default interface: first interface found in socket path
855
Using wpa_cli to run external program on connect/disconnect
856
-----------------------------------------------------------
858
wpa_cli can used to run external programs whenever wpa_supplicant
859
connects or disconnects from a network. This can be used, e.g., to
860
update network configuration and/or trigget DHCP client to update IP
863
One wpa_cli process in "action" mode needs to be started for each
864
interface. For example, the following command starts wpa_cli for the
865
default ingterface (-i can be used to select the interface in case of
866
more than one interface being used at the same time):
868
wpa_cli -a/sbin/wpa_action.sh -B
870
The action file (-a option, /sbin/wpa_action.sh in this example) will
871
be executed whenever wpa_supplicant completes authentication (connect
872
event) or detects disconnection). The action script will be called
873
with two command line arguments: interface name and event (CONNECTED
874
or DISCONNECTED). If the action script needs to get more information
875
about the current network, it can use 'wpa_cli status' to query
876
wpa_supplicant for more information.
878
Following example can be used as a simple template for an action
886
if [ "$CMD" == "CONNECTED" ]; then
887
SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
888
# configure network, signal DHCP client, etc.
891
if [ "$CMD" == "DISCONNECTED" ]; then
892
# remove network configuration, if needed
897
Integrating with pcmcia-cs/cardmgr scripts
898
------------------------------------------
900
wpa_supplicant needs to be running when using a wireless network with
901
WPA. It can be started either from system startup scripts or from
902
pcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must be
903
completed before data frames can be exchanged, so wpa_supplicant
904
should be started before DHCP client.
906
Command line option '-w' can be used if wpa_supplicant is started
907
before the wireless LAN interface is present (e.g., before inserting
908
the PC Card) or is not yet up.
910
For example, following small changes to pcmcia-cs scripts can be used
911
to enable WPA support:
913
Add MODE="Managed" and WPA="y" to the network scheme in
914
/etc/pcmcia/wireless.opts.
916
Add the following block to the end of 'start' action handler in
917
/etc/pcmcia/wireless:
919
if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
920
/usr/local/bin/wpa_supplicant -Bw -c/etc/wpa_supplicant.conf \
924
Add the following block to the end of 'stop' action handler (may need
925
to be separated from other actions) in /etc/pcmcia/wireless:
927
if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
928
killall wpa_supplicant
931
This will make cardmgr start wpa_supplicant when the card is plugged
932
in. wpa_supplicant will wait until the interface is set up--either
933
when a static IP address is configured or when DHCP client is
934
started--and will then negotiate keys with the AP.
938
Dynamic interface add and operation without configuration files
939
---------------------------------------------------------------
941
wpa_supplicant can be started without any configuration files or
942
network interfaces. When used in this way, a global (i.e., per
943
wpa_supplicant process) control interface is used to add and remove
944
network interfaces. Each network interface can then be configured
945
through a per-network interface control interface. For example,
946
following commands show how to start wpa_supplicant without any
947
network interfaces and then add a network interface and configure a
950
# Start wpa_supplicant in the background
951
wpa_supplicant -g/var/run/wpa_supplicant-global -B
953
# Add a new interface (wlan0, no configuration file, driver=wext, and
954
# enable control interface)
955
wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan0 \
956
"" wext /var/run/wpa_supplicant
958
# Configure a network using the newly added network interface:
959
wpa_cli -iwlan0 add_network
960
wpa_cli -iwlan0 set_network 0 ssid '"test"'
961
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
962
wpa_cli -iwlan0 set_network 0 psk '"12345678"'
963
wpa_cli -iwlan0 set_network 0 pairwise TKIP
964
wpa_cli -iwlan0 set_network 0 group TKIP
965
wpa_cli -iwlan0 set_network 0 proto WPA
966
wpa_cli -iwlan0 enable_network 0
968
# At this point, the new network interface should start trying to associate
969
# with the WPA-PSK network using SSID test.
971
# Remove network interface
972
wpa_cli -g/var/run/wpa_supplicant-global interface_remove wlan0