1wpa_supplicant for Windows 2========================== 3 4Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi> and contributors 5All Rights Reserved. 6 7This program is licensed under the BSD license (the one with 8advertisement clause removed). 9 10 11wpa_supplicant has support for being used as a WPA/WPA2/IEEE 802.1X 12Supplicant on Windows. The current port requires that WinPcap 13(http://winpcap.polito.it/) is installed for accessing packets and the 14driver interface. Both release versions 3.0 and 3.1 are supported. 15 16The current port is still somewhat experimental. It has been tested 17mainly on Windows XP (SP2) with limited set of NDIS drivers. In 18addition, the current version has been reported to work with Windows 192000. 20 21All security modes have been verified to work (at least complete 22authentication and successfully ping a wired host): 23- plaintext 24- static WEP / open system authentication 25- static WEP / shared key authentication 26- IEEE 802.1X with dynamic WEP keys 27- WPA-PSK, TKIP, CCMP, TKIP+CCMP 28- WPA-EAP, TKIP, CCMP, TKIP+CCMP 29- WPA2-PSK, TKIP, CCMP, TKIP+CCMP 30- WPA2-EAP, TKIP, CCMP, TKIP+CCMP 31 32 33Building wpa_supplicant with mingw 34---------------------------------- 35 36The default build setup for wpa_supplicant is to use MinGW and 37cross-compiling from Linux to MinGW/Windows. It should also be 38possible to build this under Windows using the MinGW tools, but that 39is not tested nor supported and is likely to require some changes to 40the Makefile unless cygwin is used. 41 42 43Building wpa_supplicant with MSVC 44--------------------------------- 45 46wpa_supplicant can be built with Microsoft Visual C++ compiler. This 47has been tested with Microsoft Visual C++ Toolkit 2003 and Visual 48Studio 2005 using the included nmake.mak as a Makefile for nmake. IDE 49can also be used by creating a project that includes the files and 50defines mentioned in nmake.mak. Example VS2005 solution and project 51files are included in vs2005 subdirectory. This can be used as a 52starting point for building the programs with VS2005 IDE. Visual Studio 532008 Express Edition is also able to use these project files. 54 55WinPcap development package is needed for the build and this can be 56downloaded from http://www.winpcap.org/install/bin/WpdPack_4_0_2.zip. The 57default nmake.mak expects this to be unpacked into C:\dev\WpdPack so 58that Include and Lib directories are in this directory. The files can be 59stored elsewhere as long as the WINPCAPDIR in nmake.mak is updated to 60match with the selected directory. In case a project file in the IDE is 61used, these Include and Lib directories need to be added to project 62properties as additional include/library directories. 63 64OpenSSL source package can be downloaded from 65http://www.openssl.org/source/openssl-0.9.8i.tar.gz and built and 66installed following instructions in INSTALL.W32. Note that if EAP-FAST 67support will be included in the wpa_supplicant, OpenSSL needs to be 68patched to# support it openssl-0.9.8i-tls-extensions.patch. The example 69nmake.mak file expects OpenSSL to be installed into C:\dev\openssl, but 70this directory can be modified by changing OPENSSLDIR variable in 71nmake.mak. 72 73If you do not need EAP-FAST support, you may also be able to use Win32 74binary installation package of OpenSSL from 75http://www.slproweb.com/products/Win32OpenSSL.html instead of building 76the library yourself. In this case, you will need to copy Include and 77Lib directories in suitable directory, e.g., C:\dev\openssl for the 78default nmake.mak. Copy {Win32OpenSSLRoot}\include into 79C:\dev\openssl\include and make C:\dev\openssl\lib subdirectory with 80files from {Win32OpenSSLRoot}\VC (i.e., libeay*.lib and ssleay*.lib). 81This will end up using dynamically linked OpenSSL (i.e., .dll files are 82needed) for it. Alternative, you can copy files from 83{Win32OpenSSLRoot}\VC\static to create a static build (no OpenSSL .dll 84files needed). 85 86 87Building wpa_supplicant for cygwin 88---------------------------------- 89 90wpa_supplicant can be built for cygwin by installing the needed 91development packages for cygwin. This includes things like compiler, 92make, openssl development package, etc. In addition, developer's pack 93for WinPcap (WPdpack.zip) from 94http://winpcap.polito.it/install/default.htm is needed. 95 96.config file should enable only one driver interface, 97CONFIG_DRIVER_NDIS. In addition, include directories may need to be 98added to match the system. An example configuration is available in 99defconfig. The library and include files for WinPcap will either need 100to be installed in compiler/linker default directories or their 101location will need to be adding to .config when building 102wpa_supplicant. 103 104Othen than this, the build should be more or less identical to Linux 105version, i.e., just run make after having created .config file. An 106additional tool, win_if_list.exe, can be built by running "make 107win_if_list". 108 109 110Building wpa_gui 111---------------- 112 113wpa_gui uses Qt application framework from Trolltech. It can be built 114with the open source version of Qt4 and MinGW. Following commands can 115be used to build the binary in the Qt 4 Command Prompt: 116 117# go to the root directory of wpa_supplicant source code 118cd wpa_gui-qt4 119qmake -o Makefile wpa_gui.pro 120make 121# the wpa_gui.exe binary is created into 'release' subdirectory 122 123 124Using wpa_supplicant for Windows 125-------------------------------- 126 127wpa_supplicant, wpa_cli, and wpa_gui behave more or less identically to 128Linux version, so instructions in README and example wpa_supplicant.conf 129should be applicable for most parts. In addition, there is another 130version of wpa_supplicant, wpasvc.exe, which can be used as a Windows 131service and which reads its configuration from registry instead of 132text file. 133 134When using access points in "hidden SSID" mode, ap_scan=2 mode need to 135be used (see wpa_supplicant.conf for more information). 136 137Windows NDIS/WinPcap uses quite long interface names, so some care 138will be needed when starting wpa_supplicant. Alternatively, the 139adapter description can be used as the interface name which may be 140easier since it is usually in more human-readable 141format. win_if_list.exe can be used to find out the proper interface 142name. 143 144Example steps in starting up wpa_supplicant: 145 146# win_if_list.exe 147ifname: \Device\NPF_GenericNdisWanAdapter 148description: Generic NdisWan adapter 149 150ifname: \Device\NPF_{769E012B-FD17-4935-A5E3-8090C38E25D2} 151description: Atheros Wireless Network Adapter (Microsoft's Packet Scheduler) 152 153ifname: \Device\NPF_{732546E7-E26C-48E3-9871-7537B020A211} 154description: Intel 8255x-based Integrated Fast Ethernet (Microsoft's Packet Scheduler) 155 156 157Since the example configuration used Atheros WLAN card, the middle one 158is the correct interface in this case. The interface name for -i 159command line option is the full string following "ifname:" (the 160"\Device\NPF_" prefix can be removed). In other words, wpa_supplicant 161would be started with the following command: 162 163# wpa_supplicant.exe -i'{769E012B-FD17-4935-A5E3-8090C38E25D2}' -c wpa_supplicant.conf -d 164 165-d optional enables some more debugging (use -dd for even more, if 166needed). It can be left out if debugging information is not needed. 167 168With the alternative mechanism for selecting the interface, this 169command has identical results in this case: 170 171# wpa_supplicant.exe -iAtheros -c wpa_supplicant.conf -d 172 173 174Simple configuration example for WPA-PSK: 175 176#ap_scan=2 177ctrl_interface= 178network={ 179 ssid="test" 180 key_mgmt=WPA-PSK 181 proto=WPA 182 pairwise=TKIP 183 psk="secret passphrase" 184} 185 186(remove '#' from the comment out ap_scan line to enable mode in which 187wpa_supplicant tries to associate with the SSID without doing 188scanning; this allows APs with hidden SSIDs to be used) 189 190 191wpa_cli.exe and wpa_gui.exe can be used to interact with the 192wpa_supplicant.exe program in the same way as with Linux. Note that 193ctrl_interface is using UNIX domain sockets when built for cygwin, but 194the native build for Windows uses named pipes and the contents of the 195ctrl_interface configuration item is used to control access to the 196interface. Anyway, this variable has to be included in the configuration 197to enable the control interface. 198 199 200Example SDDL string formats: 201 202(local admins group has permission, but nobody else): 203 204ctrl_interface=SDDL=D:(A;;GA;;;BA) 205 206("A" == "access allowed", "GA" == GENERIC_ALL == all permissions, and 207"BA" == "builtin administrators" == the local admins. The empty fields 208are for flags and object GUIDs, none of which should be required in this 209case.) 210 211(local admins and the local "power users" group have permissions, 212but nobody else): 213 214ctrl_interface=SDDL=D:(A;;GA;;;BA)(A;;GA;;;PU) 215 216(One ACCESS_ALLOWED ACE for GENERIC_ALL for builtin administrators, and 217one ACCESS_ALLOWED ACE for GENERIC_ALL for power users.) 218 219(close to wide open, but you have to be a valid user on 220the machine): 221 222ctrl_interface=SDDL=D:(A;;GA;;;AU) 223 224(One ACCESS_ALLOWED ACE for GENERIC_ALL for the "authenticated users" 225group.) 226 227This one would allow absolutely everyone (including anonymous 228users) -- this is *not* recommended, since named pipes can be attached 229to from anywhere on the network (i.e. there's no "this machine only" 230like there is with 127.0.0.1 sockets): 231 232ctrl_interface=SDDL=D:(A;;GA;;;BU)(A;;GA;;;AN) 233 234(BU == "builtin users", "AN" == "anonymous") 235 236See also [1] for the format of ACEs, and [2] for the possible strings 237that can be used for principal names. 238 239[1] 240http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/ace_strings.asp 241[2] 242http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/sid_strings.asp 243 244 245Starting wpa_supplicant as a Windows service (wpasvc.exe) 246--------------------------------------------------------- 247 248wpa_supplicant can be started as a Windows service by using wpasvc.exe 249program that is alternative build of wpa_supplicant.exe. Most of the 250core functionality of wpasvc.exe is identical to wpa_supplicant.exe, 251but it is using Windows registry for configuration information instead 252of a text file and command line parameters. In addition, it can be 253registered as a service that can be started automatically or manually 254like any other Windows service. 255 256The root of wpa_supplicant configuration in registry is 257HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant. This level includes global 258parameters and a 'interfaces' subkey with all the interface configuration 259(adapter to confname mapping). Each such mapping is a subkey that has 260'adapter', 'config', and 'ctrl_interface' values. 261 262This program can be run either as a normal command line application, 263e.g., for debugging, with 'wpasvc.exe app' or as a Windows service. 264Service need to be registered with 'wpasvc.exe reg <full path to 265wpasvc.exe>'. Alternatively, 'wpasvc.exe reg' can be used to register 266the service with the current location of wpasvc.exe. After this, wpasvc 267can be started like any other Windows service (e.g., 'net start wpasvc') 268or it can be configured to start automatically through the Services tool 269in administrative tasks. The service can be unregistered with 270'wpasvc.exe unreg'. 271 272If the service is set to start during system bootup to make the 273network connection available before any user has logged in, there may 274be a long (half a minute or so) delay in starting up wpa_supplicant 275due to WinPcap needing a driver called "Network Monitor Driver" which 276is started by default on demand. 277 278To speed up wpa_supplicant start during system bootup, "Network 279Monitor Driver" can be configured to be started sooner by setting its 280startup type to System instead of the default Demand. To do this, open 281up Device Manager, select Show Hidden Devices, expand the "Non 282Plug-and-Play devices" branch, double click "Network Monitor Driver", 283go to the Driver tab, and change the Demand setting to System instead. 284 285Configuration data is in HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs 286key. Each configuration profile has its own key under this. In terms of text 287files, each profile would map to a separate text file with possibly multiple 288networks. Under each profile, there is a networks key that lists all 289networks as a subkey. Each network has set of values in the same way as 290network block in the configuration file. In addition, blobs subkey has 291possible blobs as values. 292 293HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs\test\networks\0000 294 ssid="example" 295 key_mgmt=WPA-PSK 296 297See win_example.reg for an example on how to setup wpasvc.exe 298parameters in registry. It can also be imported to registry as a 299starting point for the configuration. 300