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