diff --git a/autotests/misc/secrets/eap-user-peap-sim.text b/autotests/misc/secrets/eap-user-peap-sim.text new file mode 100644 index 00000000..b3875a5c --- /dev/null +++ b/autotests/misc/secrets/eap-user-peap-sim.text @@ -0,0 +1,4 @@ +# Phase 1 users +* PEAP +# Phase 2 +"132010000000000@example.com" SIM [2] diff --git a/autotests/testEAP-PEAP-SIM/connection_test.py b/autotests/testEAP-PEAP-SIM/connection_test.py new file mode 100644 index 00000000..aa740072 --- /dev/null +++ b/autotests/testEAP-PEAP-SIM/connection_test.py @@ -0,0 +1,70 @@ +#!/usr/bin/python3 + +import unittest +import sys +import time + +sys.path.append('../util') +import iwd +from iwd import IWD +from iwd import NetworkType +from hlrauc import AuthCenter + +class Test(unittest.TestCase): + def validate_connection(self, wd): + devices = wd.list_devices(True); + self.assertIsNotNone(devices) + device = devices[0] + + condition = 'not obj.scanning' + wd.wait_for_object_condition(device, condition) + + device.scan() + + condition = 'not obj.scanning' + wd.wait_for_object_condition(device, condition) + + ordered_networks = device.get_ordered_networks() + ordered_network = ordered_networks[0] + + self.assertEqual(ordered_network.name, "ssidEAP-PEAP-SIM") + self.assertEqual(ordered_network.type, NetworkType.eap) + + condition = 'not obj.connected' + wd.wait_for_object_condition(ordered_network.network_object, condition) + + ordered_network.network_object.connect() + + condition = 'obj.connected' + wd.wait_for_object_condition(ordered_network.network_object, condition) + + device.disconnect() + + condition = 'not obj.connected' + wd.wait_for_object_condition(ordered_network.network_object, condition) + + + def test_connection_success(self): + auth = AuthCenter('/tmp/hlrauc.sock', '/tmp/sim.db') + wd = IWD(True) + + try: + self.validate_connection(wd) + except: + del wd + auth.stop() + raise + + del wd + auth.stop() + + @classmethod + def setUpClass(cls): + IWD.copy_to_storage('ssidEAP-PEAP-SIM.8021x') + + @classmethod + def tearDownClass(cls): + IWD.clear_storage() + +if __name__ == '__main__': + unittest.main(exit=True) diff --git a/autotests/testEAP-PEAP-SIM/hw.conf b/autotests/testEAP-PEAP-SIM/hw.conf new file mode 100644 index 00000000..f98429f4 --- /dev/null +++ b/autotests/testEAP-PEAP-SIM/hw.conf @@ -0,0 +1,9 @@ +[SETUP] +num_radios=2 +start_iwd=0 +max_test_exec_interval_sec=60 +tmpfs_extra_stuff=sim.eap_user:sim.db:sim_keys.conf:../misc/certs:../misc/secrets +sim_keys=/tmp/sim_keys.conf + +[HOSTAPD] +rad0=ssidEAP-PEAP-SIM.conf diff --git a/autotests/testEAP-PEAP-SIM/sim.db b/autotests/testEAP-PEAP-SIM/sim.db new file mode 100644 index 00000000..b7f51e66 --- /dev/null +++ b/autotests/testEAP-PEAP-SIM/sim.db @@ -0,0 +1 @@ +32010000000000:D0D1D2D3D4D5D6D7:E1E2E3E4:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD diff --git a/autotests/testEAP-PEAP-SIM/sim.eap_user b/autotests/testEAP-PEAP-SIM/sim.eap_user new file mode 100644 index 00000000..17f7e1ae --- /dev/null +++ b/autotests/testEAP-PEAP-SIM/sim.eap_user @@ -0,0 +1 @@ +"132010000000000@example.com" SIM diff --git a/autotests/testEAP-PEAP-SIM/sim_keys.conf b/autotests/testEAP-PEAP-SIM/sim_keys.conf new file mode 100644 index 00000000..000760ad --- /dev/null +++ b/autotests/testEAP-PEAP-SIM/sim_keys.conf @@ -0,0 +1,4 @@ +[SIM] +Identity=32010000000000@example.com +Kc=d0d1d2d3d4d5d6d7d0d1d2d3d4d5d6d7d0d1d2d3d4d5d6d7 +SRES=e1e2e3e4e1e2e3e4e1e2e3e4 diff --git a/autotests/testEAP-PEAP-SIM/ssidEAP-PEAP-SIM.8021x b/autotests/testEAP-PEAP-SIM/ssidEAP-PEAP-SIM.8021x new file mode 100644 index 00000000..c1f0859b --- /dev/null +++ b/autotests/testEAP-PEAP-SIM/ssidEAP-PEAP-SIM.8021x @@ -0,0 +1,10 @@ +[Security] +EAP-Method=PEAP +EAP-Identity=open@example.com +EAP-PEAP-CACert=/tmp/certs/cert-ca.pem +EAP-PEAP-ClientCert=/tmp/certs/cert-client.pem +EAP-PEAP-ClientKey=/tmp/certs/cert-client-key-pkcs8.pem +EAP-PEAP-Phase2-Method=SIM + +[Settings] +Autoconnect=false diff --git a/autotests/testEAP-PEAP-SIM/ssidEAP-PEAP-SIM.conf b/autotests/testEAP-PEAP-SIM/ssidEAP-PEAP-SIM.conf new file mode 100644 index 00000000..d0e66bca --- /dev/null +++ b/autotests/testEAP-PEAP-SIM/ssidEAP-PEAP-SIM.conf @@ -0,0 +1,15 @@ +hw_mode=g +channel=1 +ssid=ssidEAP-PEAP-SIM + +wpa=3 +wpa_key_mgmt=WPA-EAP +ieee8021x=1 +eap_server=1 +eap_user_file=/tmp/secrets/eap-user-peap-sim.text +ca_cert=/tmp/certs/cert-ca.pem +server_cert=/tmp/certs/cert-server.pem +private_key=/tmp/certs/cert-server-key.pem + +eap_sim_db=unix:/tmp/hlrauc.sock +eap_sim_aka_result_ind=1