Home | History | Annotate | Download | only in wpa_supplicant
      1 WPA Supplicant
      2 ==============
      3 
      4 Copyright (c) 2003-2008, Jouni Malinen <j (a] 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 [-BddfhKLqqtuvwW] [-P<pid file>] [-g<global ctrl>] \
    485         -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
    486         [-b<br_ifname> [-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
    487         [-p<driver_param>] [-b<br_ifname>] ...]
    488 
    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   -f = Log output to default log location (normally /tmp)
    498   -g = global ctrl_interface
    499   -K = include keys (passwords, etc.) in debug output
    500   -t = include timestamp in debug messages
    501   -h = show this help text
    502   -L = show license (GPL and BSD)
    503   -p = driver parameters
    504   -P = PID file
    505   -q = decrease debugging verbosity (-qq even less)
    506   -v = show version
    507   -w = wait for interface to be added, if needed
    508   -W = wait for a control interface monitor before starting
    509   -N = start describing new interface
    510 
    511 drivers:
    512   hostap = Host AP driver (Intersil Prism2/2.5/3) [default]
    513 	(this can also be used with Linuxant DriverLoader)
    514   hermes = Agere Systems Inc. driver (Hermes-I/Hermes-II)
    515   madwifi = MADWIFI 802.11 support (Atheros, etc.)
    516   atmel = ATMEL AT76C5XXx (USB, PCMCIA)
    517   wext = Linux wireless extensions (generic)
    518   ndiswrapper = Linux ndiswrapper
    519   broadcom = Broadcom wl.o driver
    520   ipw = Intel ipw2100/2200 driver (old; use wext with Linux 2.6.13 or newer)
    521   wired = wpa_supplicant wired Ethernet driver
    522   bsd = BSD 802.11 support (Atheros, etc.)
    523   ndis = Windows NDIS driver
    524 
    525 In most common cases, wpa_supplicant is started with
    526 
    527 wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -iwlan0
    528 
    529 This makes the process fork into background and wait for the wlan0
    530 interface if it is not available at startup time.
    531 
    532 The easiest way to debug problems, and to get debug log for bug
    533 reports, is to start wpa_supplicant on foreground with debugging
    534 enabled:
    535 
    536 wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d
    537 
    538 
    539 wpa_supplicant can control multiple interfaces (radios) either by
    540 running one process for each interface separately or by running just
    541 one process and list of options at command line. Each interface is
    542 separated with -N argument. As an example, following command would
    543 start wpa_supplicant for two interfaces:
    544 
    545 wpa_supplicant \
    546 	-c wpa1.conf -i wlan0 -D hostap -N \
    547 	-c wpa2.conf -i ath0 -D madwifi
    548 
    549 
    550 If the interface is added in a Linux bridge (e.g., br0), the bridge
    551 interface needs to be configured to wpa_supplicant in addition to the
    552 main interface:
    553 
    554 wpa_supplicant -cw.conf -Dmadwifi -iath0 -bbr0
    555 
    556 
    557 Configuration file
    558 ------------------
    559 
    560 wpa_supplicant is configured using a text file that lists all accepted
    561 networks and security policies, including pre-shared keys. See
    562 example configuration file, wpa_supplicant.conf, for detailed
    563 information about the configuration format and supported fields.
    564 
    565 Changes to configuration file can be reloaded be sending SIGHUP signal
    566 to wpa_supplicant ('killall -HUP wpa_supplicant'). Similarly,
    567 reloading can be triggered with 'wpa_cli reconfigure' command.
    568 
    569 Configuration file can include one or more network blocks, e.g., one
    570 for each used SSID. wpa_supplicant will automatically select the best
    571 betwork based on the order of network blocks in the configuration
    572 file, network security level (WPA/WPA2 is preferred), and signal
    573 strength.
    574 
    575 Example configuration files for some common configurations:
    576 
    577 1) WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work
    578    network
    579 
    580 # allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
    581 ctrl_interface=/var/run/wpa_supplicant
    582 ctrl_interface_group=wheel
    583 #
    584 # home network; allow all valid ciphers
    585 network={
    586 	ssid="home"
    587 	scan_ssid=1
    588 	key_mgmt=WPA-PSK
    589 	psk="very secret passphrase"
    590 }
    591 #
    592 # work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
    593 network={
    594 	ssid="work"
    595 	scan_ssid=1
    596 	key_mgmt=WPA-EAP
    597 	pairwise=CCMP TKIP
    598 	group=CCMP TKIP
    599 	eap=TLS
    600 	identity="user (a] example.com"
    601 	ca_cert="/etc/cert/ca.pem"
    602 	client_cert="/etc/cert/user.pem"
    603 	private_key="/etc/cert/user.prv"
    604 	private_key_passwd="password"
    605 }
    606 
    607 
    608 2) WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that use old peaplabel
    609    (e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-Series)
    610 
    611 ctrl_interface=/var/run/wpa_supplicant
    612 ctrl_interface_group=wheel
    613 network={
    614 	ssid="example"
    615 	scan_ssid=1
    616 	key_mgmt=WPA-EAP
    617 	eap=PEAP
    618 	identity="user (a] example.com"
    619 	password="foobar"
    620 	ca_cert="/etc/cert/ca.pem"
    621 	phase1="peaplabel=0"
    622 	phase2="auth=MSCHAPV2"
    623 }
    624 
    625 
    626 3) EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the
    627    unencrypted use. Real identity is sent only within an encrypted TLS tunnel.
    628 
    629 ctrl_interface=/var/run/wpa_supplicant
    630 ctrl_interface_group=wheel
    631 network={
    632 	ssid="example"
    633 	scan_ssid=1
    634 	key_mgmt=WPA-EAP
    635 	eap=TTLS
    636 	identity="user (a] example.com"
    637 	anonymous_identity="anonymous (a] example.com"
    638 	password="foobar"
    639 	ca_cert="/etc/cert/ca.pem"
    640 	phase2="auth=MD5"
    641 }
    642 
    643 
    644 4) IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and
    645    broadcast); use EAP-TLS for authentication
    646 
    647 ctrl_interface=/var/run/wpa_supplicant
    648 ctrl_interface_group=wheel
    649 network={
    650 	ssid="1x-test"
    651 	scan_ssid=1
    652 	key_mgmt=IEEE8021X
    653 	eap=TLS
    654 	identity="user (a] example.com"
    655 	ca_cert="/etc/cert/ca.pem"
    656 	client_cert="/etc/cert/user.pem"
    657 	private_key="/etc/cert/user.prv"
    658 	private_key_passwd="password"
    659 	eapol_flags=3
    660 }
    661 
    662 
    663 5) Catch all example that allows more or less all configuration modes. The
    664    configuration options are used based on what security policy is used in the
    665    selected SSID. This is mostly for testing and is not recommended for normal
    666    use.
    667 
    668 ctrl_interface=/var/run/wpa_supplicant
    669 ctrl_interface_group=wheel
    670 network={
    671 	ssid="example"
    672 	scan_ssid=1
    673 	key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
    674 	pairwise=CCMP TKIP
    675 	group=CCMP TKIP WEP104 WEP40
    676 	psk="very secret passphrase"
    677 	eap=TTLS PEAP TLS
    678 	identity="user (a] example.com"
    679 	password="foobar"
    680 	ca_cert="/etc/cert/ca.pem"
    681 	client_cert="/etc/cert/user.pem"
    682 	private_key="/etc/cert/user.prv"
    683 	private_key_passwd="password"
    684 	phase1="peaplabel=0"
    685 	ca_cert2="/etc/cert/ca2.pem"
    686 	client_cert2="/etc/cer/user.pem"
    687 	private_key2="/etc/cer/user.prv"
    688 	private_key2_passwd="password"
    689 }
    690 
    691 
    692 6) Authentication for wired Ethernet. This can be used with 'wired' interface
    693    (-Dwired on command line).
    694 
    695 ctrl_interface=/var/run/wpa_supplicant
    696 ctrl_interface_group=wheel
    697 ap_scan=0
    698 network={
    699 	key_mgmt=IEEE8021X
    700 	eap=MD5
    701 	identity="user"
    702 	password="password"
    703 	eapol_flags=0
    704 }
    705 
    706 
    707 
    708 Certificates
    709 ------------
    710 
    711 Some EAP authentication methods require use of certificates. EAP-TLS
    712 uses both server side and client certificates whereas EAP-PEAP and
    713 EAP-TTLS only require the server side certificate. When client
    714 certificate is used, a matching private key file has to also be
    715 included in configuration. If the private key uses a passphrase, this
    716 has to be configured in wpa_supplicant.conf ("private_key_passwd").
    717 
    718 wpa_supplicant supports X.509 certificates in PEM and DER
    719 formats. User certificate and private key can be included in the same
    720 file.
    721 
    722 If the user certificate and private key is received in PKCS#12/PFX
    723 format, they need to be converted to suitable PEM/DER format for
    724 wpa_supplicant. This can be done, e.g., with following commands:
    725 
    726 # convert client certificate and private key to PEM format
    727 openssl pkcs12 -in example.pfx -out user.pem -clcerts
    728 # convert CA certificate (if included in PFX file) to PEM format
    729 openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys
    730 
    731 
    732 
    733 wpa_cli
    734 -------
    735 
    736 wpa_cli is a text-based frontend program for interacting with
    737 wpa_supplicant. It is used to query current status, change
    738 configuration, trigger events, and request interactive user input.
    739 
    740 wpa_cli can show the current authentication status, selected security
    741 mode, dot11 and dot1x MIBs, etc. In addition, it can configure some
    742 variables like EAPOL state machine parameters and trigger events like
    743 reassociation and IEEE 802.1X logoff/logon. wpa_cli provides a user
    744 interface to request authentication information, like username and
    745 password, if these are not included in the configuration. This can be
    746 used to implement, e.g., one-time-passwords or generic token card
    747 authentication where the authentication is based on a
    748 challenge-response that uses an external device for generating the
    749 response.
    750 
    751 The control interface of wpa_supplicant can be configured to allow
    752 non-root user access (ctrl_interface_group in the configuration
    753 file). This makes it possible to run wpa_cli with a normal user
    754 account.
    755 
    756 wpa_cli supports two modes: interactive and command line. Both modes
    757 share the same command set and the main difference is in interactive
    758 mode providing access to unsolicited messages (event messages,
    759 username/password requests).
    760 
    761 Interactive mode is started when wpa_cli is executed without including
    762 the command as a command line parameter. Commands are then entered on
    763 the wpa_cli prompt. In command line mode, the same commands are
    764 entered as command line arguments for wpa_cli.
    765 
    766 
    767 Interactive authentication parameters request
    768 
    769 When wpa_supplicant need authentication parameters, like username and
    770 password, which are not present in the configuration file, it sends a
    771 request message to all attached frontend programs, e.g., wpa_cli in
    772 interactive mode. wpa_cli shows these requests with
    773 "CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, or
    774 OTP (one-time-password). <id> is a unique identifier for the current
    775 network. <text> is description of the request. In case of OTP request,
    776 it includes the challenge from the authentication server.
    777 
    778 The reply to these requests can be given with 'identity', 'password',
    779 and 'otp' commands. <id> needs to be copied from the the matching
    780 request. 'password' and 'otp' commands can be used regardless of
    781 whether the request was for PASSWORD or OTP. The main difference
    782 between these two commands is that values given with 'password' are
    783 remembered as long as wpa_supplicant is running whereas values given
    784 with 'otp' are used only once and then forgotten, i.e., wpa_supplicant
    785 will ask frontend for a new value for every use. This can be used to
    786 implement one-time-password lists and generic token card -based
    787 authentication.
    788 
    789 Example request for password and a matching reply:
    790 
    791 CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
    792 > password 1 mysecretpassword
    793 
    794 Example request for generic token card challenge-response:
    795 
    796 CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
    797 > otp 2 9876
    798 
    799 
    800 wpa_cli commands
    801 
    802   status = get current WPA/EAPOL/EAP status
    803   mib = get MIB variables (dot1x, dot11)
    804   help = show this usage help
    805   interface [ifname] = show interfaces/select interface
    806   level <debug level> = change debug level
    807   license = show full wpa_cli license
    808   logoff = IEEE 802.1X EAPOL state machine logoff
    809   logon = IEEE 802.1X EAPOL state machine logon
    810   set = set variables (shows list of variables when run without arguments)
    811   pmksa = show PMKSA cache
    812   reassociate = force reassociation
    813   reconfigure = force wpa_supplicant to re-read its configuration file
    814   preauthenticate <BSSID> = force preauthentication
    815   identity <network id> <identity> = configure identity for an SSID
    816   password <network id> <password> = configure password for an SSID
    817   pin <network id> <pin> = configure pin for an SSID
    818   otp <network id> <password> = configure one-time-password for an SSID
    819   passphrase <network id> <passphrase> = configure private key passphrase
    820     for an SSID
    821   bssid <network id> <BSSID> = set preferred BSSID for an SSID
    822   list_networks = list configured networks
    823   select_network <network id> = select a network (disable others)
    824   enable_network <network id> = enable a network
    825   disable_network <network id> = disable a network
    826   add_network = add a network
    827   remove_network <network id> = remove a network
    828   set_network <network id> <variable> <value> = set network variables (shows
    829     list of variables when run without arguments)
    830   get_network <network id> <variable> = get network variables
    831   save_config = save the current configuration
    832   disconnect = disconnect and wait for reassociate command before connecting
    833   scan = request new BSS scan
    834   scan_results = get latest scan results
    835   get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = get capabilies
    836   terminate = terminate wpa_supplicant
    837   quit = exit wpa_cli
    838 
    839 
    840 wpa_cli command line options
    841 
    842 wpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvB] [-a<action file>] \
    843         [-P<pid file>] [-g<global ctrl>]  [command..]
    844   -h = help (show this usage text)
    845   -v = shown version information
    846   -a = run in daemon mode executing the action file based on events from
    847        wpa_supplicant
    848   -B = run a daemon in the background
    849   default path: /var/run/wpa_supplicant
    850   default interface: first interface found in socket path
    851 
    852 
    853 Using wpa_cli to run external program on connect/disconnect
    854 -----------------------------------------------------------
    855 
    856 wpa_cli can used to run external programs whenever wpa_supplicant
    857 connects or disconnects from a network. This can be used, e.g., to
    858 update network configuration and/or trigget DHCP client to update IP
    859 addresses, etc.
    860 
    861 One wpa_cli process in "action" mode needs to be started for each
    862 interface. For example, the following command starts wpa_cli for the
    863 default ingterface (-i can be used to select the interface in case of
    864 more than one interface being used at the same time):
    865 
    866 wpa_cli -a/sbin/wpa_action.sh -B
    867 
    868 The action file (-a option, /sbin/wpa_action.sh in this example) will
    869 be executed whenever wpa_supplicant completes authentication (connect
    870 event) or detects disconnection). The action script will be called
    871 with two command line arguments: interface name and event (CONNECTED
    872 or DISCONNECTED). If the action script needs to get more information
    873 about the current network, it can use 'wpa_cli status' to query
    874 wpa_supplicant for more information.
    875 
    876 Following example can be used as a simple template for an action
    877 script:
    878 
    879 #!/bin/sh
    880 
    881 IFNAME=$1
    882 CMD=$2
    883 
    884 if [ "$CMD" == "CONNECTED" ]; then
    885     SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
    886     # configure network, signal DHCP client, etc.
    887 fi
    888 
    889 if [ "$CMD" == "DISCONNECTED" ]; then
    890     # remove network configuration, if needed
    891 fi
    892 
    893 
    894 
    895 Integrating with pcmcia-cs/cardmgr scripts
    896 ------------------------------------------
    897 
    898 wpa_supplicant needs to be running when using a wireless network with
    899 WPA. It can be started either from system startup scripts or from
    900 pcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must be
    901 completed before data frames can be exchanged, so wpa_supplicant
    902 should be started before DHCP client.
    903 
    904 Command line option '-w' can be used if wpa_supplicant is started
    905 before the wireless LAN interface is present (e.g., before inserting
    906 the PC Card) or is not yet up.
    907 
    908 For example, following small changes to pcmcia-cs scripts can be used
    909 to enable WPA support:
    910 
    911 Add MODE="Managed" and WPA="y" to the network scheme in
    912 /etc/pcmcia/wireless.opts.
    913 
    914 Add the following block to the end of 'start' action handler in
    915 /etc/pcmcia/wireless:
    916 
    917     if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
    918 	/usr/local/bin/wpa_supplicant -Bw -c/etc/wpa_supplicant.conf \
    919 		-i$DEVICE
    920     fi
    921 
    922 Add the following block to the end of 'stop' action handler (may need
    923 to be separated from other actions) in /etc/pcmcia/wireless:
    924 
    925     if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
    926 	killall wpa_supplicant
    927     fi
    928 
    929 This will make cardmgr start wpa_supplicant when the card is plugged
    930 in. wpa_supplicant will wait until the interface is set up--either
    931 when a static IP address is configured or when DHCP client is
    932 started--and will then negotiate keys with the AP.
    933 
    934 
    935 
    936 Dynamic interface add and operation without configuration files
    937 ---------------------------------------------------------------
    938 
    939 wpa_supplicant can be started without any configuration files or
    940 network interfaces. When used in this way, a global (i.e., per
    941 wpa_supplicant process) control interface is used to add and remove
    942 network interfaces. Each network interface can then be configured
    943 through a per-network interface control interface. For example,
    944 following commands show how to start wpa_supplicant without any
    945 network interfaces and then add a network interface and configure a
    946 network (SSID):
    947 
    948 # Start wpa_supplicant in the background
    949 wpa_supplicant -g/var/run/wpa_supplicant-global -B
    950 
    951 # Add a new interface (wlan0, no configuration file, driver=wext, and
    952 # enable control interface)
    953 wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan0 \
    954 	"" wext /var/run/wpa_supplicant
    955 
    956 # Configure a network using the newly added network interface:
    957 wpa_cli -iwlan0 add_network
    958 wpa_cli -iwlan0 set_network 0 ssid '"test"'
    959 wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
    960 wpa_cli -iwlan0 set_network 0 psk '"12345678"'
    961 wpa_cli -iwlan0 set_network 0 pairwise TKIP
    962 wpa_cli -iwlan0 set_network 0 group TKIP
    963 wpa_cli -iwlan0 set_network 0 proto WPA
    964 wpa_cli -iwlan0 enable_network 0
    965 
    966 # At this point, the new network interface should start trying to associate
    967 # with the WPA-PSK network using SSID test.
    968 
    969 # Remove network interface
    970 wpa_cli -g/var/run/wpa_supplicant-global interface_remove wlan0
    971