]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: dot1xAuthSessionUserName
authorJouni Malinen <j@w1.fi>
Tue, 1 Jan 2019 19:29:25 +0000 (21:29 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 1 Jan 2019 19:29:25 +0000 (21:29 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/auth_serv/eap_user.conf
tests/hwsim/test_ap_eap.py

index 574af193cf52f031f4869ad3a415b884e49a7757..b9fc701dc2a3dd9536b47b5473d19e8f1180bdca 100644 (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
index e1ad3f3215e77452a251a02256dc27b22c5fa62f..c2ab1528f424d76b4d666d309b2f98ad2210e30a 100644 (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)