tests: dot1xAuthSessionUserName

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-01-01 21:29:25 +02:00
parent 28ab9344b5
commit fb643190dc
2 changed files with 32 additions and 1 deletions

View File

@ -150,3 +150,6 @@ radius_accept_attr=26:x:00009f6805170168747470733a2f2f6578616d706c652e636f6d2f
"hs20-t-c-test" TTLS-MSCHAPV2 "password" [2]
radius_accept_attr=26:x:00009f68090601000000
radius_accept_attr=89:s:hs20-cui
"test-user" TTLS-PAP "password" [2]
radius_accept_attr=1:s:real-user

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# WPA2-Enterprise tests
# Copyright (c) 2013-2015, Jouni Malinen <j@w1.fi>
# Copyright (c) 2013-2019, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
@ -6472,3 +6472,31 @@ def test_ap_wpa2_eap_psk_mac_addr_change(dev, apdev):
addr2 = dev[0].get_status_field("address")
if addr != addr2:
raise Exception("Failed to restore MAC address")
def test_ap_wpa2_eap_server_get_id(dev, apdev):
"""Internal EAP server and dot1xAuthSessionUserName"""
params = int_eap_server_params()
hapd = hostapd.add_ap(apdev[0], params)
eap_connect(dev[0], hapd, "TLS", "tls user", ca_cert="auth_serv/ca.pem",
client_cert="auth_serv/user.pem",
private_key="auth_serv/user.key")
sta = hapd.get_sta(dev[0].own_addr())
if 'dot1xAuthSessionUserName' not in sta:
raise Exception("No dot1xAuthSessionUserName included")
user = sta['dot1xAuthSessionUserName']
if user != "tls user":
raise Exception("Unexpected dot1xAuthSessionUserName value: " + user)
def test_ap_wpa2_radius_server_get_id(dev, apdev):
"""External RADIUS server and dot1xAuthSessionUserName"""
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hapd = hostapd.add_ap(apdev[0], params)
eap_connect(dev[0], hapd, "TTLS", "test-user",
anonymous_identity="ttls", password="password",
ca_cert="auth_serv/ca.pem", phase2="auth=PAP")
sta = hapd.get_sta(dev[0].own_addr())
if 'dot1xAuthSessionUserName' not in sta:
raise Exception("No dot1xAuthSessionUserName included")
user = sta['dot1xAuthSessionUserName']
if user != "real-user":
raise Exception("Unexpected dot1xAuthSessionUserName value: " + user)