tests: FILS SK ERP and ERP flush on server, but not on peer

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2018-08-23 12:11:44 +03:00 committed by Jouni Malinen
parent af835d75b7
commit add3c2a1bf

View file

@ -370,6 +370,7 @@ def run_fils_sk_erp(dev, apdev, key_mgmt, params):
hwsim_utils.test_connectivity(dev[0], hapd) hwsim_utils.test_connectivity(dev[0], hapd)
def test_fils_sk_erp_followed_by_pmksa_caching(dev, apdev, params): def test_fils_sk_erp_followed_by_pmksa_caching(dev, apdev, params):
"""FILS SK ERP following by PMKSA caching"""
check_fils_capa(dev[0]) check_fils_capa(dev[0])
check_erp_capa(dev[0]) check_erp_capa(dev[0])
@ -1953,3 +1954,83 @@ def test_fils_assoc_replay(dev, apdev, params):
if not ok: if not ok:
raise Exception("The second hwsim connectivity test failed") raise Exception("The second hwsim connectivity test failed")
def test_fils_sk_erp_server_flush(dev, apdev, params):
"""FILS SK ERP and ERP flush on server, but not on peer"""
check_fils_capa(dev[0])
check_erp_capa(dev[0])
hapd_as = start_erp_as(apdev[1], msk_dump=os.path.join(params['logdir'],
"msk.lst"))
bssid = apdev[0]['bssid']
params = hostapd.wpa2_eap_params(ssid="fils")
params['wpa_key_mgmt'] = "FILS-SHA256"
params['auth_server_port'] = "18128"
params['erp_domain'] = 'example.com'
params['fils_realm'] = 'example.com'
params['disable_pmksa_caching'] = '1'
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].scan_for_bss(bssid, freq=2412)
dev[0].request("ERP_FLUSH")
id = dev[0].connect("fils", key_mgmt="FILS-SHA256",
eap="PSK", identity="psk.user@example.com",
password_hex="0123456789abcdef0123456789abcdef",
erp="1", scan_freq="2412")
dev[0].request("DISCONNECT")
dev[0].wait_disconnected()
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED",
"EVENT-ASSOC-REJECT",
"CTRL-EVENT-CONNECTED"], timeout=10)
if ev is None:
raise Exception("Connection using FILS/ERP timed out")
if "CTRL-EVENT-EAP-STARTED" in ev:
raise Exception("Unexpected EAP exchange")
if "EVENT-ASSOC-REJECT" in ev:
raise Exception("Association failed")
dev[0].request("DISCONNECT")
dev[0].wait_disconnected()
hapd_as.request("ERP_FLUSH")
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
ev = dev[0].wait_event(["CTRL-EVENT-AUTH-REJECT"], timeout=10)
if ev is None:
raise Exception("No authentication rejection seen after ERP flush on server")
ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED",
"CTRL-EVENT-AUTH-REJECT",
"EVENT-ASSOC-REJECT",
"CTRL-EVENT-CONNECTED"], timeout=10)
if ev is None:
raise Exception("Connection attempt using FILS/ERP timed out")
if "CTRL-EVENT-AUTH-REJECT" in ev:
raise Exception("Failed to recover from ERP flush on server")
if "EVENT-ASSOC-REJECT" in ev:
raise Exception("Association failed")
if "CTRL-EVENT-EAP-STARTED" not in ev:
raise Exception("New EAP exchange not seen")
dev[0].wait_connected(error="Connection timeout after ERP flush")
dev[0].request("DISCONNECT")
dev[0].wait_disconnected()
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED",
"CTRL-EVENT-AUTH-REJECT",
"EVENT-ASSOC-REJECT",
"CTRL-EVENT-CONNECTED"], timeout=10)
if ev is None:
raise Exception("Connection attempt using FILS with new ERP keys timed out")
if "CTRL-EVENT-AUTH-REJECT" in ev:
raise Exception("Authentication failed with new ERP keys")
if "EVENT-ASSOC-REJECT" in ev:
raise Exception("Association failed with new ERP keys")
if "CTRL-EVENT-EAP-STARTED" in ev:
raise Exception("Unexpected EAP exchange")