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