diff --git a/autotests/testEAP-GTC/eap-user-peap-gtc.text b/autotests/testEAP-GTC/eap-user-peap-gtc.text new file mode 100644 index 00000000..5ec5328e --- /dev/null +++ b/autotests/testEAP-GTC/eap-user-peap-gtc.text @@ -0,0 +1,4 @@ +# Phase 1 users +* PEAP [ver=1] +# Phase 2 +"secure@identity.com" GTC "testpasswd" [2] diff --git a/autotests/testEAP-GTC/hw.conf b/autotests/testEAP-GTC/hw.conf new file mode 100644 index 00000000..36decf76 --- /dev/null +++ b/autotests/testEAP-GTC/hw.conf @@ -0,0 +1,8 @@ +[SETUP] +num_radios=3 +start_iwd=1 +max_test_exec_interval_sec=60 +tmpfs_extra_stuff=../misc/certs:eap-user-peap-gtc.text + +[HOSTAPD] +rad0=ssidEAP-PEAPv1-GTC.conf diff --git a/autotests/testEAP-GTC/peap_gtc_test.py b/autotests/testEAP-GTC/peap_gtc_test.py new file mode 100644 index 00000000..51cfe54c --- /dev/null +++ b/autotests/testEAP-GTC/peap_gtc_test.py @@ -0,0 +1,69 @@ +#!/usr/bin/python3 + +import unittest +import sys +import time + +sys.path.append('../util') +import iwd +from iwd import IWD +from iwd import NetworkType + +class Test(unittest.TestCase): + + def test_connection_success(self): + ssid_to_connect = 'ssidEAP-PEAPv1-GTC' + + wd = IWD(True) + wd.wait(1) + + devices = wd.list_devices(); + + 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 = None + + for o_n in ordered_networks: + if o_n.name == ssid_to_connect: + ordered_network = o_n + break + + self.assertEqual(ordered_network.name, ssid_to_connect) + + 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) + + del wd + + @classmethod + def setUpClass(cls): + IWD.copy_to_storage('ssidEAP-PEAPv1-GTC.8021x') + + @classmethod + def tearDownClass(cls): + IWD.clear_storage() + +if __name__ == '__main__': + unittest.main(exit=True) diff --git a/autotests/testEAP-GTC/ssidEAP-PEAPv1-GTC.8021x b/autotests/testEAP-GTC/ssidEAP-PEAPv1-GTC.8021x new file mode 100644 index 00000000..8a17624c --- /dev/null +++ b/autotests/testEAP-GTC/ssidEAP-PEAPv1-GTC.8021x @@ -0,0 +1,12 @@ +[Security] +EAP-Method=PEAP +EAP-Identity=open@identity.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=GTC +EAP-PEAP-Phase2-Identity=secure@identity.com +EAP-PEAP-Phase2-GTC-Secret=testpasswd + +[Settings] +Autoconnect=false diff --git a/autotests/testEAP-GTC/ssidEAP-PEAPv1-GTC.conf b/autotests/testEAP-GTC/ssidEAP-PEAPv1-GTC.conf new file mode 100644 index 00000000..ecd498bd --- /dev/null +++ b/autotests/testEAP-GTC/ssidEAP-PEAPv1-GTC.conf @@ -0,0 +1,12 @@ +hw_mode=g +channel=1 +ssid=ssidEAP-PEAPv1-GTC + +wpa=3 +wpa_key_mgmt=WPA-EAP +ieee8021x=1 +eap_server=1 +eap_user_file=/tmp/eap-user-peap-gtc.text +ca_cert=/tmp/certs/cert-ca.pem +server_cert=/tmp/certs/cert-server.pem +private_key=/tmp/certs/cert-server-key.pem