README 38 KB

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