README 34 KB

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