README 38 KB

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