1 hostapd and Wi-Fi Protected Setup (WPS)
2 =======================================
4 This document describes how the WPS implementation in hostapd can be
5 configured and how an external component on an AP (e.g., web UI) is
6 used to enable enrollment of client devices.
12 Wi-Fi Protected Setup (WPS) is a mechanism for easy configuration of a
13 wireless network. It allows automated generation of random keys (WPA
14 passphrase/PSK) and configuration of an access point and client
15 devices. WPS includes number of methods for setting up connections
16 with PIN method and push-button configuration (PBC) being the most
17 commonly deployed options.
19 While WPS can enable more home networks to use encryption in the
20 wireless network, it should be noted that the use of the PIN and
21 especially PBC mechanisms for authenticating the initial key setup is
22 not very secure. As such, use of WPS may not be suitable for
23 environments that require secure network access without chance for
24 allowing outsiders to gain access during the setup phase.
26 WPS uses following terms to describe the entities participating in the
28 - access point: the WLAN access point
29 - Registrar: a device that control a network and can authorize
30 addition of new devices); this may be either in the AP ("internal
31 Registrar") or in an external device, e.g., a laptop, ("external
33 - Enrollee: a device that is being authorized to use the network
35 It should also be noted that the AP and a client device may change
36 roles (i.e., AP acts as an Enrollee and client device as a Registrar)
37 when WPS is used to configure the access point.
40 More information about WPS is available from Wi-Fi Alliance:
41 http://www.wi-fi.org/wifi-protected-setup
44 hostapd implementation
45 ----------------------
47 hostapd includes an optional WPS component that can be used as an
48 internal WPS Registrar to manage addition of new WPS enabled clients
49 to the network. In addition, WPS Enrollee functionality in hostapd can
50 be used to allow external WPS Registrars to configure the access
51 point, e.g., for initial network setup. The current version of hostapd
52 does not support use of external WPS Registrars for adding new client
59 WPS is an optional component that needs to be enabled in hostapd build
60 configuration (.config). Here is an example configuration that
61 includes WPS support and uses madwifi driver interface:
63 CONFIG_DRIVER_MADWIFI=y
64 CFLAGS += -I/usr/src/madwifi-0.9.3
69 Following section shows an example runtime configuration
70 (hostapd.conf) that enables WPS:
72 # Configure the driver and network interface
76 # WPA2-Personal configuration for the AP
81 # Default WPA passphrase for legacy (non-WPS) clients
82 wpa_passphrase=12345678
83 # Enable random per-device PSK generation for WPS clients
84 # Please note that the file has to exists for hostapd to start (i.e., create an
85 # empty file as a starting point).
86 wpa_psk_file=/etc/hostapd.psk
88 # Enable control interface for PBC/PIN entry
89 ctrl_interface=/var/run/hostapd
91 # Enable internal EAP server for EAP-WSC (part of Wi-Fi Protected Setup)
94 # WPS configuration (AP configured, do not allow external WPS Registrars)
97 # If UUID is not configured, it will be generated based on local MAC address.
98 uuid=87654321-9abc-def0-1234-56789abc0000
99 wps_pin_requests=/var/run/hostapd.pin-req
100 device_name=Wireless AP
105 device_type=6-0050F204-1
107 config_methods=label display push_button keypad
113 WPS requires either a device PIN code (usually, 8-digit number) or a
114 pushbutton event (for PBC) to allow a new WPS Enrollee to join the
115 network. hostapd uses the control interface as an input channel for
118 When a client device (WPS Enrollee) connects to hostapd (WPS
119 Registrar) in order to start PIN mode negotiation for WPS, an
120 identifier (Enrollee UUID) is sent. hostapd will need to be configured
121 with a device password (PIN) for this Enrollee. This is an operation
122 that requires user interaction (assuming there are no pre-configured
123 PINs on the AP for a set of Enrollee).
125 The PIN request with information about the device is appended to the
126 wps_pin_requests file (/var/run/hostapd.pin-req in this example). In
127 addition, hostapd control interface event is sent as a notification of
128 a new device. The AP could use, e.g., a web UI for showing active
129 Enrollees to the user and request a PIN for an Enrollee.
131 The PIN request file has one line for every Enrollee that connected to
132 the AP, but for which there was no PIN. Following information is
133 provided for each Enrollee (separated with tabulators):
134 - timestamp (seconds from 1970-01-01)
144 Example line in the /var/run/hostapd.pin-req file:
145 1200188391 53b63a98-d29e-4457-a2ed-094d7e6a669c Intel(R) Centrino(R) Intel Corporation Intel(R) Centrino(R) - - 1-0050F204-1
148 When the user enters a PIN for a pending Enrollee, e.g., on the web
149 UI), hostapd needs to be notified of the new PIN over the control
150 interface. This can be done either by using the UNIX domain socket
151 -based control interface directly (src/common/wpa_ctrl.c provides
152 helper functions for using the interface) or by calling hostapd_cli.
154 Example command to add a PIN (12345670) for an Enrollee:
156 hostapd_cli wps_pin 53b63a98-d29e-4457-a2ed-094d7e6a669c 12345670
158 If the UUID-E is not available (e.g., Enrollee waits for the Registrar
159 to be selected before connecting), wildcard UUID may be used to allow the PIN to be used once with any UUID:
161 hostapd_cli wps_pin any 12345670
164 After this, the Enrollee can connect to the AP again and complete WPS
165 negotiation. At that point, a new, random WPA PSK is generated for the
166 client device and the client can then use that key to connect to the
167 AP to access the network.
170 If the AP includes a pushbutton, WPS PBC mode can be used. It is
171 enabled by pushing a button on both the AP and the client at about the
172 same time (2 minute window). hostapd needs to be notified about the AP
173 button pushed event over the control interface, e.g., by calling
178 At this point, the client has two minutes to complete WPS negotiation
179 which will generate a new WPA PSK in the same way as the PIN method