README 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024
  1. WPA Supplicant
  2. ==============
  3. Copyright (c) 2003-2008, 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
  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).
  147. Intel ipw2100 driver
  148. (http://sourceforge.net/projects/ipw2100/)
  149. Intel ipw2200 driver
  150. (http://sourceforge.net/projects/ipw2200/)
  151. In theory, any driver that supports Linux wireless extensions can be
  152. used with IEEE 802.1X (i.e., not WPA) when using ap_scan=0 option in
  153. configuration file.
  154. Wired Ethernet drivers (with ap_scan=0)
  155. BSD net80211 layer (e.g., Atheros driver)
  156. At the moment, this is for FreeBSD 6-CURRENT branch and NetBSD-current.
  157. Windows NDIS
  158. The current Windows port requires WinPcap (http://winpcap.polito.it/).
  159. See README-Windows.txt for more information.
  160. wpa_supplicant was designed to be portable for different drivers and
  161. operating systems. Hopefully, support for more wlan cards and OSes will be
  162. added in the future. See developer's documentation
  163. (http://hostap.epitest.fi/wpa_supplicant/devel/) for more information about the
  164. design of wpa_supplicant and porting to other drivers. One main goal
  165. is to add full WPA/WPA2 support to Linux wireless extensions to allow
  166. new drivers to be supported without having to implement new
  167. driver-specific interface code in wpa_supplicant.
  168. Optional libraries for layer2 packet processing:
  169. - libpcap (tested with 0.7.2, most relatively recent versions assumed to work,
  170. this is likely to be available with most distributions,
  171. http://tcpdump.org/)
  172. - libdnet (tested with v1.4, most versions assumed to work,
  173. http://libdnet.sourceforge.net/)
  174. These libraries are _not_ used in the default Linux build. Instead,
  175. internal Linux specific implementation is used. libpcap/libdnet are
  176. more portable and they can be used by adding CONFIG_L2_PACKET=pcap into
  177. .config. They may also be selected automatically for other operating
  178. systems. In case of Windows builds, WinPcap is used by default
  179. (CONFIG_L2_PACKET=winpcap).
  180. Optional libraries for EAP-TLS, EAP-PEAP, and EAP-TTLS:
  181. - OpenSSL (tested with 0.9.7c and 0.9.7d, and 0.9.8 versions; assumed to
  182. work with most relatively recent versions; this is likely to be
  183. available with most distributions, http://www.openssl.org/)
  184. - GnuTLS
  185. - internal TLSv1 implementation
  186. TLS options for EAP-FAST:
  187. - OpenSSL 0.9.8d _with_ openssl-0.9.8d-tls-extensions.patch applied
  188. (i.e., the default OpenSSL package does not include support for
  189. extensions needed for EAP-FAST)
  190. - internal TLSv1 implementation
  191. One of these libraries is needed when EAP-TLS, EAP-PEAP, EAP-TTLS, or
  192. EAP-FAST support is enabled. WPA-PSK mode does not require this or EAPOL/EAP
  193. implementation. A configuration file, .config, for compilation is
  194. needed to enable IEEE 802.1X/EAPOL and EAP methods. Note that EAP-MD5,
  195. EAP-GTC, EAP-OTP, and EAP-MSCHAPV2 cannot be used alone with WPA, so
  196. they should only be enabled if testing the EAPOL/EAP state
  197. machines. However, there can be used as inner authentication
  198. algorithms with EAP-PEAP and EAP-TTLS.
  199. See Building and installing section below for more detailed
  200. information about the wpa_supplicant build time configuration.
  201. WPA
  202. ---
  203. The original security mechanism of IEEE 802.11 standard was not
  204. designed to be strong and has proven to be insufficient for most
  205. networks that require some kind of security. Task group I (Security)
  206. of IEEE 802.11 working group (http://www.ieee802.org/11/) has worked
  207. to address the flaws of the base standard and has in practice
  208. completed its work in May 2004. The IEEE 802.11i amendment to the IEEE
  209. 802.11 standard was approved in June 2004 and published in July 2004.
  210. Wi-Fi Alliance (http://www.wi-fi.org/) used a draft version of the
  211. IEEE 802.11i work (draft 3.0) to define a subset of the security
  212. enhancements that can be implemented with existing wlan hardware. This
  213. is called Wi-Fi Protected Access<TM> (WPA). This has now become a
  214. mandatory component of interoperability testing and certification done
  215. by Wi-Fi Alliance. Wi-Fi provides information about WPA at its web
  216. site (http://www.wi-fi.org/OpenSection/protected_access.asp).
  217. IEEE 802.11 standard defined wired equivalent privacy (WEP) algorithm
  218. for protecting wireless networks. WEP uses RC4 with 40-bit keys,
  219. 24-bit initialization vector (IV), and CRC32 to protect against packet
  220. forgery. All these choices have proven to be insufficient: key space is
  221. too small against current attacks, RC4 key scheduling is insufficient
  222. (beginning of the pseudorandom stream should be skipped), IV space is
  223. too small and IV reuse makes attacks easier, there is no replay
  224. protection, and non-keyed authentication does not protect against bit
  225. flipping packet data.
  226. WPA is an intermediate solution for the security issues. It uses
  227. Temporal Key Integrity Protocol (TKIP) to replace WEP. TKIP is a
  228. compromise on strong security and possibility to use existing
  229. hardware. It still uses RC4 for the encryption like WEP, but with
  230. per-packet RC4 keys. In addition, it implements replay protection,
  231. keyed packet authentication mechanism (Michael MIC).
  232. Keys can be managed using two different mechanisms. WPA can either use
  233. an external authentication server (e.g., RADIUS) and EAP just like
  234. IEEE 802.1X is using or pre-shared keys without need for additional
  235. servers. Wi-Fi calls these "WPA-Enterprise" and "WPA-Personal",
  236. respectively. Both mechanisms will generate a master session key for
  237. the Authenticator (AP) and Supplicant (client station).
  238. WPA implements a new key handshake (4-Way Handshake and Group Key
  239. Handshake) for generating and exchanging data encryption keys between
  240. the Authenticator and Supplicant. This handshake is also used to
  241. verify that both Authenticator and Supplicant know the master session
  242. key. These handshakes are identical regardless of the selected key
  243. management mechanism (only the method for generating master session
  244. key changes).
  245. IEEE 802.11i / WPA2
  246. -------------------
  247. The design for parts of IEEE 802.11i that were not included in WPA has
  248. finished (May 2004) and this amendment to IEEE 802.11 was approved in
  249. June 2004. Wi-Fi Alliance is using the final IEEE 802.11i as a new
  250. version of WPA called WPA2. This includes, e.g., support for more
  251. robust encryption algorithm (CCMP: AES in Counter mode with CBC-MAC)
  252. to replace TKIP and optimizations for handoff (reduced number of
  253. messages in initial key handshake, pre-authentication, and PMKSA caching).
  254. wpa_supplicant
  255. --------------
  256. wpa_supplicant is an implementation of the WPA Supplicant component,
  257. i.e., the part that runs in the client stations. It implements WPA key
  258. negotiation with a WPA Authenticator and EAP authentication with
  259. Authentication Server. In addition, it controls the roaming and IEEE
  260. 802.11 authentication/association of the wlan driver.
  261. wpa_supplicant is designed to be a "daemon" program that runs in the
  262. background and acts as the backend component controlling the wireless
  263. connection. wpa_supplicant supports separate frontend programs and an
  264. example text-based frontend, wpa_cli, is included with wpa_supplicant.
  265. Following steps are used when associating with an AP using WPA:
  266. - wpa_supplicant requests the kernel driver to scan neighboring BSSes
  267. - wpa_supplicant selects a BSS based on its configuration
  268. - wpa_supplicant requests the kernel driver to associate with the chosen
  269. BSS
  270. - If WPA-EAP: integrated IEEE 802.1X Supplicant completes EAP
  271. authentication with the authentication server (proxied by the
  272. Authenticator in the AP)
  273. - If WPA-EAP: master key is received from the IEEE 802.1X Supplicant
  274. - If WPA-PSK: wpa_supplicant uses PSK as the master session key
  275. - wpa_supplicant completes WPA 4-Way Handshake and Group Key Handshake
  276. with the Authenticator (AP)
  277. - wpa_supplicant configures encryption keys for unicast and broadcast
  278. - normal data packets can be transmitted and received
  279. Building and installing
  280. -----------------------
  281. In order to be able to build wpa_supplicant, you will first need to
  282. select which parts of it will be included. This is done by creating a
  283. build time configuration file, .config, in the wpa_supplicant root
  284. directory. Configuration options are text lines using following
  285. format: CONFIG_<option>=y. Lines starting with # are considered
  286. comments and are ignored. See defconfig file for an example configuration
  287. and a list of available options and additional notes.
  288. The build time configuration can be used to select only the needed
  289. features and limit the binary size and requirements for external
  290. libraries. The main configuration parts are the selection of which
  291. driver interfaces (e.g., hostap, madwifi, ..) and which authentication
  292. methods (e.g., EAP-TLS, EAP-PEAP, ..) are included.
  293. Following build time configuration options are used to control IEEE
  294. 802.1X/EAPOL and EAP state machines and all EAP methods. Including
  295. TLS, PEAP, or TTLS will require linking wpa_supplicant with OpenSSL
  296. library for TLS implementation. Alternatively, GnuTLS or the internal
  297. TLSv1 implementation can be used for TLS functionaly.
  298. CONFIG_IEEE8021X_EAPOL=y
  299. CONFIG_EAP_MD5=y
  300. CONFIG_EAP_MSCHAPV2=y
  301. CONFIG_EAP_TLS=y
  302. CONFIG_EAP_PEAP=y
  303. CONFIG_EAP_TTLS=y
  304. CONFIG_EAP_GTC=y
  305. CONFIG_EAP_OTP=y
  306. CONFIG_EAP_SIM=y
  307. CONFIG_EAP_AKA=y
  308. CONFIG_EAP_PSK=y
  309. CONFIG_EAP_SAKE=y
  310. CONFIG_EAP_GPSK=y
  311. CONFIG_EAP_PAX=y
  312. CONFIG_EAP_LEAP=y
  313. CONFIG_EAP_IKEV2=y
  314. Following option can be used to include GSM SIM/USIM interface for GSM/UMTS
  315. authentication algorithm (for EAP-SIM/EAP-AKA). This requires pcsc-lite
  316. (http://www.linuxnet.com/) for smart card access.
  317. CONFIG_PCSC=y
  318. Following options can be added to .config to select which driver
  319. interfaces are included. Hermes driver interface needs to be downloaded
  320. from Agere (see above). CONFIG_WIRELESS_EXTENSION will be used
  321. automatically if any of the selected drivers need it.
  322. CONFIG_WIRELESS_EXTENSION=y
  323. CONFIG_DRIVER_HOSTAP=y
  324. CONFIG_DRIVER_HERMES=y
  325. CONFIG_DRIVER_MADWIFI=y
  326. CONFIG_DRIVER_ATMEL=y
  327. CONFIG_DRIVER_WEXT=y
  328. CONFIG_DRIVER_RALINK=y
  329. CONFIG_DRIVER_NDISWRAPPER=y
  330. CONFIG_DRIVER_BROADCOM=y
  331. CONFIG_DRIVER_IPW=y
  332. CONFIG_DRIVER_BSD=y
  333. CONFIG_DRIVER_NDIS=y
  334. Following example includes all features and driver interfaces that are
  335. included in the wpa_supplicant package:
  336. CONFIG_DRIVER_HOSTAP=y
  337. CONFIG_DRIVER_HERMES=y
  338. CONFIG_DRIVER_MADWIFI=y
  339. CONFIG_DRIVER_ATMEL=y
  340. CONFIG_DRIVER_WEXT=y
  341. CONFIG_DRIVER_NDISWRAPPER=y
  342. CONFIG_DRIVER_BROADCOM=y
  343. CONFIG_DRIVER_IPW=y
  344. CONFIG_DRIVER_BSD=y
  345. CONFIG_DRIVER_NDIS=y
  346. CONFIG_WIRELESS_EXTENSION=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
  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.)
  424. atmel = ATMEL AT76C5XXx (USB, PCMCIA)
  425. wext = Linux wireless extensions (generic)
  426. ralink = Ralink Client driver
  427. ndiswrapper = Linux ndiswrapper
  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. bsd = BSD 802.11 support (Atheros, etc.)
  432. ndis = Windows NDIS driver
  433. In most common cases, wpa_supplicant is started with
  434. wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0
  435. This makes the process fork into background.
  436. The easiest way to debug problems, and to get debug log for bug
  437. reports, is to start wpa_supplicant on foreground with debugging
  438. enabled:
  439. wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d
  440. wpa_supplicant can control multiple interfaces (radios) either by
  441. running one process for each interface separately or by running just
  442. one process and list of options at command line. Each interface is
  443. separated with -N argument. As an example, following command would
  444. start wpa_supplicant for two interfaces:
  445. wpa_supplicant \
  446. -c wpa1.conf -i wlan0 -D hostap -N \
  447. -c wpa2.conf -i ath0 -D madwifi
  448. If the interface is added in a Linux bridge (e.g., br0), the bridge
  449. interface needs to be configured to wpa_supplicant in addition to the
  450. main interface:
  451. wpa_supplicant -cw.conf -Dmadwifi -iath0 -bbr0
  452. Configuration file
  453. ------------------
  454. wpa_supplicant is configured using a text file that lists all accepted
  455. networks and security policies, including pre-shared keys. See
  456. example configuration file, wpa_supplicant.conf, for detailed
  457. information about the configuration format and supported fields.
  458. Changes to configuration file can be reloaded be sending SIGHUP signal
  459. to wpa_supplicant ('killall -HUP wpa_supplicant'). Similarly,
  460. reloading can be triggered with 'wpa_cli reconfigure' command.
  461. Configuration file can include one or more network blocks, e.g., one
  462. for each used SSID. wpa_supplicant will automatically select the best
  463. betwork based on the order of network blocks in the configuration
  464. file, network security level (WPA/WPA2 is preferred), and signal
  465. strength.
  466. Example configuration files for some common configurations:
  467. 1) WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work
  468. network
  469. # allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
  470. ctrl_interface=/var/run/wpa_supplicant
  471. ctrl_interface_group=wheel
  472. #
  473. # home network; allow all valid ciphers
  474. network={
  475. ssid="home"
  476. scan_ssid=1
  477. key_mgmt=WPA-PSK
  478. psk="very secret passphrase"
  479. }
  480. #
  481. # work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
  482. network={
  483. ssid="work"
  484. scan_ssid=1
  485. key_mgmt=WPA-EAP
  486. pairwise=CCMP TKIP
  487. group=CCMP TKIP
  488. eap=TLS
  489. identity="user@example.com"
  490. ca_cert="/etc/cert/ca.pem"
  491. client_cert="/etc/cert/user.pem"
  492. private_key="/etc/cert/user.prv"
  493. private_key_passwd="password"
  494. }
  495. 2) WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that use old peaplabel
  496. (e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-Series)
  497. ctrl_interface=/var/run/wpa_supplicant
  498. ctrl_interface_group=wheel
  499. network={
  500. ssid="example"
  501. scan_ssid=1
  502. key_mgmt=WPA-EAP
  503. eap=PEAP
  504. identity="user@example.com"
  505. password="foobar"
  506. ca_cert="/etc/cert/ca.pem"
  507. phase1="peaplabel=0"
  508. phase2="auth=MSCHAPV2"
  509. }
  510. 3) EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the
  511. unencrypted use. Real identity is sent only within an encrypted TLS tunnel.
  512. ctrl_interface=/var/run/wpa_supplicant
  513. ctrl_interface_group=wheel
  514. network={
  515. ssid="example"
  516. scan_ssid=1
  517. key_mgmt=WPA-EAP
  518. eap=TTLS
  519. identity="user@example.com"
  520. anonymous_identity="anonymous@example.com"
  521. password="foobar"
  522. ca_cert="/etc/cert/ca.pem"
  523. phase2="auth=MD5"
  524. }
  525. 4) IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and
  526. broadcast); use EAP-TLS for authentication
  527. ctrl_interface=/var/run/wpa_supplicant
  528. ctrl_interface_group=wheel
  529. network={
  530. ssid="1x-test"
  531. scan_ssid=1
  532. key_mgmt=IEEE8021X
  533. eap=TLS
  534. identity="user@example.com"
  535. ca_cert="/etc/cert/ca.pem"
  536. client_cert="/etc/cert/user.pem"
  537. private_key="/etc/cert/user.prv"
  538. private_key_passwd="password"
  539. eapol_flags=3
  540. }
  541. 5) Catch all example that allows more or less all configuration modes. The
  542. configuration options are used based on what security policy is used in the
  543. selected SSID. This is mostly for testing and is not recommended for normal
  544. use.
  545. ctrl_interface=/var/run/wpa_supplicant
  546. ctrl_interface_group=wheel
  547. network={
  548. ssid="example"
  549. scan_ssid=1
  550. key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
  551. pairwise=CCMP TKIP
  552. group=CCMP TKIP WEP104 WEP40
  553. psk="very secret passphrase"
  554. eap=TTLS PEAP TLS
  555. identity="user@example.com"
  556. password="foobar"
  557. ca_cert="/etc/cert/ca.pem"
  558. client_cert="/etc/cert/user.pem"
  559. private_key="/etc/cert/user.prv"
  560. private_key_passwd="password"
  561. phase1="peaplabel=0"
  562. ca_cert2="/etc/cert/ca2.pem"
  563. client_cert2="/etc/cer/user.pem"
  564. private_key2="/etc/cer/user.prv"
  565. private_key2_passwd="password"
  566. }
  567. 6) Authentication for wired Ethernet. This can be used with 'wired' interface
  568. (-Dwired on command line).
  569. ctrl_interface=/var/run/wpa_supplicant
  570. ctrl_interface_group=wheel
  571. ap_scan=0
  572. network={
  573. key_mgmt=IEEE8021X
  574. eap=MD5
  575. identity="user"
  576. password="password"
  577. eapol_flags=0
  578. }
  579. Certificates
  580. ------------
  581. Some EAP authentication methods require use of certificates. EAP-TLS
  582. uses both server side and client certificates whereas EAP-PEAP and
  583. EAP-TTLS only require the server side certificate. When client
  584. certificate is used, a matching private key file has to also be
  585. included in configuration. If the private key uses a passphrase, this
  586. has to be configured in wpa_supplicant.conf ("private_key_passwd").
  587. wpa_supplicant supports X.509 certificates in PEM and DER
  588. formats. User certificate and private key can be included in the same
  589. file.
  590. If the user certificate and private key is received in PKCS#12/PFX
  591. format, they need to be converted to suitable PEM/DER format for
  592. wpa_supplicant. This can be done, e.g., with following commands:
  593. # convert client certificate and private key to PEM format
  594. openssl pkcs12 -in example.pfx -out user.pem -clcerts
  595. # convert CA certificate (if included in PFX file) to PEM format
  596. openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys
  597. wpa_cli
  598. -------
  599. wpa_cli is a text-based frontend program for interacting with
  600. wpa_supplicant. It is used to query current status, change
  601. configuration, trigger events, and request interactive user input.
  602. wpa_cli can show the current authentication status, selected security
  603. mode, dot11 and dot1x MIBs, etc. In addition, it can configure some
  604. variables like EAPOL state machine parameters and trigger events like
  605. reassociation and IEEE 802.1X logoff/logon. wpa_cli provides a user
  606. interface to request authentication information, like username and
  607. password, if these are not included in the configuration. This can be
  608. used to implement, e.g., one-time-passwords or generic token card
  609. authentication where the authentication is based on a
  610. challenge-response that uses an external device for generating the
  611. response.
  612. The control interface of wpa_supplicant can be configured to allow
  613. non-root user access (ctrl_interface_group in the configuration
  614. file). This makes it possible to run wpa_cli with a normal user
  615. account.
  616. wpa_cli supports two modes: interactive and command line. Both modes
  617. share the same command set and the main difference is in interactive
  618. mode providing access to unsolicited messages (event messages,
  619. username/password requests).
  620. Interactive mode is started when wpa_cli is executed without including
  621. the command as a command line parameter. Commands are then entered on
  622. the wpa_cli prompt. In command line mode, the same commands are
  623. entered as command line arguments for wpa_cli.
  624. Interactive authentication parameters request
  625. When wpa_supplicant need authentication parameters, like username and
  626. password, which are not present in the configuration file, it sends a
  627. request message to all attached frontend programs, e.g., wpa_cli in
  628. interactive mode. wpa_cli shows these requests with
  629. "CTRL-REQ-<type>-<id>:<text>" prefix. <type> is IDENTITY, PASSWORD, or
  630. OTP (one-time-password). <id> is a unique identifier for the current
  631. network. <text> is description of the request. In case of OTP request,
  632. it includes the challenge from the authentication server.
  633. The reply to these requests can be given with 'identity', 'password',
  634. and 'otp' commands. <id> needs to be copied from the the matching
  635. request. 'password' and 'otp' commands can be used regardless of
  636. whether the request was for PASSWORD or OTP. The main difference
  637. between these two commands is that values given with 'password' are
  638. remembered as long as wpa_supplicant is running whereas values given
  639. with 'otp' are used only once and then forgotten, i.e., wpa_supplicant
  640. will ask frontend for a new value for every use. This can be used to
  641. implement one-time-password lists and generic token card -based
  642. authentication.
  643. Example request for password and a matching reply:
  644. CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
  645. > password 1 mysecretpassword
  646. Example request for generic token card challenge-response:
  647. CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
  648. > otp 2 9876
  649. wpa_cli commands
  650. status = get current WPA/EAPOL/EAP status
  651. mib = get MIB variables (dot1x, dot11)
  652. help = show this usage help
  653. interface [ifname] = show interfaces/select interface
  654. level <debug level> = change debug level
  655. license = show full wpa_cli license
  656. logoff = IEEE 802.1X EAPOL state machine logoff
  657. logon = IEEE 802.1X EAPOL state machine logon
  658. set = set variables (shows list of variables when run without arguments)
  659. pmksa = show PMKSA cache
  660. reassociate = force reassociation
  661. reconfigure = force wpa_supplicant to re-read its configuration file
  662. preauthenticate <BSSID> = force preauthentication
  663. identity <network id> <identity> = configure identity for an SSID
  664. password <network id> <password> = configure password for an SSID
  665. pin <network id> <pin> = configure pin for an SSID
  666. otp <network id> <password> = configure one-time-password for an SSID
  667. passphrase <network id> <passphrase> = configure private key passphrase
  668. for an SSID
  669. bssid <network id> <BSSID> = set preferred BSSID for an SSID
  670. list_networks = list configured networks
  671. select_network <network id> = select a network (disable others)
  672. enable_network <network id> = enable a network
  673. disable_network <network id> = disable a network
  674. add_network = add a network
  675. remove_network <network id> = remove a network
  676. set_network <network id> <variable> <value> = set network variables (shows
  677. list of variables when run without arguments)
  678. get_network <network id> <variable> = get network variables
  679. save_config = save the current configuration
  680. disconnect = disconnect and wait for reassociate command before connecting
  681. scan = request new BSS scan
  682. scan_results = get latest scan results
  683. get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = get capabilies
  684. terminate = terminate wpa_supplicant
  685. quit = exit wpa_cli
  686. wpa_cli command line options
  687. wpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvB] [-a<action file>] \
  688. [-P<pid file>] [-g<global ctrl>] [command..]
  689. -h = help (show this usage text)
  690. -v = shown version information
  691. -a = run in daemon mode executing the action file based on events from
  692. wpa_supplicant
  693. -B = run a daemon in the background
  694. default path: /var/run/wpa_supplicant
  695. default interface: first interface found in socket path
  696. Using wpa_cli to run external program on connect/disconnect
  697. -----------------------------------------------------------
  698. wpa_cli can used to run external programs whenever wpa_supplicant
  699. connects or disconnects from a network. This can be used, e.g., to
  700. update network configuration and/or trigget DHCP client to update IP
  701. addresses, etc.
  702. One wpa_cli process in "action" mode needs to be started for each
  703. interface. For example, the following command starts wpa_cli for the
  704. default ingterface (-i can be used to select the interface in case of
  705. more than one interface being used at the same time):
  706. wpa_cli -a/sbin/wpa_action.sh -B
  707. The action file (-a option, /sbin/wpa_action.sh in this example) will
  708. be executed whenever wpa_supplicant completes authentication (connect
  709. event) or detects disconnection). The action script will be called
  710. with two command line arguments: interface name and event (CONNECTED
  711. or DISCONNECTED). If the action script needs to get more information
  712. about the current network, it can use 'wpa_cli status' to query
  713. wpa_supplicant for more information.
  714. Following example can be used as a simple template for an action
  715. script:
  716. #!/bin/sh
  717. IFNAME=$1
  718. CMD=$2
  719. if [ "$CMD" == "CONNECTED" ]; then
  720. SSID=`wpa_cli -i$IFNAME status | grep ^ssid= | cut -f2- -d=`
  721. # configure network, signal DHCP client, etc.
  722. fi
  723. if [ "$CMD" == "DISCONNECTED" ]; then
  724. # remove network configuration, if needed
  725. fi
  726. Integrating with pcmcia-cs/cardmgr scripts
  727. ------------------------------------------
  728. wpa_supplicant needs to be running when using a wireless network with
  729. WPA. It can be started either from system startup scripts or from
  730. pcmcia-cs/cardmgr scripts (when using PC Cards). WPA handshake must be
  731. completed before data frames can be exchanged, so wpa_supplicant
  732. should be started before DHCP client.
  733. For example, following small changes to pcmcia-cs scripts can be used
  734. to enable WPA support:
  735. Add MODE="Managed" and WPA="y" to the network scheme in
  736. /etc/pcmcia/wireless.opts.
  737. Add the following block to the end of 'start' action handler in
  738. /etc/pcmcia/wireless:
  739. if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
  740. /usr/local/bin/wpa_supplicant -B -c/etc/wpa_supplicant.conf \
  741. -i$DEVICE
  742. fi
  743. Add the following block to the end of 'stop' action handler (may need
  744. to be separated from other actions) in /etc/pcmcia/wireless:
  745. if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
  746. killall wpa_supplicant
  747. fi
  748. This will make cardmgr start wpa_supplicant when the card is plugged
  749. in.
  750. Dynamic interface add and operation without configuration files
  751. ---------------------------------------------------------------
  752. wpa_supplicant can be started without any configuration files or
  753. network interfaces. When used in this way, a global (i.e., per
  754. wpa_supplicant process) control interface is used to add and remove
  755. network interfaces. Each network interface can then be configured
  756. through a per-network interface control interface. For example,
  757. following commands show how to start wpa_supplicant without any
  758. network interfaces and then add a network interface and configure a
  759. network (SSID):
  760. # Start wpa_supplicant in the background
  761. wpa_supplicant -g/var/run/wpa_supplicant-global -B
  762. # Add a new interface (wlan0, no configuration file, driver=wext, and
  763. # enable control interface)
  764. wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan0 \
  765. "" wext /var/run/wpa_supplicant
  766. # Configure a network using the newly added network interface:
  767. wpa_cli -iwlan0 add_network
  768. wpa_cli -iwlan0 set_network 0 ssid '"test"'
  769. wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
  770. wpa_cli -iwlan0 set_network 0 psk '"12345678"'
  771. wpa_cli -iwlan0 set_network 0 pairwise TKIP
  772. wpa_cli -iwlan0 set_network 0 group TKIP
  773. wpa_cli -iwlan0 set_network 0 proto WPA
  774. wpa_cli -iwlan0 enable_network 0
  775. # At this point, the new network interface should start trying to associate
  776. # with the WPA-PSK network using SSID test.
  777. # Remove network interface
  778. wpa_cli -g/var/run/wpa_supplicant-global interface_remove wlan0
  779. Privilege separation
  780. --------------------
  781. To minimize the size of code that needs to be run with root privileges
  782. (e.g., to control wireless interface operation), wpa_supplicant
  783. supports optional privilege separation. If enabled, this separates the
  784. privileged operations into a separate process (wpa_priv) while leaving
  785. rest of the code (e.g., EAP authentication and WPA handshakes) into an
  786. unprivileged process (wpa_supplicant) that can be run as non-root
  787. user. Privilege separation restricts the effects of potential software
  788. errors by containing the majority of the code in an unprivileged
  789. process to avoid full system compromise.
  790. Privilege separation is not enabled by default and it can be enabled
  791. by adding CONFIG_PRIVSEP=y to the build configuration (.config). When
  792. enabled, the privileged operations (driver wrapper and l2_packet) are
  793. linked into a separate daemon program, wpa_priv. The unprivileged
  794. program, wpa_supplicant, will be built with a special driver/l2_packet
  795. wrappers that communicate with the privileged wpa_priv process to
  796. perform the needed operations. wpa_priv can control what privileged
  797. are allowed.
  798. wpa_priv needs to be run with network admin privileges (usually, root
  799. user). It opens a UNIX domain socket for each interface that is
  800. included on the command line; any other interface will be off limits
  801. for wpa_supplicant in this kind of configuration. After this,
  802. wpa_supplicant can be run as a non-root user (e.g., all standard users
  803. on a laptop or as a special non-privileged user account created just
  804. for this purpose to limit access to user files even further).
  805. Example configuration:
  806. - create user group for users that are allowed to use wpa_supplicant
  807. ('wpapriv' in this example) and assign users that should be able to
  808. use wpa_supplicant into that group
  809. - create /var/run/wpa_priv directory for UNIX domain sockets and control
  810. user access by setting it accessible only for the wpapriv group:
  811. mkdir /var/run/wpa_priv
  812. chown root:wpapriv /var/run/wpa_priv
  813. chmod 0750 /var/run/wpa_priv
  814. - start wpa_priv as root (e.g., from system startup scripts) with the
  815. enabled interfaces configured on the command line:
  816. wpa_priv -B -P /var/run/wpa_priv.pid wext:ath0
  817. - run wpa_supplicant as non-root with a user that is in wpapriv group:
  818. wpa_supplicant -i ath0 -c wpa_supplicant.conf
  819. wpa_priv does not use the network interface before wpa_supplicant is
  820. started, so it is fine to include network interfaces that are not
  821. available at the time wpa_priv is started. As an alternative, wpa_priv
  822. can be started when an interface is added (hotplug/udev/etc. scripts).
  823. wpa_priv can control multiple interface with one process, but it is
  824. also possible to run multiple wpa_priv processes at the same time, if
  825. desired.