README 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032
  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).
  324. CONFIG_DRIVER_HOSTAP=y
  325. CONFIG_DRIVER_HERMES=y
  326. CONFIG_DRIVER_MADWIFI=y
  327. CONFIG_DRIVER_ATMEL=y
  328. CONFIG_DRIVER_WEXT=y
  329. CONFIG_DRIVER_RALINK=y
  330. CONFIG_DRIVER_NDISWRAPPER=y
  331. CONFIG_DRIVER_BROADCOM=y
  332. CONFIG_DRIVER_IPW=y
  333. CONFIG_DRIVER_BSD=y
  334. CONFIG_DRIVER_NDIS=y
  335. Following example includes all features and driver interfaces that are
  336. included in the wpa_supplicant package:
  337. CONFIG_DRIVER_HOSTAP=y
  338. CONFIG_DRIVER_HERMES=y
  339. CONFIG_DRIVER_MADWIFI=y
  340. CONFIG_DRIVER_ATMEL=y
  341. CONFIG_DRIVER_WEXT=y
  342. CONFIG_DRIVER_NDISWRAPPER=y
  343. CONFIG_DRIVER_BROADCOM=y
  344. CONFIG_DRIVER_IPW=y
  345. CONFIG_DRIVER_BSD=y
  346. CONFIG_DRIVER_NDIS=y
  347. CONFIG_IEEE8021X_EAPOL=y
  348. CONFIG_EAP_MD5=y
  349. CONFIG_EAP_MSCHAPV2=y
  350. CONFIG_EAP_TLS=y
  351. CONFIG_EAP_PEAP=y
  352. CONFIG_EAP_TTLS=y
  353. CONFIG_EAP_GTC=y
  354. CONFIG_EAP_OTP=y
  355. CONFIG_EAP_SIM=y
  356. CONFIG_EAP_AKA=y
  357. CONFIG_EAP_PSK=y
  358. CONFIG_EAP_SAKE=y
  359. CONFIG_EAP_GPSK=y
  360. CONFIG_EAP_PAX=y
  361. CONFIG_EAP_LEAP=y
  362. CONFIG_EAP_IKEV2=y
  363. CONFIG_PCSC=y
  364. EAP-PEAP and EAP-TTLS will automatically include configured EAP
  365. methods (MD5, OTP, GTC, MSCHAPV2) for inner authentication selection.
  366. After you have created a configuration file, you can build
  367. wpa_supplicant and wpa_cli with 'make' command. You may then install
  368. the binaries to a suitable system directory, e.g., /usr/local/bin.
  369. Example commands:
  370. # build wpa_supplicant and wpa_cli
  371. make
  372. # install binaries (this may need root privileges)
  373. cp wpa_cli wpa_supplicant /usr/local/bin
  374. You will need to make a configuration file, e.g.,
  375. /etc/wpa_supplicant.conf, with network configuration for the networks
  376. you are going to use. Configuration file section below includes
  377. explanation fo the configuration file format and includes various
  378. examples. Once the configuration is ready, you can test whether the
  379. configuration work by first running wpa_supplicant with following
  380. command to start it on foreground with debugging enabled:
  381. wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d
  382. Assuming everything goes fine, you can start using following command
  383. to start wpa_supplicant on background without debugging:
  384. wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
  385. Please note that if you included more than one driver interface in the
  386. build time configuration (.config), you may need to specify which
  387. interface to use by including -D<driver name> option on the command
  388. line. See following section for more details on command line options
  389. for wpa_supplicant.
  390. Command line options
  391. --------------------
  392. usage:
  393. wpa_supplicant [-BddfhKLqqtuvwW] [-P<pid file>] [-g<global ctrl>] \
  394. -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
  395. [-b<br_ifname> [-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
  396. [-p<driver_param>] [-b<br_ifname>] ...]
  397. options:
  398. -b = optional bridge interface name
  399. -B = run daemon in the background
  400. -c = Configuration file
  401. -C = ctrl_interface parameter (only used if -c is not)
  402. -i = interface name
  403. -d = increase debugging verbosity (-dd even more)
  404. -D = driver name (can be multiple drivers: nl80211,wext)
  405. -f = Log output to default log location (normally /tmp)
  406. -g = global ctrl_interface
  407. -K = include keys (passwords, etc.) in debug output
  408. -t = include timestamp in debug messages
  409. -h = show this help text
  410. -L = show license (GPL and BSD)
  411. -p = driver parameters
  412. -P = PID file
  413. -q = decrease debugging verbosity (-qq even less)
  414. -u = enable DBus control interface
  415. -v = show version
  416. -w = wait for interface to be added, if needed
  417. -W = wait for a control interface monitor before starting
  418. -N = start describing new interface
  419. drivers:
  420. hostap = Host AP driver (Intersil Prism2/2.5/3) [default]
  421. (this can also be used with Linuxant DriverLoader)
  422. hermes = Agere Systems Inc. driver (Hermes-I/Hermes-II)
  423. madwifi = MADWIFI 802.11 support (Atheros, etc.) (deprecated; use wext)
  424. atmel = ATMEL AT76C5XXx (USB, PCMCIA)
  425. wext = Linux wireless extensions (generic)
  426. ralink = Ralink Client driver
  427. ndiswrapper = Linux ndiswrapper (deprecated; use wext)
  428. broadcom = Broadcom wl.o driver
  429. ipw = Intel ipw2100/2200 driver (old; use wext with Linux 2.6.13 or newer)
  430. wired = wpa_supplicant wired Ethernet driver
  431. roboswitch = wpa_supplicant Broadcom switch driver
  432. bsd = BSD 802.11 support (Atheros, etc.)
  433. ndis = Windows NDIS driver
  434. In most common cases, wpa_supplicant is started with
  435. wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0
  436. This makes the process fork into background.
  437. The easiest way to debug problems, and to get debug log for bug
  438. reports, is to start wpa_supplicant on foreground with debugging
  439. enabled:
  440. wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d
  441. If the specific driver wrapper is not known beforehand, it is possible
  442. to specify multiple comma separated driver wrappers on the command
  443. line. wpa_supplicant will use the first driver wrapper that is able to
  444. initialize the interface.
  445. wpa_supplicant -Dnl80211,wext -c/etc/wpa_supplicant.conf -iwlan0
  446. wpa_supplicant can control multiple interfaces (radios) either by
  447. running one process for each interface separately or by running just
  448. one process and list of options at command line. Each interface is
  449. separated with -N argument. As an example, following command would
  450. start wpa_supplicant for two interfaces:
  451. wpa_supplicant \
  452. -c wpa1.conf -i wlan0 -D hostap -N \
  453. -c wpa2.conf -i ath0 -D madwifi
  454. If the interface is added in a Linux bridge (e.g., br0), the bridge
  455. interface needs to be configured to wpa_supplicant in addition to the
  456. main interface:
  457. wpa_supplicant -cw.conf -Dmadwifi -iath0 -bbr0
  458. Configuration file
  459. ------------------
  460. wpa_supplicant is configured using a text file that lists all accepted
  461. networks and security policies, including pre-shared keys. See
  462. example configuration file, wpa_supplicant.conf, for detailed
  463. information about the configuration format and supported fields.
  464. Changes to configuration file can be reloaded be sending SIGHUP signal
  465. to wpa_supplicant ('killall -HUP wpa_supplicant'). Similarly,
  466. reloading can be triggered with 'wpa_cli reconfigure' command.
  467. Configuration file can include one or more network blocks, e.g., one
  468. for each used SSID. wpa_supplicant will automatically select the best
  469. betwork based on the order of network blocks in the configuration
  470. file, network security level (WPA/WPA2 is preferred), and signal
  471. strength.
  472. Example configuration files for some common configurations:
  473. 1) WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work
  474. network
  475. # allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
  476. ctrl_interface=/var/run/wpa_supplicant
  477. ctrl_interface_group=wheel
  478. #
  479. # home network; allow all valid ciphers
  480. network={
  481. ssid="home"
  482. scan_ssid=1
  483. key_mgmt=WPA-PSK
  484. psk="very secret passphrase"
  485. }
  486. #
  487. # work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
  488. network={
  489. ssid="work"
  490. scan_ssid=1
  491. key_mgmt=WPA-EAP
  492. pairwise=CCMP TKIP
  493. group=CCMP TKIP
  494. eap=TLS
  495. identity="user@example.com"
  496. ca_cert="/etc/cert/ca.pem"
  497. client_cert="/etc/cert/user.pem"
  498. private_key="/etc/cert/user.prv"
  499. private_key_passwd="password"
  500. }
  501. 2) WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that use old peaplabel
  502. (e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-Series)
  503. ctrl_interface=/var/run/wpa_supplicant
  504. ctrl_interface_group=wheel
  505. network={
  506. ssid="example"
  507. scan_ssid=1
  508. key_mgmt=WPA-EAP
  509. eap=PEAP
  510. identity="user@example.com"
  511. password="foobar"
  512. ca_cert="/etc/cert/ca.pem"
  513. phase1="peaplabel=0"
  514. phase2="auth=MSCHAPV2"
  515. }
  516. 3) EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the
  517. unencrypted use. Real identity is sent only within an encrypted TLS tunnel.
  518. ctrl_interface=/var/run/wpa_supplicant
  519. ctrl_interface_group=wheel
  520. network={
  521. ssid="example"
  522. scan_ssid=1
  523. key_mgmt=WPA-EAP
  524. eap=TTLS
  525. identity="user@example.com"
  526. anonymous_identity="anonymous@example.com"
  527. password="foobar"
  528. ca_cert="/etc/cert/ca.pem"
  529. phase2="auth=MD5"
  530. }
  531. 4) IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and
  532. broadcast); use EAP-TLS for authentication
  533. ctrl_interface=/var/run/wpa_supplicant
  534. ctrl_interface_group=wheel
  535. network={
  536. ssid="1x-test"
  537. scan_ssid=1
  538. key_mgmt=IEEE8021X
  539. eap=TLS
  540. identity="user@example.com"
  541. ca_cert="/etc/cert/ca.pem"
  542. client_cert="/etc/cert/user.pem"
  543. private_key="/etc/cert/user.prv"
  544. private_key_passwd="password"
  545. eapol_flags=3
  546. }
  547. 5) Catch all example that allows more or less all configuration modes. The
  548. configuration options are used based on what security policy is used in the
  549. selected SSID. This is mostly for testing and is not recommended for normal
  550. use.
  551. ctrl_interface=/var/run/wpa_supplicant
  552. ctrl_interface_group=wheel
  553. network={
  554. ssid="example"
  555. scan_ssid=1
  556. key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
  557. pairwise=CCMP TKIP
  558. group=CCMP TKIP WEP104 WEP40
  559. psk="very secret passphrase"
  560. eap=TTLS PEAP TLS
  561. identity="user@example.com"
  562. password="foobar"
  563. ca_cert="/etc/cert/ca.pem"
  564. client_cert="/etc/cert/user.pem"
  565. private_key="/etc/cert/user.prv"
  566. private_key_passwd="password"
  567. phase1="peaplabel=0"
  568. ca_cert2="/etc/cert/ca2.pem"
  569. client_cert2="/etc/cer/user.pem"
  570. private_key2="/etc/cer/user.prv"
  571. private_key2_passwd="password"
  572. }
  573. 6) Authentication for wired Ethernet. This can be used with 'wired' or
  574. 'roboswitch' interface (-Dwired or -Droboswitch on command line).
  575. ctrl_interface=/var/run/wpa_supplicant
  576. ctrl_interface_group=wheel
  577. ap_scan=0
  578. network={
  579. key_mgmt=IEEE8021X
  580. eap=MD5
  581. identity="user"
  582. password="password"
  583. eapol_flags=0
  584. }
  585. Certificates
  586. ------------
  587. Some EAP authentication methods require use of certificates. EAP-TLS
  588. uses both server side and client certificates whereas EAP-PEAP and
  589. EAP-TTLS only require the server side certificate. When client
  590. certificate is used, a matching private key file has to also be
  591. included in configuration. If the private key uses a passphrase, this
  592. has to be configured in wpa_supplicant.conf ("private_key_passwd").
  593. wpa_supplicant supports X.509 certificates in PEM and DER
  594. formats. User certificate and private key can be included in the same
  595. file.
  596. If the user certificate and private key is received in PKCS#12/PFX
  597. format, they need to be converted to suitable PEM/DER format for
  598. wpa_supplicant. This can be done, e.g., with following commands:
  599. # convert client certificate and private key to PEM format
  600. openssl pkcs12 -in example.pfx -out user.pem -clcerts
  601. # convert CA certificate (if included in PFX file) to PEM format
  602. openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys
  603. wpa_cli
  604. -------
  605. wpa_cli is a text-based frontend program for interacting with
  606. wpa_supplicant. It is used to query current status, change
  607. configuration, trigger events, and request interactive user input.
  608. wpa_cli can show the current authentication status, selected security
  609. mode, dot11 and dot1x MIBs, etc. In addition, it can configure some
  610. variables like EAPOL state machine parameters and trigger events like
  611. reassociation and IEEE 802.1X logoff/logon. wpa_cli provides a user
  612. interface to request authentication information, like username and
  613. password, if these are not included in the configuration. This can be
  614. used to implement, e.g., one-time-passwords or generic token card
  615. authentication where the authentication is based on a
  616. challenge-response that uses an external device for generating the
  617. response.
  618. The control interface of wpa_supplicant can be configured to allow
  619. non-root user access (ctrl_interface_group in the configuration
  620. file). This makes it possible to run wpa_cli with a normal user
  621. account.
  622. wpa_cli supports two modes: interactive and command line. Both modes
  623. share the same command set and the main difference is in interactive
  624. mode providing access to unsolicited messages (event messages,
  625. username/password requests).
  626. Interactive mode is started when wpa_cli is executed without including
  627. the command as a command line parameter. Commands are then entered on
  628. the wpa_cli prompt. In command line mode, the same commands are
  629. entered as command line arguments for wpa_cli.
  630. Interactive authentication parameters request
  631. When wpa_supplicant need authentication parameters, like username and
  632. password, which are not present in the configuration file, it sends a
  633. request message to all attached frontend programs, e.g., wpa_cli in
  634. interactive mode. wpa_cli shows these requests with
  635. "CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, or
  636. OTP (one-time-password). <id> is a unique identifier for the current
  637. network. <text> is description of the request. In case of OTP request,
  638. it includes the challenge from the authentication server.
  639. The reply to these requests can be given with 'identity', 'password',
  640. and 'otp' commands. <id> needs to be copied from the the matching
  641. request. 'password' and 'otp' commands can be used regardless of
  642. whether the request was for PASSWORD or OTP. The main difference
  643. between these two commands is that values given with 'password' are
  644. remembered as long as wpa_supplicant is running whereas values given
  645. with 'otp' are used only once and then forgotten, i.e., wpa_supplicant
  646. will ask frontend for a new value for every use. This can be used to
  647. implement one-time-password lists and generic token card -based
  648. authentication.
  649. Example request for password and a matching reply:
  650. CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
  651. > password 1 mysecretpassword
  652. Example request for generic token card challenge-response:
  653. CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
  654. > otp 2 9876
  655. wpa_cli commands
  656. status = get current WPA/EAPOL/EAP status
  657. mib = get MIB variables (dot1x, dot11)
  658. help = show this usage help
  659. interface [ifname] = show interfaces/select interface
  660. level <debug level> = change debug level
  661. license = show full wpa_cli license
  662. logoff = IEEE 802.1X EAPOL state machine logoff
  663. logon = IEEE 802.1X EAPOL state machine logon
  664. set = set variables (shows list of variables when run without arguments)
  665. pmksa = show PMKSA cache
  666. reassociate = force reassociation
  667. reconfigure = force wpa_supplicant to re-read its configuration file
  668. preauthenticate <BSSID> = force preauthentication
  669. identity <network id> <identity> = configure identity for an SSID
  670. password <network id> <password> = configure password for an SSID
  671. pin <network id> <pin> = configure pin for an SSID
  672. otp <network id> <password> = configure one-time-password for an SSID
  673. passphrase <network id> <passphrase> = configure private key passphrase
  674. for an SSID
  675. bssid <network id> <BSSID> = set preferred BSSID for an SSID
  676. list_networks = list configured networks
  677. select_network <network id> = select a network (disable others)
  678. enable_network <network id> = enable a network
  679. disable_network <network id> = disable a network
  680. add_network = add a network
  681. remove_network <network id> = remove a network
  682. set_network <network id> <variable> <value> = set network variables (shows
  683. list of variables when run without arguments)
  684. get_network <network id> <variable> = get network variables
  685. save_config = save the current configuration
  686. disconnect = disconnect and wait for reassociate command before connecting
  687. scan = request new BSS scan
  688. scan_results = get latest scan results
  689. get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = get capabilies
  690. terminate = terminate wpa_supplicant
  691. quit = exit wpa_cli
  692. wpa_cli command line options
  693. wpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvB] [-a<action file>] \
  694. [-P<pid file>] [-g<global ctrl>] [command..]
  695. -h = help (show this usage text)
  696. -v = shown version information
  697. -a = run in daemon mode executing the action file based on events from
  698. wpa_supplicant
  699. -B = run a daemon in the background
  700. default path: /var/run/wpa_supplicant
  701. default interface: first interface found in socket path
  702. Using wpa_cli to run external program on connect/disconnect
  703. -----------------------------------------------------------
  704. wpa_cli can used to run external programs whenever wpa_supplicant
  705. connects or disconnects from a network. This can be used, e.g., to
  706. update network configuration and/or trigget DHCP client to update IP
  707. addresses, etc.
  708. One wpa_cli process in "action" mode needs to be started for each
  709. interface. For example, the following command starts wpa_cli for the
  710. default ingterface (-i can be used to select the interface in case of
  711. more than one interface being used at the same time):
  712. wpa_cli -a/sbin/wpa_action.sh -B
  713. The action file (-a option, /sbin/wpa_action.sh in this example) will
  714. be executed whenever wpa_supplicant completes authentication (connect
  715. event) or detects disconnection). The action script will be called
  716. with two command line arguments: interface name and event (CONNECTED
  717. or DISCONNECTED). If the action script needs to get more information
  718. about the current network, it can use 'wpa_cli status' to query
  719. wpa_supplicant for more information.
  720. Following example can be used as a simple template for an action
  721. script:
  722. #!/bin/sh
  723. IFNAME=$1
  724. CMD=$2
  725. if [ "$CMD" == "CONNECTED" ]; then
  726. SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
  727. # configure network, signal DHCP client, etc.
  728. fi
  729. if [ "$CMD" == "DISCONNECTED" ]; then
  730. # remove network configuration, if needed
  731. fi
  732. Integrating with pcmcia-cs/cardmgr scripts
  733. ------------------------------------------
  734. wpa_supplicant needs to be running when using a wireless network with
  735. WPA. It can be started either from system startup scripts or from
  736. pcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must be
  737. completed before data frames can be exchanged, so wpa_supplicant
  738. should be started before DHCP client.
  739. For example, following small changes to pcmcia-cs scripts can be used
  740. to enable WPA support:
  741. Add MODE="Managed" and WPA="y" to the network scheme in
  742. /etc/pcmcia/wireless.opts.
  743. Add the following block to the end of 'start' action handler in
  744. /etc/pcmcia/wireless:
  745. if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
  746. /usr/local/bin/wpa_supplicant -B -c/etc/wpa_supplicant.conf \
  747. -i$DEVICE
  748. fi
  749. Add the following block to the end of 'stop' action handler (may need
  750. to be separated from other actions) in /etc/pcmcia/wireless:
  751. if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
  752. killall wpa_supplicant
  753. fi
  754. This will make cardmgr start wpa_supplicant when the card is plugged
  755. in.
  756. Dynamic interface add and operation without configuration files
  757. ---------------------------------------------------------------
  758. wpa_supplicant can be started without any configuration files or
  759. network interfaces. When used in this way, a global (i.e., per
  760. wpa_supplicant process) control interface is used to add and remove
  761. network interfaces. Each network interface can then be configured
  762. through a per-network interface control interface. For example,
  763. following commands show how to start wpa_supplicant without any
  764. network interfaces and then add a network interface and configure a
  765. network (SSID):
  766. # Start wpa_supplicant in the background
  767. wpa_supplicant -g/var/run/wpa_supplicant-global -B
  768. # Add a new interface (wlan0, no configuration file, driver=wext, and
  769. # enable control interface)
  770. wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan0 \
  771. "" wext /var/run/wpa_supplicant
  772. # Configure a network using the newly added network interface:
  773. wpa_cli -iwlan0 add_network
  774. wpa_cli -iwlan0 set_network 0 ssid '"test"'
  775. wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
  776. wpa_cli -iwlan0 set_network 0 psk '"12345678"'
  777. wpa_cli -iwlan0 set_network 0 pairwise TKIP
  778. wpa_cli -iwlan0 set_network 0 group TKIP
  779. wpa_cli -iwlan0 set_network 0 proto WPA
  780. wpa_cli -iwlan0 enable_network 0
  781. # At this point, the new network interface should start trying to associate
  782. # with the WPA-PSK network using SSID test.
  783. # Remove network interface
  784. wpa_cli -g/var/run/wpa_supplicant-global interface_remove wlan0
  785. Privilege separation
  786. --------------------
  787. To minimize the size of code that needs to be run with root privileges
  788. (e.g., to control wireless interface operation), wpa_supplicant
  789. supports optional privilege separation. If enabled, this separates the
  790. privileged operations into a separate process (wpa_priv) while leaving
  791. rest of the code (e.g., EAP authentication and WPA handshakes) into an
  792. unprivileged process (wpa_supplicant) that can be run as non-root
  793. user. Privilege separation restricts the effects of potential software
  794. errors by containing the majority of the code in an unprivileged
  795. process to avoid full system compromise.
  796. Privilege separation is not enabled by default and it can be enabled
  797. by adding CONFIG_PRIVSEP=y to the build configuration (.config). When
  798. enabled, the privileged operations (driver wrapper and l2_packet) are
  799. linked into a separate daemon program, wpa_priv. The unprivileged
  800. program, wpa_supplicant, will be built with a special driver/l2_packet
  801. wrappers that communicate with the privileged wpa_priv process to
  802. perform the needed operations. wpa_priv can control what privileged
  803. are allowed.
  804. wpa_priv needs to be run with network admin privileges (usually, root
  805. user). It opens a UNIX domain socket for each interface that is
  806. included on the command line; any other interface will be off limits
  807. for wpa_supplicant in this kind of configuration. After this,
  808. wpa_supplicant can be run as a non-root user (e.g., all standard users
  809. on a laptop or as a special non-privileged user account created just
  810. for this purpose to limit access to user files even further).
  811. Example configuration:
  812. - create user group for users that are allowed to use wpa_supplicant
  813. ('wpapriv' in this example) and assign users that should be able to
  814. use wpa_supplicant into that group
  815. - create /var/run/wpa_priv directory for UNIX domain sockets and control
  816. user access by setting it accessible only for the wpapriv group:
  817. mkdir /var/run/wpa_priv
  818. chown root:wpapriv /var/run/wpa_priv
  819. chmod 0750 /var/run/wpa_priv
  820. - start wpa_priv as root (e.g., from system startup scripts) with the
  821. enabled interfaces configured on the command line:
  822. wpa_priv -B -P /var/run/wpa_priv.pid wext:ath0
  823. - run wpa_supplicant as non-root with a user that is in wpapriv group:
  824. wpa_supplicant -i ath0 -c wpa_supplicant.conf
  825. wpa_priv does not use the network interface before wpa_supplicant is
  826. started, so it is fine to include network interfaces that are not
  827. available at the time wpa_priv is started. As an alternative, wpa_priv
  828. can be started when an interface is added (hotplug/udev/etc. scripts).
  829. wpa_priv can control multiple interface with one process, but it is
  830. also possible to run multiple wpa_priv processes at the same time, if
  831. desired.