1wpa_supplicant and Hotspot 2.0
2==============================
3
4This document describe how the IEEE 802.11u Interworking and Wi-Fi
5Hotspot 2.0 (Release 1) implementation in wpa_supplicant can be
6configured and how an external component on the client e.g., management
7GUI or Wi-Fi framework) is used to manage this functionality.
8
9
10Introduction to Wi-Fi Hotspot 2.0
11---------------------------------
12
13Hotspot 2.0 is the name of the Wi-Fi Alliance specification that is used
14in the Wi-Fi CERTIFIED Passpoint<TM> program. More information about
15this is available in this white paper:
16
17http://www.wi-fi.org/knowledge-center/white-papers/wi-fi-certified-passpoint%E2%84%A2-new-program-wi-fi-alliance%C2%AE-enable-seamless
18
19The Hotspot 2.0 specification is also available from WFA:
20https://www.wi-fi.org/knowledge-center/published-specifications
21
22The core Interworking functionality (network selection, GAS/ANQP) were
23standardized in IEEE Std 802.11u-2011 which is now part of the IEEE Std
24802.11-2012.
25
26
27wpa_supplicant network selection
28--------------------------------
29
30Interworking support added option for configuring credentials that can
31work with multiple networks as an alternative to configuration of
32network blocks (e.g., per-SSID parameters). When requested to perform
33network selection, wpa_supplicant picks the highest priority enabled
34network block or credential. If a credential is picked (based on ANQP
35information from APs), a temporary network block is created
36automatically for the matching network. This temporary network block is
37used similarly to the network blocks that can be configured by the user,
38but it is not stored into the configuration file and is meant to be used
39only for temporary period of time since a new one can be created
40whenever needed based on ANQP information and the credential.
41
42By default, wpa_supplicant is not using automatic network selection
43unless requested explicitly with the interworking_select command. This
44can be changed with the auto_interworking=1 parameter to perform network
45selection automatically whenever trying to find a network for connection
46and none of the enabled network blocks match with the scan results. This
47case works similarly to "interworking_select auto", i.e., wpa_supplicant
48will internally determine which network or credential is going to be
49used based on configured priorities, scan results, and ANQP information.
50
51
52wpa_supplicant configuration
53----------------------------
54
55Interworking and Hotspot 2.0 functionality are optional components that
56need to be enabled in the wpa_supplicant build configuration
57(.config). This is done by adding following parameters into that file:
58
59CONFIG_INTERWORKING=y
60CONFIG_HS20=y
61
62It should be noted that this functionality requires a driver that
63supports GAS/ANQP operations. This uses the same design as P2P, i.e.,
64Action frame processing and building in user space within
65wpa_supplicant. The Linux nl80211 driver interface provides the needed
66functionality for this.
67
68
69There are number of run-time configuration parameters (e.g., in
70wpa_supplicant.conf when using the configuration file) that can be used
71to control Hotspot 2.0 operations.
72
73# Enable Interworking
74interworking=1
75
76# Enable Hotspot 2.0
77hs20=1
78
79# Parameters for controlling scanning
80
81# Homogenous ESS identifier
82# If this is set, scans will be used to request response only from BSSes
83# belonging to the specified Homogeneous ESS. This is used only if interworking
84# is enabled.
85#hessid=00:11:22:33:44:55
86
87# Access Network Type
88# When Interworking is enabled, scans can be limited to APs that advertise the
89# specified Access Network Type (0..15; with 15 indicating wildcard match).
90# This value controls the Access Network Type value in Probe Request frames.
91#access_network_type=15
92
93# Automatic network selection behavior
94# 0 = do not automatically go through Interworking network selection
95#     (i.e., require explicit interworking_select command for this; default)
96# 1 = perform Interworking network selection if one or more
97#     credentials have been configured and scan did not find a
98#     matching network block
99#auto_interworking=0
100
101
102Credentials can be pre-configured for automatic network selection:
103
104# credential block
105#
106# Each credential used for automatic network selection is configured as a set
107# of parameters that are compared to the information advertised by the APs when
108# interworking_select and interworking_connect commands are used.
109#
110# credential fields:
111#
112# priority: Priority group
113#	By default, all networks and credentials get the same priority group
114#	(0). This field can be used to give higher priority for credentials
115#	(and similarly in struct wpa_ssid for network blocks) to change the
116#	Interworking automatic networking selection behavior. The matching
117#	network (based on either an enabled network block or a credential)
118#	with the highest priority value will be selected.
119#
120# pcsc: Use PC/SC and SIM/USIM card
121#
122# realm: Home Realm for Interworking
123#
124# username: Username for Interworking network selection
125#
126# password: Password for Interworking network selection
127#
128# ca_cert: CA certificate for Interworking network selection
129#
130# client_cert: File path to client certificate file (PEM/DER)
131#	This field is used with Interworking networking selection for a case
132#	where client certificate/private key is used for authentication
133#	(EAP-TLS). Full path to the file should be used since working
134#	directory may change when wpa_supplicant is run in the background.
135#
136#	Alternatively, a named configuration blob can be used by setting
137#	this to blob://blob_name.
138#
139# private_key: File path to client private key file (PEM/DER/PFX)
140#	When PKCS#12/PFX file (.p12/.pfx) is used, client_cert should be
141#	commented out. Both the private key and certificate will be read
142#	from the PKCS#12 file in this case. Full path to the file should be
143#	used since working directory may change when wpa_supplicant is run
144#	in the background.
145#
146#	Windows certificate store can be used by leaving client_cert out and
147#	configuring private_key in one of the following formats:
148#
149#	cert://substring_to_match
150#
151#	hash://certificate_thumbprint_in_hex
152#
153#	For example: private_key="hash://63093aa9c47f56ae88334c7b65a4"
154#
155#	Note that when running wpa_supplicant as an application, the user
156#	certificate store (My user account) is used, whereas computer store
157#	(Computer account) is used when running wpasvc as a service.
158#
159#	Alternatively, a named configuration blob can be used by setting
160#	this to blob://blob_name.
161#
162# private_key_passwd: Password for private key file
163#
164# imsi: IMSI in <MCC> | <MNC> | '-' | <MSIN> format
165#
166# milenage: Milenage parameters for SIM/USIM simulator in <Ki>:<OPc>:<SQN>
167#	format
168#
169# domain: Home service provider FQDN
170#	This is used to compare against the Domain Name List to figure out
171#	whether the AP is operated by the Home SP.
172#
173# roaming_consortium: Roaming Consortium OI
174#	If roaming_consortium_len is non-zero, this field contains the
175#	Roaming Consortium OI that can be used to determine which access
176#	points support authentication with this credential. This is an
177#	alternative to the use of the realm parameter. When using Roaming
178#	Consortium to match the network, the EAP parameters need to be
179#	pre-configured with the credential since the NAI Realm information
180#	may not be available or fetched.
181#
182# eap: Pre-configured EAP method
183#	This optional field can be used to specify which EAP method will be
184#	used with this credential. If not set, the EAP method is selected
185#	automatically based on ANQP information (e.g., NAI Realm).
186#
187# phase1: Pre-configure Phase 1 (outer authentication) parameters
188#	This optional field is used with like the 'eap' parameter.
189#
190# phase2: Pre-configure Phase 2 (inner authentication) parameters
191#	This optional field is used with like the 'eap' parameter.
192#
193# for example:
194#
195#cred={
196#	realm="example.com"
197#	username="user@example.com"
198#	password="password"
199#	ca_cert="/etc/wpa_supplicant/ca.pem"
200#	domain="example.com"
201#}
202#
203#cred={
204#	imsi="310026-000000000"
205#	milenage="90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82"
206#}
207#
208#cred={
209#	realm="example.com"
210#	username="user"
211#	password="password"
212#	ca_cert="/etc/wpa_supplicant/ca.pem"
213#	domain="example.com"
214#	roaming_consortium=223344
215#	eap=TTLS
216#	phase2="auth=MSCHAPV2"
217#}
218
219
220Control interface
221-----------------
222
223wpa_supplicant provides a control interface that can be used from
224external programs to manage various operations. The included command
225line tool, wpa_cli, can be used for manual testing with this interface.
226
227Following wpa_cli interactive mode commands show some examples of manual
228operations related to Hotspot 2.0:
229
230Remove configured networks and credentials:
231
232> remove_network all
233OK
234> remove_cred all
235OK
236
237
238Add a username/password credential:
239
240> add_cred
2410
242> set_cred 0 realm "mail.example.com"
243OK
244> set_cred 0 username "username"
245OK
246> set_cred 0 password "password"
247OK
248> set_cred 0 priority 1
249OK
250
251Add a SIM credential using a simulated SIM/USIM card for testing:
252
253> add_cred
2541
255> set_cred 1 imsi "23456-0000000000"
256OK
257> set_cred 1 milenage "90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82581:000000000123"
258OK
259> set_cred 1 priority 1
260OK
261
262Note: the return value of add_cred is used as the first argument to
263the following set_cred commands.
264
265
266Add a WPA2-Enterprise network:
267
268> add_network
2690
270> set_network 0 key_mgmt WPA-EAP
271OK
272> set_network 0 ssid "enterprise"
273OK
274> set_network 0 eap TTLS
275OK
276> set_network 0 anonymous_identity "anonymous"
277OK
278> set_network 0 identity "user"
279OK
280> set_network 0 password "password"
281OK
282> set_network 0 priority 0
283OK
284> enable_network 0 no-connect
285OK
286
287
288Add an open network:
289
290> add_network
2913
292> set_network 3 key_mgmt NONE
293OK
294> set_network 3 ssid "coffee-shop"
295OK
296> select_network 3
297OK
298
299Note: the return value of add_network is used as the first argument to
300the following set_network commands.
301
302The preferred credentials/networks can be indicated with the priority
303parameter (1 is higher priority than 0).
304
305
306Interworking network selection can be started with interworking_select
307command. This instructs wpa_supplicant to run a network scan and iterate
308through the discovered APs to request ANQP information from the APs that
309advertise support for Interworking/Hotspot 2.0:
310
311> interworking_select
312OK
313<3>Starting ANQP fetch for 02:00:00:00:01:00
314<3>RX-ANQP 02:00:00:00:01:00 ANQP Capability list
315<3>RX-ANQP 02:00:00:00:01:00 Roaming Consortium list
316<3>RX-HS20-ANQP 02:00:00:00:01:00 HS Capability List
317<3>ANQP fetch completed
318<3>INTERWORKING-AP 02:00:00:00:01:00 type=unknown
319
320
321INTERWORKING-AP event messages indicate the APs that support network
322selection and for which there is a matching
323credential. interworking_connect command can be used to select a network
324to connect with:
325
326
327> interworking_connect 02:00:00:00:01:00
328OK
329<3>CTRL-EVENT-SCAN-RESULTS
330<3>SME: Trying to authenticate with 02:00:00:00:01:00 (SSID='Example Network' freq=2412 MHz)
331<3>Trying to associate with 02:00:00:00:01:00 (SSID='Example Network' freq=2412 MHz)
332<3>Associated with 02:00:00:00:01:00
333<3>CTRL-EVENT-EAP-STARTED EAP authentication started
334<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=21
335<3>CTRL-EVENT-EAP-METHOD EAP vendor 0 method 21 (TTLS) selected
336<3>CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
337<3>WPA: Key negotiation completed with 02:00:00:00:01:00 [PTK=CCMP GTK=CCMP]
338<3>CTRL-EVENT-CONNECTED - Connection to 02:00:00:00:01:00 completed (auth) [id=0 id_str=]
339
340
341wpa_supplicant creates a temporary network block for the selected
342network based on the configured credential and ANQP information from the
343AP:
344
345> list_networks
346network id / ssid / bssid / flags
3470	Example Network	any	[CURRENT]
348> get_network 0 key_mgmt
349WPA-EAP
350> get_network 0 eap
351TTLS
352
353
354Alternatively to using an external program to select the network,
355"interworking_select auto" command can be used to request wpa_supplicant
356to select which network to use based on configured priorities:
357
358
359> remove_network all
360OK
361<3>CTRL-EVENT-DISCONNECTED bssid=02:00:00:00:01:00 reason=1 locally_generated=1
362> interworking_select auto
363OK
364<3>Starting ANQP fetch for 02:00:00:00:01:00
365<3>RX-ANQP 02:00:00:00:01:00 ANQP Capability list
366<3>RX-ANQP 02:00:00:00:01:00 Roaming Consortium list
367<3>RX-HS20-ANQP 02:00:00:00:01:00 HS Capability List
368<3>ANQP fetch completed
369<3>INTERWORKING-AP 02:00:00:00:01:00 type=unknown
370<3>CTRL-EVENT-SCAN-RESULTS
371<3>SME: Trying to authenticate with 02:00:00:00:01:00 (SSID='Example Network' freq=2412 MHz)
372<3>Trying to associate with 02:00:00:00:01:00 (SSID='Example Network' freq=2412 MHz)
373<3>Associated with 02:00:00:00:01:00
374<3>CTRL-EVENT-EAP-STARTED EAP authentication started
375<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=21
376<3>CTRL-EVENT-EAP-METHOD EAP vendor 0 method 21 (TTLS) selected
377<3>CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
378<3>WPA: Key negotiation completed with 02:00:00:00:01:00 [PTK=CCMP GTK=CCMP]
379<3>CTRL-EVENT-CONNECTED - Connection to 02:00:00:00:01:00 completed (reauth) [id=0 id_str=]
380
381
382The connection status can be shown with the status command:
383
384> status
385bssid=02:00:00:00:01:00
386ssid=Example Network
387id=0
388mode=station
389pairwise_cipher=CCMP       <--- link layer security indication
390group_cipher=CCMP
391key_mgmt=WPA2/IEEE 802.1X/EAP
392wpa_state=COMPLETED
393p2p_device_address=02:00:00:00:00:00
394address=02:00:00:00:00:00
395hs20=1      <--- HS 2.0 indication
396Supplicant PAE state=AUTHENTICATED
397suppPortStatus=Authorized
398EAP state=SUCCESS
399selectedMethod=21 (EAP-TTLS)
400EAP TLS cipher=AES-128-SHA
401EAP-TTLSv0 Phase2 method=PAP
402
403
404> status
405bssid=02:00:00:00:02:00
406ssid=coffee-shop
407id=3
408mode=station
409pairwise_cipher=NONE
410group_cipher=NONE
411key_mgmt=NONE
412wpa_state=COMPLETED
413p2p_device_address=02:00:00:00:00:00
414address=02:00:00:00:00:00
415
416
417Note: The Hotspot 2.0 indication is shown as "hs20=1" in the status
418command output. Link layer security is indicated with the
419pairwise_cipher (CCMP = secure, NONE = no encryption used).
420
421
422Also the scan results include the Hotspot 2.0 indication:
423
424> scan_results
425bssid / frequency / signal level / flags / ssid
42602:00:00:00:01:00	2412	-30	[WPA2-EAP-CCMP][ESS][HS20]	Example Network
427
428
429ANQP information for the BSS can be fetched using the BSS command:
430
431> bss 02:00:00:00:01:00
432id=1
433bssid=02:00:00:00:01:00
434freq=2412
435beacon_int=100
436capabilities=0x0411
437qual=0
438noise=-92
439level=-30
440tsf=1345573286517276
441age=105
442ie=000f4578616d706c65204e6574776f726b010882848b960c1218240301012a010432043048606c30140100000fac040100000fac040100000fac0100007f04000000806b091e07010203040506076c027f006f1001531122331020304050010203040506dd05506f9a1000
443flags=[WPA2-EAP-CCMP][ESS][HS20]
444ssid=Example Network
445anqp_roaming_consortium=031122330510203040500601020304050603fedcba
446
447
448ANQP queries can also be requested with the anqp_get and hs20_anqp_get
449commands:
450
451> anqp_get 02:00:00:00:01:00 261
452OK
453<3>RX-ANQP 02:00:00:00:01:00 Roaming Consortium list
454> hs20_anqp_get 02:00:00:00:01:00 2
455OK
456<3>RX-HS20-ANQP 02:00:00:00:01:00 HS Capability List
457
458In addition, fetch_anqp command can be used to request similar set of
459ANQP queries to be done as is run as part of interworking_select:
460
461> scan
462OK
463<3>CTRL-EVENT-SCAN-RESULTS
464> fetch_anqp
465OK
466<3>Starting ANQP fetch for 02:00:00:00:01:00
467<3>RX-ANQP 02:00:00:00:01:00 ANQP Capability list
468<3>RX-ANQP 02:00:00:00:01:00 Roaming Consortium list
469<3>RX-HS20-ANQP 02:00:00:00:01:00 HS Capability List
470<3>ANQP fetch completed
471