mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 01:19:23 +01:00
auto-t: add TLS test with embedded PEMs
This commit is contained in:
parent
d2e4b7d288
commit
8885135e63
77
autotests/testEAP-TLS-embedded-pems/connection_test.py
Normal file
77
autotests/testEAP-TLS-embedded-pems/connection_test.py
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.append('../util')
|
||||||
|
import iwd
|
||||||
|
from iwd import IWD
|
||||||
|
from iwd import PSKAgent
|
||||||
|
from iwd import NetworkType
|
||||||
|
import testutil
|
||||||
|
import hostapd
|
||||||
|
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
def do_test_connection_success(self, ssid, passphrase=None):
|
||||||
|
wd = IWD()
|
||||||
|
|
||||||
|
if passphrase:
|
||||||
|
psk_agent = PSKAgent(passphrase)
|
||||||
|
wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
hostapd_ifname = None
|
||||||
|
for ifname in hostapd.hostapd_map:
|
||||||
|
if ssid + '.conf' in hostapd.hostapd_map[ifname].config:
|
||||||
|
hostapd_ifname = ifname
|
||||||
|
break
|
||||||
|
|
||||||
|
devices = wd.list_devices(1)
|
||||||
|
device = devices[0]
|
||||||
|
|
||||||
|
condition = 'not obj.scanning'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
if not device.get_ordered_networks():
|
||||||
|
device.scan()
|
||||||
|
condition = 'obj.scanning'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
condition = 'not obj.scanning'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
ordered_network = device.get_ordered_network(ssid)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
testutil.test_iface_operstate()
|
||||||
|
testutil.test_ifaces_connected(hostapd_ifname, device.name)
|
||||||
|
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
|
condition = 'not obj.connected'
|
||||||
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
|
if passphrase:
|
||||||
|
wd.unregister_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
def test_eap_tls(self):
|
||||||
|
self.do_test_connection_success('ssidEAP-TLS')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
IWD.copy_to_storage('ssidEAP-TLS.8021x')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
IWD.clear_storage()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
6
autotests/testEAP-TLS-embedded-pems/hw.conf
Normal file
6
autotests/testEAP-TLS-embedded-pems/hw.conf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[SETUP]
|
||||||
|
num_radios=2
|
||||||
|
tmpfs_extra_stuff=../misc/certs
|
||||||
|
|
||||||
|
[HOSTAPD]
|
||||||
|
rad0=ssidEAP-TLS.conf
|
94
autotests/testEAP-TLS-embedded-pems/ssidEAP-TLS.8021x
Normal file
94
autotests/testEAP-TLS-embedded-pems/ssidEAP-TLS.8021x
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
[Security]
|
||||||
|
EAP-Method=TLS
|
||||||
|
EAP-TLS-CACert=embed:cert_ca
|
||||||
|
EAP-TLS-ClientCert=embed:cert_client
|
||||||
|
EAP-TLS-ClientKey=embed:cert_client_key
|
||||||
|
EAP-Identity=abc@example.com
|
||||||
|
|
||||||
|
[@pem@cert_ca]
|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Z+AFO+M3tJAELTnseUqZyP4vl5X7SmUoXykejB4MTUwMwYDVQQKDCxJbnRl
|
||||||
|
cm5hdGlvbmFsIFVuaW9uIG9mIEV4YW1wbGUgT3JnYW5pemF0aW9uczEfMB0GA1UE
|
||||||
|
AwwWQ2VydGlmaWNhdGUgaXNzdWVyIGd1eTEeMBwGCSqGSIb3DQEJARYPY2FAbWFp
|
||||||
|
bC5leGFtcGxlggkAma3ZbsK60e8wDQYJKoZIhvcNAQELBQADggEBAA/Yb9jB94OF
|
||||||
|
swbyCrA6Qe53YGC4dfqrKGRThtGKTrH0XcM2x2qLIIbiNDogwhRqlUW8iNY6Dm2k
|
||||||
|
43mJzNsYhy7Nt3IJFCguTJFilfGzQnBtK8wCr/C9qsj//BESOIlo/TDZ2Ho4ixcJ
|
||||||
|
n+FTnN34F6JJ0DIvA6tNBe1kUFSrbubL8ygNWJ9BKMebEzokGNGCGFNr70DlQj2o
|
||||||
|
1EOMMOkj0gWO0WegAYFLojzag3l+uvU59YE+/fbZ2iclyvbF7IutQ5M9g5TnQE6F
|
||||||
|
f+qFKR5+bhlJwry6vLl/6ulihkvF3y1bm7zae62zbFaZRU6PJUl1DtXiA23ZTm9T
|
||||||
|
VDivqs07R84=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
|
||||||
|
[@pem@cert_client]
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIEPTCCAyWgAwIBAgIJAPk7rut4SWQCMA0GCSqGSIb3DQEBCwUAMHgxNTAzBgNV
|
||||||
|
BAoMLEludGVybmF0aW9uYWwgVW5pb24gb2YgRXhhbXBsZSBPcmdhbml6YXRpb25z
|
||||||
|
MR8wHQYDVQQDDBZDZXJ0aWZpY2F0ZSBpc3N1ZXIgZ3V5MR4wHAYJKoZIhvcNAQkB
|
||||||
|
Fg9jYUBtYWlsLmV4YW1wbGUwHhcNMTYwNTE3MjEyMDQ3WhcNNDMxMDAzMjEyMDQ3
|
||||||
|
WjBnMSEwHwYDV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Q
|
||||||
|
D/k3+fSRIiyY+v3J/h8ArUby+m5O2g1TgECr/nZl4avoAI0RpBi3lH6tC8GQYdbc
|
||||||
|
SA6hpNCM/dY3LWtAo2W6mdE8+RlCuTj4VZiQ1g6GE77t6XwDFL6vQBzLLXrinvXK
|
||||||
|
Ha+IssV5sGdpH9bVFWIJV2q3OZuv3HLhQfGmeUrGyWVcokQQ8d6kRwg65Zb1+KT2
|
||||||
|
bNlVKhPAMBk4ayEocpqFIfqfCKDjGdPUruIh8IVDc684
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
|
||||||
|
[@pem@cert_client_key]
|
||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
|
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDhOQ/5VIWkwt8S
|
||||||
|
9vNbbWT0VEV5Siai8HBxl0ErkJusMGFrQIS8jCxB668hNKAoSncN3lezZ/yDg8b5
|
||||||
|
NUvLiLinx1rjXeal/8ruwowlr8optgkiRxduK0BZm/Xj6HXTmZwzDACM+zwt9uSV
|
||||||
|
YW6/y0gS26oWdLJh8tRysq88xx8ylOGHEx/9/tx+DB2cJzWX23xuaoUWRjbrv/Lf
|
||||||
|
gFlXBKHD0RmGac1iTaugAM6IwB0kjscYrHATIrkPgXaHz8PV4cKUvhbLZK7xfCfR
|
||||||
|
X2Y+VNxTpvxIDkJ/Hn561C9t9T6gdUfTyCmL//d/Kd4gzCItBE4iouXHnVlfJtj3
|
||||||
|
MpD3TTijAgMBAAECggEBAIbg9YAL7j1NtupUmkkWqm7oSPLqRVkvRSfBvXWplJD6
|
||||||
|
KF1itht0lsyjqK3qJj/62HGlxj/a9o6MTIzSLiImLu/Lo9KmWYrwNUfnmqa3MArq
|
||||||
|
yW2NxapknJUNoaRrgqTGSZUIiwvjKZcdVKdhQkH6K5+fja0FFg8yrahC+k8bsMNI
|
||||||
|
5mw8NwRdR3SvHJWHCLfKCQ31tju7On/4C6jr0siUCc2//W+SO5c+F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KeKtLhknwEW9SUifU2xVrOcPikLs7Iwmmp
|
||||||
|
BkDLsu/YKwRFSfrbYZXbTlU8tQ==
|
||||||
|
-----END PRIVATE KEY-----
|
||||||
|
|
||||||
|
[Settings]
|
||||||
|
Autoconnect=False
|
12
autotests/testEAP-TLS-embedded-pems/ssidEAP-TLS.conf
Normal file
12
autotests/testEAP-TLS-embedded-pems/ssidEAP-TLS.conf
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=1
|
||||||
|
ssid=ssidEAP-TLS
|
||||||
|
|
||||||
|
wpa=3
|
||||||
|
wpa_key_mgmt=WPA-EAP
|
||||||
|
ieee8021x=1
|
||||||
|
eap_server=1
|
||||||
|
eap_user_file=/tmp/certs/eap-user-tls.text
|
||||||
|
ca_cert=/tmp/certs/cert-ca.pem
|
||||||
|
server_cert=/tmp/certs/cert-server.pem
|
||||||
|
private_key=/tmp/certs/cert-server-key.pem
|
Loading…
Reference in New Issue
Block a user