Home | History | Annotate | only in /external/wpa_supplicant_6/wpa_supplicant
Up to higher level directory
NameDateSize
.config28-Mar-201213.5K
Android.mk28-Mar-201225.8K
blacklist.c28-Mar-20123.3K
blacklist.h28-Mar-2012879
ChangeLog28-Mar-201263.9K
config.c28-Mar-201248.2K
config.h28-Mar-201213.6K
config_file.c28-Mar-201222.1K
config_none.c28-Mar-20121.4K
config_ssid.h28-Mar-20129.7K
config_winreg.c28-Mar-201222.3K
ctrl_iface.c28-Mar-201249K
ctrl_iface.h28-Mar-20125.4K
ctrl_iface_dbus.c28-Mar-201233.4K
ctrl_iface_dbus.h28-Mar-20124.5K
ctrl_iface_dbus_handlers.c28-Mar-201241.2K
ctrl_iface_dbus_handlers.h28-Mar-20123K
ctrl_iface_named_pipe.c28-Mar-201219.9K
ctrl_iface_udp.c28-Mar-201213K
ctrl_iface_unix.c28-Mar-201217.5K
dbus-wpa_supplicant.conf28-Mar-2012695
dbus-wpa_supplicant.service28-Mar-201292
dbus_dict_helpers.c28-Mar-201224.5K
dbus_dict_helpers.h28-Mar-20124.5K
defconfig28-Mar-201213.6K
eap_testing.txt28-Mar-201214.4K
eapol_test.c28-Mar-201230.9K
events.c28-Mar-201231.2K
examples/28-Mar-2012
main.c28-Mar-20126.4K
main_none.c28-Mar-20121K
main_symbian.cpp28-Mar-20121K
main_winmain.c28-Mar-20121.9K
main_winsvc.c28-Mar-201211.4K
Makefile28-Mar-201229.3K
mlme.c28-Mar-201278.9K
mlme.h28-Mar-20123.4K
preauth_test.c28-Mar-20128.8K
README28-Mar-201237.5K
README-WPS28-Mar-20127.1K
scan.c28-Mar-20127.5K
src/28-Mar-2012
tests/28-Mar-2012
todo.txt28-Mar-20125.1K
win_if_list.c28-Mar-20123.9K
wpa_cli.c28-Mar-201248.2K
wpa_gui/29-Mar-2012
wpa_gui-qt4/29-Mar-2012
wpa_passphrase.c28-Mar-20121.5K
wpa_priv.c28-Mar-201227.4K
wpa_supplicant.c28-Mar-201265.6K
wpa_supplicant.conf28-Mar-2012132
wpa_supplicant.conf.orig28-Mar-201231.9K
wpa_supplicant_conf.mk28-Mar-20121.7K
wpa_supplicant_conf.sh28-Mar-2012901
wpa_supplicant_i.h28-Mar-201221.2K
wpas_glue.c28-Mar-201216.7K
wpas_glue.h28-Mar-2012733
wps_supplicant.c28-Mar-201223.8K
wps_supplicant.h28-Mar-20122.5K

README

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

README-WPS

      1 wpa_supplicant and Wi-Fi Protected Setup (WPS)
      2 ==============================================
      3 
      4 This document describes how the WPS implementation in wpa_supplicant
      5 can be configured and how an external component on the client (e.g.,
      6 management GUI) is used to enable WPS enrollment and registrar
      7 registration.
      8 
      9 
     10 Introduction to WPS
     11 -------------------
     12 
     13 Wi-Fi Protected Setup (WPS) is a mechanism for easy configuration of a
     14 wireless network. It allows automated generation of random keys (WPA
     15 passphrase/PSK) and configuration of an access point and client
     16 devices. WPS includes number of methods for setting up connections
     17 with PIN method and push-button configuration (PBC) being the most
     18 commonly deployed options.
     19 
     20 While WPS can enable more home networks to use encryption in the
     21 wireless network, it should be noted that the use of the PIN and
     22 especially PBC mechanisms for authenticating the initial key setup is
     23 not very secure. As such, use of WPS may not be suitable for
     24 environments that require secure network access without chance for
     25 allowing outsiders to gain access during the setup phase.
     26 
     27 WPS uses following terms to describe the entities participating in the
     28 network setup:
     29 - access point: the WLAN access point
     30 - Registrar: a device that control a network and can authorize
     31   addition of new devices); this may be either in the AP ("internal
     32   Registrar") or in an external device, e.g., a laptop, ("external
     33   Registrar")
     34 - Enrollee: a device that is being authorized to use the network
     35 
     36 It should also be noted that the AP and a client device may change
     37 roles (i.e., AP acts as an Enrollee and client device as a Registrar)
     38 when WPS is used to configure the access point.
     39 
     40 
     41 More information about WPS is available from Wi-Fi Alliance:
     42 http://www.wi-fi.org/wifi-protected-setup
     43 
     44 
     45 wpa_supplicant implementation
     46 -----------------------------
     47 
     48 wpa_supplicant includes an optional WPS component that can be used as
     49 an Enrollee to enroll new network credential or as a Registrar to
     50 configure an AP. The current version of wpa_supplicant does not
     51 support operation as an external WLAN Management Registrar for adding
     52 new client devices or configuring the AP over UPnP.
     53 
     54 
     55 wpa_supplicant configuration
     56 ----------------------------
     57 
     58 WPS is an optional component that needs to be enabled in
     59 wpa_supplicant build configuration (.config). Here is an example
     60 configuration that includes WPS support and Linux wireless extensions
     61 -based driver interface:
     62 
     63 CONFIG_DRIVER_WEXT=y
     64 CONFIG_EAP=y
     65 CONFIG_WPS=y
     66 
     67 
     68 WPS needs the Universally Unique IDentifier (UUID; see RFC 4122) for
     69 the device. This is configured in the runtime configuration for
     70 wpa_supplicant (if not set, UUID will be generated based on local MAC
     71 address):
     72 
     73 # example UUID for WPS
     74 uuid=12345678-9abc-def0-1234-56789abcdef0
     75 
     76 The network configuration blocks needed for WPS are added
     77 automatically based on control interface commands, so they do not need
     78 to be added explicitly in the configuration file.
     79 
     80 WPS registration will generate new network blocks for the acquired
     81 credentials. If these are to be stored for future use (after
     82 restarting wpa_supplicant), wpa_supplicant will need to be configured
     83 to allow configuration file updates:
     84 
     85 update_config=1
     86 
     87 
     88 
     89 External operations
     90 -------------------
     91 
     92 WPS requires either a device PIN code (usually, 8-digit number) or a
     93 pushbutton event (for PBC) to allow a new WPS Enrollee to join the
     94 network. wpa_supplicant uses the control interface as an input channel
     95 for these events.
     96 
     97 If the client device has a display, a random PIN has to be generated
     98 for each WPS registration session. wpa_supplicant can do this with a
     99 control interface request, e.g., by calling wpa_cli:
    100 
    101 wpa_cli wps_pin any
    102 
    103 This will return the generated 8-digit PIN which will then need to be
    104 entered at the Registrar to complete WPS registration. At that point,
    105 the client will be enrolled with credentials needed to connect to the
    106 AP to access the network.
    107 
    108 
    109 If the client device does not have a display that could show the
    110 random PIN, a hardcoded PIN that is printed on a label can be
    111 used. wpa_supplicant is notified this with a control interface
    112 request, e.g., by calling wpa_cli:
    113 
    114 wpa_cli wps_pin any 12345670
    115 
    116 This starts the WPS negotiation in the same way as above with the
    117 generated PIN.
    118 
    119 
    120 If the client design wants to support optional WPS PBC mode, this can
    121 be enabled by either a physical button in the client device or a
    122 virtual button in the user interface. The PBC operation requires that
    123 a button is also pressed at the AP/Registrar at about the same time (2
    124 minute window). wpa_supplicant is notified of the local button event
    125 over the control interface, e.g., by calling wpa_cli:
    126 
    127 wpa_cli wps_pbc
    128 
    129 At this point, the AP/Registrar has two minutes to complete WPS
    130 negotiation which will generate a new WPA PSK in the same way as the
    131 PIN method described above.
    132 
    133 
    134 If the client wants to operate in the Registrar role to configure an
    135 AP, wpa_supplicant is notified over the control interface, e.g., with
    136 wpa_cli:
    137 
    138 wpa_cli wps_reg <AP BSSID> <AP PIN>
    139 (example: wpa_cli wps_reg 02:34:56:78:9a:bc 12345670)
    140 
    141 This is currently only used to fetch the current AP settings instead
    142 of actually changing them. The main difference with the wps_pin
    143 command is that wps_reg uses the AP PIN (e.g., from a label on the AP)
    144 instead of a PIN generated at the client.
    145 
    146 
    147 Scanning
    148 --------
    149 
    150 Scan results ('wpa_cli scan_results' or 'wpa_cli bss <idx>') include a
    151 flags field that is used to indicate whether the BSS support WPS. If
    152 the AP support WPS, but has not recently activated a Registrar, [WPS]
    153 flag will be included. If PIN method has been recently selected,
    154 [WPS-PIN] is shown instead. Similarly, [WPS-PBC] is shown if PBC mode
    155 is in progress. GUI programs can use these as triggers for suggesting
    156 a guided WPS configuration to the user. In addition, control interface
    157 monitor events WPS-AP-AVAILABLE{,-PBC,-PIN} can be used to find out if
    158 there are WPS enabled APs in scan results without having to go through
    159 all the details in the GUI. These notification could be used, e.g., to
    160 suggest possible WPS connection to the user.
    161 
    162 
    163 wpa_gui
    164 -------
    165 
    166 wpa_gui-qt4 directory contains a sample GUI that shows an example of
    167 how WPS support can be integrated into the GUI. Its main window has a
    168 WPS tab that guides user through WPS registration with automatic AP
    169 selection. In addition, it shows how WPS can be started manually by
    170 selecting an AP from scan results.
    171 
    172 
    173 Credential processing
    174 ---------------------
    175 
    176 By default, wpa_supplicant processes received credentials and updates
    177 its configuration internally. However, it is possible to
    178 control these operations from external programs, if desired.
    179 
    180 This internal processing can be disabled with wps_cred_processing=1
    181 option. When this is used, an external program is responsible for
    182 processing the credential attributes and updating wpa_supplicant
    183 configuration based on them.
    184 
    185 Following control interface messages are sent out for external programs:
    186 
    187 WPS-CRED-RECEIVED  <hexdump of Credential attribute(s)>
    188 For example:
    189 <2>WPS-CRED-RECEIVED 100e006f10260001011045000c6a6b6d2d7770732d74657374100300020020100f000200081027004030653462303435366332363666653064333961643135353461316634626637313234333761636664623766333939653534663166316230323061643434386235102000060266a0ee1727
    190