]>
git.ipfire.org Git - thirdparty/hostap.git/blob - tests/hwsim/test_tnc.py
9790a3b0aa632a9c8fd0f50feca4b0cb8d1692fb
1 # -*- coding: utf-8 -*-
3 # Copyright (c) 2014, Jouni Malinen <j@w1.fi>
5 # This software may be distributed under the terms of the BSD license.
6 # See README for more details.
11 from test_ap_eap
import int_eap_server_params
13 def test_tnc_peap_soh(dev
, apdev
):
15 params
= int_eap_server_params()
17 hostapd
.add_ap(apdev
[0]['ifname'], params
)
19 dev
[0].connect("test-wpa2-eap", key_mgmt
="WPA-EAP",
20 eap
="PEAP", identity
="user", password
="password",
21 ca_cert
="auth_serv/ca.pem",
22 phase1
="peapver=0 tnc=soh cryptobinding=0",
23 phase2
="auth=MSCHAPV2",
25 ev
= dev
[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout
=10)
27 raise Exception("Connection timed out")
29 dev
[1].connect("test-wpa2-eap", key_mgmt
="WPA-EAP",
30 eap
="PEAP", identity
="user", password
="password",
31 ca_cert
="auth_serv/ca.pem",
32 phase1
="peapver=0 tnc=soh1 cryptobinding=1",
33 phase2
="auth=MSCHAPV2",
35 ev
= dev
[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout
=10)
37 raise Exception("Connection timed out")
39 dev
[2].connect("test-wpa2-eap", key_mgmt
="WPA-EAP",
40 eap
="PEAP", identity
="user", password
="password",
41 ca_cert
="auth_serv/ca.pem",
42 phase1
="peapver=0 tnc=soh2 cryptobinding=2",
43 phase2
="auth=MSCHAPV2",
45 ev
= dev
[2].wait_event(["CTRL-EVENT-CONNECTED"], timeout
=10)
47 raise Exception("Connection timed out")
49 def test_tnc_ttls(dev
, apdev
):
51 params
= int_eap_server_params()
53 hostapd
.add_ap(apdev
[0]['ifname'], params
)
55 if not os
.path
.exists("tnc/libhostap_imc.so"):
56 logger
.info("No IMC installed - skip")
59 dev
[0].connect("test-wpa2-eap", key_mgmt
="WPA-EAP",
60 eap
="TTLS", identity
="DOMAIN\mschapv2 user",
61 anonymous_identity
="ttls", password
="password",
62 phase2
="auth=MSCHAPV2",
63 ca_cert
="auth_serv/ca.pem",
65 ev
= dev
[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout
=10)
67 raise Exception("Connection timed out")
69 def test_tnc_fast(dev
, apdev
):
71 params
= int_eap_server_params()
73 params
["pac_opaque_encr_key"] ="000102030405060708090a0b0c0d0e00"
74 params
["eap_fast_a_id"] = "101112131415161718191a1b1c1d1e00"
75 params
["eap_fast_a_id_info"] = "test server2"
77 hostapd
.add_ap(apdev
[0]['ifname'], params
)
79 if not os
.path
.exists("tnc/libhostap_imc.so"):
80 logger
.info("No IMC installed - skip")
83 dev
[0].connect("test-wpa2-eap", key_mgmt
="WPA-EAP",
84 eap
="FAST", identity
="user",
85 anonymous_identity
="FAST", password
="password",
87 phase1
="fast_provisioning=2",
88 pac_file
="blob://fast_pac_auth_tnc",
89 ca_cert
="auth_serv/ca.pem",
91 ev
= dev
[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout
=10)
93 raise Exception("Connection timed out")