README 37 KB

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