Use 1Mbits/s as beacon sending rate; it seems to fix TX performance issue
[dragonfly.git] / contrib / wpa_supplicant-0.5.8 / README
1 WPA Supplicant
2 ==============
3
4 Copyright (c) 2003-2007, 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-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
107 Supported TLS/crypto libraries:
108 - OpenSSL (default)
109 - GnuTLS
110
111 Internal 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
123 Requirements
124 ------------
125
126 Current 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
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.
207
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,
211         http://tcpdump.org/)
212 - libdnet (tested with v1.4, most versions assumed to work,
213         http://libdnet.sourceforge.net/)
214
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).
221
222
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/)
227 - GnuTLS
228 - internal TLSv1 implementation
229
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
235
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.
244
245 See Building and installing section below for more detailed
246 information about the wpa_supplicant build time configuration.
247
248
249
250 WPA
251 ---
252
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.
260
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).
268
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.
278
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).
285
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).
292
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
299 key changes).
300
301
302
303 IEEE 802.11i / WPA2
304 -------------------
305
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).
313
314
315
316 wpa_supplicant
317 --------------
318
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.
324
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.
329
330 Following 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
348 Building and installing
349 -----------------------
350
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.
358
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.
364
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.
370
371 CONFIG_IEEE8021X_EAPOL=y
372 CONFIG_EAP_MD5=y
373 CONFIG_EAP_MSCHAPV2=y
374 CONFIG_EAP_TLS=y
375 CONFIG_EAP_PEAP=y
376 CONFIG_EAP_TTLS=y
377 CONFIG_EAP_GTC=y
378 CONFIG_EAP_OTP=y
379 CONFIG_EAP_SIM=y
380 CONFIG_EAP_AKA=y
381 CONFIG_EAP_PSK=y
382 CONFIG_EAP_SAKE=y
383 CONFIG_EAP_GPSK=y
384 CONFIG_EAP_PAX=y
385 CONFIG_EAP_LEAP=y
386
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.
390
391 CONFIG_PCSC=y
392
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.
397
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
403 CONFIG_DRIVER_WEXT=y
404 CONFIG_DRIVER_NDISWRAPPER=y
405 CONFIG_DRIVER_BROADCOM=y
406 CONFIG_DRIVER_IPW=y
407 CONFIG_DRIVER_BSD=y
408 CONFIG_DRIVER_NDIS=y
409
410 Following example includes all features and driver interfaces that are
411 included in the wpa_supplicant package:
412
413 CONFIG_DRIVER_HOSTAP=y
414 CONFIG_DRIVER_HERMES=y
415 CONFIG_DRIVER_MADWIFI=y
416 CONFIG_DRIVER_ATMEL=y
417 CONFIG_DRIVER_WEXT=y
418 CONFIG_DRIVER_NDISWRAPPER=y
419 CONFIG_DRIVER_BROADCOM=y
420 CONFIG_DRIVER_IPW=y
421 CONFIG_DRIVER_BSD=y
422 CONFIG_DRIVER_NDIS=y
423 CONFIG_WIRELESS_EXTENSION=y
424 CONFIG_IEEE8021X_EAPOL=y
425 CONFIG_EAP_MD5=y
426 CONFIG_EAP_MSCHAPV2=y
427 CONFIG_EAP_TLS=y
428 CONFIG_EAP_PEAP=y
429 CONFIG_EAP_TTLS=y
430 CONFIG_EAP_GTC=y
431 CONFIG_EAP_OTP=y
432 CONFIG_EAP_SIM=y
433 CONFIG_EAP_AKA=y
434 CONFIG_EAP_PSK=y
435 CONFIG_EAP_SAKE=y
436 CONFIG_EAP_GPSK=y
437 CONFIG_EAP_PAX=y
438 CONFIG_EAP_LEAP=y
439 CONFIG_PCSC=y
440
441 EAP-PEAP and EAP-TTLS will automatically include configured EAP
442 methods (MD5, OTP, GTC, MSCHAPV2) for inner authentication selection.
443
444
445 After you have created a configuration file, you can build
446 wpa_supplicant and wpa_cli with 'make' command. You may then install
447 the binaries to a suitable system directory, e.g., /usr/local/bin.
448
449 Example commands:
450
451 # build wpa_supplicant and wpa_cli
452 make
453 # install binaries (this may need root privileges)
454 cp wpa_cli wpa_supplicant /usr/local/bin
455
456
457 You will need to make a configuration file, e.g.,
458 /etc/wpa_supplicant.conf, with network configuration for the networks
459 you are going to use. Configuration file section below includes
460 explanation fo the configuration file format and includes various
461 examples. Once the configuration is ready, you can test whether the
462 configuration work by first running wpa_supplicant with following
463 command to start it on foreground with debugging enabled:
464
465 wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d
466
467 Assuming everything goes fine, you can start using following command
468 to start wpa_supplicant on background without debugging:
469
470 wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
471
472 Please note that if you included more than one driver interface in the
473 build time configuration (.config), you may need to specify which
474 interface to use by including -D<driver name> option on the command
475 line. See following section for more details on command line options
476 for wpa_supplicant.
477
478
479
480 Command line options
481 --------------------
482
483 usage:
484   wpa_supplicant [-BddehLqqvwW] [-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
489 options:
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   -g = global ctrl_interface
498   -K = include keys (passwords, etc.) in debug output
499   -t = include timestamp in debug messages
500   -h = show this help text
501   -L = show license (GPL and BSD)
502   -p = driver parameters
503   -P = PID file
504   -q = decrease debugging verbosity (-qq even less)
505   -v = show version
506   -w = wait for interface to be added, if needed
507   -W = wait for a control interface monitor before starting
508   -N = start describing new interface
509
510 drivers:
511   hostap = Host AP driver (Intersil Prism2/2.5/3) [default]
512         (this can also be used with Linuxant DriverLoader)
513   hermes = Agere Systems Inc. driver (Hermes-I/Hermes-II)
514   madwifi = MADWIFI 802.11 support (Atheros, etc.)
515   atmel = ATMEL AT76C5XXx (USB, PCMCIA)
516   wext = Linux wireless extensions (generic)
517   ndiswrapper = Linux ndiswrapper
518   broadcom = Broadcom wl.o driver
519   ipw = Intel ipw2100/2200 driver (old; use wext with Linux 2.6.13 or newer)
520   wired = wpa_supplicant wired Ethernet driver
521   bsd = BSD 802.11 support (Atheros, etc.)
522   ndis = Windows NDIS driver
523
524 In most common cases, wpa_supplicant is started with
525
526 wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -iwlan0
527
528 This makes the process fork into background and wait for the wlan0
529 interface if it is not available at startup time.
530
531 The easiest way to debug problems, and to get debug log for bug
532 reports, is to start wpa_supplicant on foreground with debugging
533 enabled:
534
535 wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d
536
537
538 wpa_supplicant can control multiple interfaces (radios) either by
539 running one process for each interface separately or by running just
540 one process and list of options at command line. Each interface is
541 separated with -N argument. As an example, following command would
542 start wpa_supplicant for two interfaces:
543
544 wpa_supplicant \
545         -c wpa1.conf -i wlan0 -D hostap -N \
546         -c wpa2.conf -i ath0 -D madwifi
547
548
549 If the interface is added in a Linux bridge (e.g., br0), the bridge
550 interface needs to be configured to wpa_supplicant in addition to the
551 main interface:
552
553 wpa_supplicant -cw.conf -Dmadwifi -iath0 -bbr0
554
555
556 Configuration file
557 ------------------
558
559 wpa_supplicant is configured using a text file that lists all accepted
560 networks and security policies, including pre-shared keys. See
561 example configuration file, wpa_supplicant.conf, for detailed
562 information about the configuration format and supported fields.
563
564 Changes to configuration file can be reloaded be sending SIGHUP signal
565 to wpa_supplicant ('killall -HUP wpa_supplicant'). Similarly,
566 reloading can be triggered with 'wpa_cli reconfigure' command.
567
568 Configuration file can include one or more network blocks, e.g., one
569 for each used SSID. wpa_supplicant will automatically select the best
570 betwork based on the order of network blocks in the configuration
571 file, network security level (WPA/WPA2 is preferred), and signal
572 strength.
573
574 Example configuration files for some common configurations:
575
576 1) WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work
577    network
578
579 # allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
580 ctrl_interface=/var/run/wpa_supplicant
581 ctrl_interface_group=wheel
582 #
583 # home network; allow all valid ciphers
584 network={
585         ssid="home"
586         scan_ssid=1
587         key_mgmt=WPA-PSK
588         psk="very secret passphrase"
589 }
590 #
591 # work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
592 network={
593         ssid="work"
594         scan_ssid=1
595         key_mgmt=WPA-EAP
596         pairwise=CCMP TKIP
597         group=CCMP TKIP
598         eap=TLS
599         identity="user@example.com"
600         ca_cert="/etc/cert/ca.pem"
601         client_cert="/etc/cert/user.pem"
602         private_key="/etc/cert/user.prv"
603         private_key_passwd="password"
604 }
605
606
607 2) WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that use old peaplabel
608    (e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-Series)
609
610 ctrl_interface=/var/run/wpa_supplicant
611 ctrl_interface_group=wheel
612 network={
613         ssid="example"
614         scan_ssid=1
615         key_mgmt=WPA-EAP
616         eap=PEAP
617         identity="user@example.com"
618         password="foobar"
619         ca_cert="/etc/cert/ca.pem"
620         phase1="peaplabel=0"
621         phase2="auth=MSCHAPV2"
622 }
623
624
625 3) EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the
626    unencrypted use. Real identity is sent only within an encrypted TLS tunnel.
627
628 ctrl_interface=/var/run/wpa_supplicant
629 ctrl_interface_group=wheel
630 network={
631         ssid="example"
632         scan_ssid=1
633         key_mgmt=WPA-EAP
634         eap=TTLS
635         identity="user@example.com"
636         anonymous_identity="anonymous@example.com"
637         password="foobar"
638         ca_cert="/etc/cert/ca.pem"
639         phase2="auth=MD5"
640 }
641
642
643 4) IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and
644    broadcast); use EAP-TLS for authentication
645
646 ctrl_interface=/var/run/wpa_supplicant
647 ctrl_interface_group=wheel
648 network={
649         ssid="1x-test"
650         scan_ssid=1
651         key_mgmt=IEEE8021X
652         eap=TLS
653         identity="user@example.com"
654         ca_cert="/etc/cert/ca.pem"
655         client_cert="/etc/cert/user.pem"
656         private_key="/etc/cert/user.prv"
657         private_key_passwd="password"
658         eapol_flags=3
659 }
660
661
662 5) Catch all example that allows more or less all configuration modes. The
663    configuration options are used based on what security policy is used in the
664    selected SSID. This is mostly for testing and is not recommended for normal
665    use.
666
667 ctrl_interface=/var/run/wpa_supplicant
668 ctrl_interface_group=wheel
669 network={
670         ssid="example"
671         scan_ssid=1
672         key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
673         pairwise=CCMP TKIP
674         group=CCMP TKIP WEP104 WEP40
675         psk="very secret passphrase"
676         eap=TTLS PEAP TLS
677         identity="user@example.com"
678         password="foobar"
679         ca_cert="/etc/cert/ca.pem"
680         client_cert="/etc/cert/user.pem"
681         private_key="/etc/cert/user.prv"
682         private_key_passwd="password"
683         phase1="peaplabel=0"
684         ca_cert2="/etc/cert/ca2.pem"
685         client_cert2="/etc/cer/user.pem"
686         private_key2="/etc/cer/user.prv"
687         private_key2_passwd="password"
688 }
689
690
691 6) Authentication for wired Ethernet. This can be used with 'wired' interface
692    (-Dwired on command line).
693
694 ctrl_interface=/var/run/wpa_supplicant
695 ctrl_interface_group=wheel
696 ap_scan=0
697 network={
698         key_mgmt=IEEE8021X
699         eap=MD5
700         identity="user"
701         password="password"
702         eapol_flags=0
703 }
704
705
706
707 Certificates
708 ------------
709
710 Some EAP authentication methods require use of certificates. EAP-TLS
711 uses both server side and client certificates whereas EAP-PEAP and
712 EAP-TTLS only require the server side certificate. When client
713 certificate is used, a matching private key file has to also be
714 included in configuration. If the private key uses a passphrase, this
715 has to be configured in wpa_supplicant.conf ("private_key_passwd").
716
717 wpa_supplicant supports X.509 certificates in PEM and DER
718 formats. User certificate and private key can be included in the same
719 file.
720
721 If the user certificate and private key is received in PKCS#12/PFX
722 format, they need to be converted to suitable PEM/DER format for
723 wpa_supplicant. This can be done, e.g., with following commands:
724
725 # convert client certificate and private key to PEM format
726 openssl pkcs12 -in example.pfx -out user.pem -clcerts
727 # convert CA certificate (if included in PFX file) to PEM format
728 openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys
729
730
731
732 wpa_cli
733 -------
734
735 wpa_cli is a text-based frontend program for interacting with
736 wpa_supplicant. It is used to query current status, change
737 configuration, trigger events, and request interactive user input.
738
739 wpa_cli can show the current authentication status, selected security
740 mode, dot11 and dot1x MIBs, etc. In addition, it can configure some
741 variables like EAPOL state machine parameters and trigger events like
742 reassociation and IEEE 802.1X logoff/logon. wpa_cli provides a user
743 interface to request authentication information, like username and
744 password, if these are not included in the configuration. This can be
745 used to implement, e.g., one-time-passwords or generic token card
746 authentication where the authentication is based on a
747 challenge-response that uses an external device for generating the
748 response.
749
750 The control interface of wpa_supplicant can be configured to allow
751 non-root user access (ctrl_interface_group in the configuration
752 file). This makes it possible to run wpa_cli with a normal user
753 account.
754
755 wpa_cli supports two modes: interactive and command line. Both modes
756 share the same command set and the main difference is in interactive
757 mode providing access to unsolicited messages (event messages,
758 username/password requests).
759
760 Interactive mode is started when wpa_cli is executed without including
761 the command as a command line parameter. Commands are then entered on
762 the wpa_cli prompt. In command line mode, the same commands are
763 entered as command line arguments for wpa_cli.
764
765
766 Interactive authentication parameters request
767
768 When wpa_supplicant need authentication parameters, like username and
769 password, which are not present in the configuration file, it sends a
770 request message to all attached frontend programs, e.g., wpa_cli in
771 interactive mode. wpa_cli shows these requests with
772 "CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, or
773 OTP (one-time-password). <id> is a unique identifier for the current
774 network. <text> is description of the request. In case of OTP request,
775 it includes the challenge from the authentication server.
776
777 The reply to these requests can be given with 'identity', 'password',
778 and 'otp' commands. <id> needs to be copied from the the matching
779 request. 'password' and 'otp' commands can be used regardless of
780 whether the request was for PASSWORD or OTP. The main difference
781 between these two commands is that values given with 'password' are
782 remembered as long as wpa_supplicant is running whereas values given
783 with 'otp' are used only once and then forgotten, i.e., wpa_supplicant
784 will ask frontend for a new value for every use. This can be used to
785 implement one-time-password lists and generic token card -based
786 authentication.
787
788 Example request for password and a matching reply:
789
790 CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
791 > password 1 mysecretpassword
792
793 Example request for generic token card challenge-response:
794
795 CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
796 > otp 2 9876
797
798
799 wpa_cli commands
800
801   status = get current WPA/EAPOL/EAP status
802   mib = get MIB variables (dot1x, dot11)
803   help = show this usage help
804   interface [ifname] = show interfaces/select interface
805   level <debug level> = change debug level
806   license = show full wpa_cli license
807   logoff = IEEE 802.1X EAPOL state machine logoff
808   logon = IEEE 802.1X EAPOL state machine logon
809   set = set variables (shows list of variables when run without arguments)
810   pmksa = show PMKSA cache
811   reassociate = force reassociation
812   reconfigure = force wpa_supplicant to re-read its configuration file
813   preauthenticate <BSSID> = force preauthentication
814   identity <network id> <identity> = configure identity for an SSID
815   password <network id> <password> = configure password for an SSID
816   pin <network id> <pin> = configure pin for an SSID
817   otp <network id> <password> = configure one-time-password for an SSID
818   passphrase <network id> <passphrase> = configure private key passphrase
819     for an SSID
820   bssid <network id> <BSSID> = set preferred BSSID for an SSID
821   list_networks = list configured networks
822   select_network <network id> = select a network (disable others)
823   enable_network <network id> = enable a network
824   disable_network <network id> = disable a network
825   add_network = add a network
826   remove_network <network id> = remove a network
827   set_network <network id> <variable> <value> = set network variables (shows
828     list of variables when run without arguments)
829   get_network <network id> <variable> = get network variables
830   save_config = save the current configuration
831   disconnect = disconnect and wait for reassociate command before connecting
832   scan = request new BSS scan
833   scan_results = get latest scan results
834   get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = get capabilies
835   terminate = terminate wpa_supplicant
836   quit = exit wpa_cli
837
838
839 wpa_cli command line options
840
841 wpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvB] [-a<action file>] \
842         [-P<pid file>] [-g<global ctrl>]  [command..]
843   -h = help (show this usage text)
844   -v = shown version information
845   -a = run in daemon mode executing the action file based on events from
846        wpa_supplicant
847   -B = run a daemon in the background
848   default path: /var/run/wpa_supplicant
849   default interface: first interface found in socket path
850
851
852 Using wpa_cli to run external program on connect/disconnect
853 -----------------------------------------------------------
854
855 wpa_cli can used to run external programs whenever wpa_supplicant
856 connects or disconnects from a network. This can be used, e.g., to
857 update network configuration and/or trigget DHCP client to update IP
858 addresses, etc.
859
860 One wpa_cli process in "action" mode needs to be started for each
861 interface. For example, the following command starts wpa_cli for the
862 default ingterface (-i can be used to select the interface in case of
863 more than one interface being used at the same time):
864
865 wpa_cli -a/sbin/wpa_action.sh -B
866
867 The action file (-a option, /sbin/wpa_action.sh in this example) will
868 be executed whenever wpa_supplicant completes authentication (connect
869 event) or detects disconnection). The action script will be called
870 with two command line arguments: interface name and event (CONNECTED
871 or DISCONNECTED). If the action script needs to get more information
872 about the current network, it can use 'wpa_cli status' to query
873 wpa_supplicant for more information.
874
875 Following example can be used as a simple template for an action
876 script:
877
878 #!/bin/sh
879
880 IFNAME=$1
881 CMD=$2
882
883 if [ "$CMD" == "CONNECTED" ]; then
884     SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
885     # configure network, signal DHCP client, etc.
886 fi
887
888 if [ "$CMD" == "DISCONNECTED" ]; then
889     # remove network configuration, if needed
890 fi
891
892
893
894 Integrating with pcmcia-cs/cardmgr scripts
895 ------------------------------------------
896
897 wpa_supplicant needs to be running when using a wireless network with
898 WPA. It can be started either from system startup scripts or from
899 pcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must be
900 completed before data frames can be exchanged, so wpa_supplicant
901 should be started before DHCP client.
902
903 Command line option '-w' can be used if wpa_supplicant is started
904 before the wireless LAN interface is present (e.g., before inserting
905 the PC Card) or is not yet up.
906
907 For example, following small changes to pcmcia-cs scripts can be used
908 to enable WPA support:
909
910 Add MODE="Managed" and WPA="y" to the network scheme in
911 /etc/pcmcia/wireless.opts.
912
913 Add the following block to the end of 'start' action handler in
914 /etc/pcmcia/wireless:
915
916     if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
917         /usr/local/bin/wpa_supplicant -Bw -c/etc/wpa_supplicant.conf \
918                 -i$DEVICE
919     fi
920
921 Add the following block to the end of 'stop' action handler (may need
922 to be separated from other actions) in /etc/pcmcia/wireless:
923
924     if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
925         killall wpa_supplicant
926     fi
927
928 This will make cardmgr start wpa_supplicant when the card is plugged
929 in. wpa_supplicant will wait until the interface is set up--either
930 when a static IP address is configured or when DHCP client is
931 started--and will then negotiate keys with the AP.
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