test_ap_eap.py 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. #!/usr/bin/python
  2. #
  3. # WPA2-Enterprise tests
  4. # Copyright (c) 2013, Jouni Malinen <j@w1.fi>
  5. #
  6. # This software may be distributed under the terms of the BSD license.
  7. # See README for more details.
  8. import time
  9. import subprocess
  10. import logging
  11. logger = logging.getLogger()
  12. import os.path
  13. import hwsim_utils
  14. import hostapd
  15. def eap_connect(dev, method, identity, anonymous_identity=None, password=None,
  16. phase1=None, phase2=None, ca_cert=None,
  17. domain_suffix_match=None, password_hex=None,
  18. client_cert=None, private_key=None, sha256=False):
  19. id = dev.connect("test-wpa2-eap", key_mgmt="WPA-EAP WPA-EAP-SHA256",
  20. eap=method, identity=identity,
  21. anonymous_identity=anonymous_identity,
  22. password=password, phase1=phase1, phase2=phase2,
  23. ca_cert=ca_cert, domain_suffix_match=domain_suffix_match,
  24. wait_connect=False, scan_freq="2412",
  25. password_hex=password_hex,
  26. client_cert=client_cert, private_key=private_key,
  27. ieee80211w="1")
  28. eap_check_auth(dev, method, True, sha256=sha256)
  29. return id
  30. def eap_check_auth(dev, method, initial, rsn=True, sha256=False):
  31. ev = dev.wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=10)
  32. if ev is None:
  33. raise Exception("Association and EAP start timed out")
  34. ev = dev.wait_event(["CTRL-EVENT-EAP-METHOD"], timeout=10)
  35. if ev is None:
  36. raise Exception("EAP method selection timed out")
  37. if method not in ev:
  38. raise Exception("Unexpected EAP method")
  39. ev = dev.wait_event(["CTRL-EVENT-EAP-SUCCESS"], timeout=10)
  40. if ev is None:
  41. raise Exception("EAP success timed out")
  42. if initial:
  43. ev = dev.wait_event(["CTRL-EVENT-CONNECTED"], timeout=10)
  44. if ev is None:
  45. raise Exception("Association with the AP timed out")
  46. status = dev.get_status()
  47. if status["wpa_state"] != "COMPLETED":
  48. raise Exception("Connection not completed")
  49. else:
  50. # no connected event since already connected
  51. for i in range(0, 30):
  52. status = dev.get_status()
  53. if status["wpa_state"] == "COMPLETED":
  54. break
  55. time.sleep(0.1)
  56. if status["wpa_state"] != "COMPLETED":
  57. raise Exception("Connection not completed")
  58. if status["suppPortStatus"] != "Authorized":
  59. raise Exception("Port not authorized")
  60. if method not in status["selectedMethod"]:
  61. raise Exception("Incorrect EAP method status")
  62. if sha256:
  63. e = "WPA2-EAP-SHA256"
  64. elif rsn:
  65. e = "WPA2/IEEE 802.1X/EAP"
  66. else:
  67. e = "WPA/IEEE 802.1X/EAP"
  68. if status["key_mgmt"] != e:
  69. raise Exception("Unexpected key_mgmt status: " + status["key_mgmt"])
  70. def eap_reauth(dev, method, rsn=True, sha256=False):
  71. dev.request("REAUTHENTICATE")
  72. eap_check_auth(dev, method, False, rsn=rsn, sha256=sha256)
  73. def test_ap_wpa2_eap_sim(dev, apdev):
  74. """WPA2-Enterprise connection using EAP-SIM"""
  75. if not os.path.exists("/tmp/hlr_auc_gw.sock"):
  76. logger.info("No hlr_auc_gw available");
  77. return "skip"
  78. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  79. hostapd.add_ap(apdev[0]['ifname'], params)
  80. eap_connect(dev[0], "SIM", "1232010000000000",
  81. password="90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82581")
  82. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  83. eap_reauth(dev[0], "SIM")
  84. def test_ap_wpa2_eap_aka(dev, apdev):
  85. """WPA2-Enterprise connection using EAP-AKA"""
  86. if not os.path.exists("/tmp/hlr_auc_gw.sock"):
  87. logger.info("No hlr_auc_gw available");
  88. return "skip"
  89. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  90. hostapd.add_ap(apdev[0]['ifname'], params)
  91. eap_connect(dev[0], "AKA", "0232010000000000",
  92. password="90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82581:000000000123")
  93. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  94. eap_reauth(dev[0], "AKA")
  95. def test_ap_wpa2_eap_aka_prime(dev, apdev):
  96. """WPA2-Enterprise connection using EAP-AKA'"""
  97. if not os.path.exists("/tmp/hlr_auc_gw.sock"):
  98. logger.info("No hlr_auc_gw available");
  99. return "skip"
  100. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  101. hostapd.add_ap(apdev[0]['ifname'], params)
  102. eap_connect(dev[0], "AKA'", "6555444333222111",
  103. password="5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123")
  104. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  105. eap_reauth(dev[0], "AKA'")
  106. def test_ap_wpa2_eap_ttls_pap(dev, apdev):
  107. """WPA2-Enterprise connection using EAP-TTLS/PAP"""
  108. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  109. hostapd.add_ap(apdev[0]['ifname'], params)
  110. eap_connect(dev[0], "TTLS", "pap user",
  111. anonymous_identity="ttls", password="password",
  112. ca_cert="auth_serv/ca.pem", phase2="auth=PAP")
  113. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  114. eap_reauth(dev[0], "TTLS")
  115. def test_ap_wpa2_eap_ttls_chap(dev, apdev):
  116. """WPA2-Enterprise connection using EAP-TTLS/CHAP"""
  117. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  118. hostapd.add_ap(apdev[0]['ifname'], params)
  119. eap_connect(dev[0], "TTLS", "chap user",
  120. anonymous_identity="ttls", password="password",
  121. ca_cert="auth_serv/ca.pem", phase2="auth=CHAP")
  122. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  123. eap_reauth(dev[0], "TTLS")
  124. def test_ap_wpa2_eap_ttls_mschap(dev, apdev):
  125. """WPA2-Enterprise connection using EAP-TTLS/MSCHAP"""
  126. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  127. hostapd.add_ap(apdev[0]['ifname'], params)
  128. eap_connect(dev[0], "TTLS", "mschap user",
  129. anonymous_identity="ttls", password="password",
  130. ca_cert="auth_serv/ca.pem", phase2="auth=MSCHAP",
  131. domain_suffix_match="server.w1.fi")
  132. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  133. eap_reauth(dev[0], "TTLS")
  134. def test_ap_wpa2_eap_ttls_mschapv2(dev, apdev):
  135. """WPA2-Enterprise connection using EAP-TTLS/MSCHAPv2"""
  136. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  137. hostapd.add_ap(apdev[0]['ifname'], params)
  138. hapd = hostapd.Hostapd(apdev[0]['ifname'])
  139. eap_connect(dev[0], "TTLS", "DOMAIN\mschapv2 user",
  140. anonymous_identity="ttls", password="password",
  141. ca_cert="auth_serv/ca.pem", phase2="auth=MSCHAPV2",
  142. domain_suffix_match="w1.fi")
  143. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  144. sta1 = hapd.get_sta(dev[0].p2p_interface_addr())
  145. eapol1 = hapd.get_sta(dev[0].p2p_interface_addr(), info="eapol")
  146. eap_reauth(dev[0], "TTLS")
  147. sta2 = hapd.get_sta(dev[0].p2p_interface_addr())
  148. eapol2 = hapd.get_sta(dev[0].p2p_interface_addr(), info="eapol")
  149. if int(sta2['dot1xAuthEapolFramesRx']) <= int(sta1['dot1xAuthEapolFramesRx']):
  150. raise Exception("dot1xAuthEapolFramesRx did not increase")
  151. if int(eapol2['authAuthEapStartsWhileAuthenticated']) < 1:
  152. raise Exception("authAuthEapStartsWhileAuthenticated did not increase")
  153. if int(eapol2['backendAuthSuccesses']) <= int(eapol1['backendAuthSuccesses']):
  154. raise Exception("backendAuthSuccesses did not increase")
  155. def test_ap_wpa2_eap_ttls_eap_gtc(dev, apdev):
  156. """WPA2-Enterprise connection using EAP-TTLS/EAP-GTC"""
  157. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  158. hostapd.add_ap(apdev[0]['ifname'], params)
  159. eap_connect(dev[0], "TTLS", "user",
  160. anonymous_identity="ttls", password="password",
  161. ca_cert="auth_serv/ca.pem", phase2="autheap=GTC")
  162. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  163. eap_reauth(dev[0], "TTLS")
  164. def test_ap_wpa2_eap_ttls_eap_md5(dev, apdev):
  165. """WPA2-Enterprise connection using EAP-TTLS/EAP-MD5"""
  166. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  167. hostapd.add_ap(apdev[0]['ifname'], params)
  168. eap_connect(dev[0], "TTLS", "user",
  169. anonymous_identity="ttls", password="password",
  170. ca_cert="auth_serv/ca.pem", phase2="autheap=MD5")
  171. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  172. eap_reauth(dev[0], "TTLS")
  173. def test_ap_wpa2_eap_ttls_eap_mschapv2(dev, apdev):
  174. """WPA2-Enterprise connection using EAP-TTLS/EAP-MSCHAPv2"""
  175. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  176. hostapd.add_ap(apdev[0]['ifname'], params)
  177. eap_connect(dev[0], "TTLS", "user",
  178. anonymous_identity="ttls", password="password",
  179. ca_cert="auth_serv/ca.pem", phase2="autheap=MSCHAPV2")
  180. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  181. eap_reauth(dev[0], "TTLS")
  182. def test_ap_wpa2_eap_peap_eap_mschapv2(dev, apdev):
  183. """WPA2-Enterprise connection using EAP-PEAP/EAP-MSCHAPv2"""
  184. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  185. hostapd.add_ap(apdev[0]['ifname'], params)
  186. eap_connect(dev[0], "PEAP", "user",
  187. anonymous_identity="peap", password="password",
  188. ca_cert="auth_serv/ca.pem", phase2="auth=MSCHAPV2")
  189. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  190. eap_reauth(dev[0], "PEAP")
  191. def test_ap_wpa2_eap_peap_crypto_binding(dev, apdev):
  192. """WPA2-Enterprise connection using EAP-PEAPv0/EAP-MSCHAPv2 and crypto binding"""
  193. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  194. hostapd.add_ap(apdev[0]['ifname'], params)
  195. eap_connect(dev[0], "PEAP", "user", password="password",
  196. ca_cert="auth_serv/ca.pem",
  197. phase1="peapver=0 crypto_binding=2",
  198. phase2="auth=MSCHAPV2")
  199. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  200. eap_reauth(dev[0], "PEAP")
  201. def test_ap_wpa2_eap_tls(dev, apdev):
  202. """WPA2-Enterprise connection using EAP-TLS"""
  203. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  204. hostapd.add_ap(apdev[0]['ifname'], params)
  205. eap_connect(dev[0], "TLS", "tls user", ca_cert="auth_serv/ca.pem",
  206. client_cert="auth_serv/user.pem",
  207. private_key="auth_serv/user.key")
  208. eap_reauth(dev[0], "TLS")
  209. def test_ap_wpa2_eap_tls_neg_incorrect_trust_root(dev, apdev):
  210. """WPA2-Enterprise negative test - incorrect trust root"""
  211. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  212. hostapd.add_ap(apdev[0]['ifname'], params)
  213. dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="TTLS",
  214. identity="DOMAIN\mschapv2 user", anonymous_identity="ttls",
  215. password="password", phase2="auth=MSCHAPV2",
  216. ca_cert="auth_serv/ca-incorrect.pem",
  217. wait_connect=False, scan_freq="2412")
  218. ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=10)
  219. if ev is None:
  220. raise Exception("Association and EAP start timed out")
  221. ev = dev[0].wait_event(["CTRL-EVENT-EAP-METHOD"], timeout=10)
  222. if ev is None:
  223. raise Exception("EAP method selection timed out")
  224. if "TTLS" not in ev:
  225. raise Exception("Unexpected EAP method")
  226. ev = dev[0].wait_event(["CTRL-EVENT-EAP-TLS-CERT-ERROR",
  227. "CTRL-EVENT-EAP-SUCCESS",
  228. "CTRL-EVENT-EAP-FAILURE",
  229. "CTRL-EVENT-CONNECTED",
  230. "CTRL-EVENT-DISCONNECTED"], timeout=10)
  231. if ev is None:
  232. raise Exception("EAP result timed out")
  233. if "CTRL-EVENT-EAP-TLS-CERT-ERROR" not in ev:
  234. raise Exception("TLS certificate error not reported")
  235. ev = dev[0].wait_event(["CTRL-EVENT-EAP-SUCCESS",
  236. "CTRL-EVENT-EAP-FAILURE",
  237. "CTRL-EVENT-CONNECTED",
  238. "CTRL-EVENT-DISCONNECTED"], timeout=10)
  239. if ev is None:
  240. raise Exception("EAP result(2) timed out")
  241. if "CTRL-EVENT-EAP-FAILURE" not in ev:
  242. raise Exception("EAP failure not reported")
  243. ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
  244. "CTRL-EVENT-DISCONNECTED"], timeout=10)
  245. if ev is None:
  246. raise Exception("EAP result(3) timed out")
  247. if "CTRL-EVENT-DISCONNECTED" not in ev:
  248. raise Exception("Disconnection not reported")
  249. ev = dev[0].wait_event(["CTRL-EVENT-SSID-TEMP-DISABLED"], timeout=10)
  250. if ev is None:
  251. raise Exception("Network block disabling not reported")
  252. def test_ap_wpa2_eap_tls_neg_suffix_match(dev, apdev):
  253. """WPA2-Enterprise negative test - domain suffix mismatch"""
  254. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  255. hostapd.add_ap(apdev[0]['ifname'], params)
  256. dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="TTLS",
  257. identity="DOMAIN\mschapv2 user", anonymous_identity="ttls",
  258. password="password", phase2="auth=MSCHAPV2",
  259. ca_cert="auth_serv/ca.pem",
  260. domain_suffix_match="incorrect.example.com",
  261. wait_connect=False, scan_freq="2412")
  262. ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=10)
  263. if ev is None:
  264. raise Exception("Association and EAP start timed out")
  265. ev = dev[0].wait_event(["CTRL-EVENT-EAP-METHOD"], timeout=10)
  266. if ev is None:
  267. raise Exception("EAP method selection timed out")
  268. if "TTLS" not in ev:
  269. raise Exception("Unexpected EAP method")
  270. ev = dev[0].wait_event(["CTRL-EVENT-EAP-TLS-CERT-ERROR",
  271. "CTRL-EVENT-EAP-SUCCESS",
  272. "CTRL-EVENT-EAP-FAILURE",
  273. "CTRL-EVENT-CONNECTED",
  274. "CTRL-EVENT-DISCONNECTED"], timeout=10)
  275. if ev is None:
  276. raise Exception("EAP result timed out")
  277. if "CTRL-EVENT-EAP-TLS-CERT-ERROR" not in ev:
  278. raise Exception("TLS certificate error not reported")
  279. if "Domain suffix mismatch" not in ev:
  280. raise Exception("Domain suffix mismatch not reported")
  281. ev = dev[0].wait_event(["CTRL-EVENT-EAP-SUCCESS",
  282. "CTRL-EVENT-EAP-FAILURE",
  283. "CTRL-EVENT-CONNECTED",
  284. "CTRL-EVENT-DISCONNECTED"], timeout=10)
  285. if ev is None:
  286. raise Exception("EAP result(2) timed out")
  287. if "CTRL-EVENT-EAP-FAILURE" not in ev:
  288. raise Exception("EAP failure not reported")
  289. ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
  290. "CTRL-EVENT-DISCONNECTED"], timeout=10)
  291. if ev is None:
  292. raise Exception("EAP result(3) timed out")
  293. if "CTRL-EVENT-DISCONNECTED" not in ev:
  294. raise Exception("Disconnection not reported")
  295. ev = dev[0].wait_event(["CTRL-EVENT-SSID-TEMP-DISABLED"], timeout=10)
  296. if ev is None:
  297. raise Exception("Network block disabling not reported")
  298. def test_ap_wpa2_eap_pwd(dev, apdev):
  299. """WPA2-Enterprise connection using EAP-pwd"""
  300. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  301. hostapd.add_ap(apdev[0]['ifname'], params)
  302. eap_connect(dev[0], "PWD", "pwd user", password="secret password")
  303. eap_reauth(dev[0], "PWD")
  304. def test_ap_wpa2_eap_gpsk(dev, apdev):
  305. """WPA2-Enterprise connection using EAP-GPSK"""
  306. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  307. hostapd.add_ap(apdev[0]['ifname'], params)
  308. eap_connect(dev[0], "GPSK", "gpsk user",
  309. password="abcdefghijklmnop0123456789abcdef")
  310. eap_reauth(dev[0], "GPSK")
  311. def test_ap_wpa2_eap_sake(dev, apdev):
  312. """WPA2-Enterprise connection using EAP-SAKE"""
  313. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  314. hostapd.add_ap(apdev[0]['ifname'], params)
  315. eap_connect(dev[0], "SAKE", "sake user",
  316. password_hex="0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
  317. eap_reauth(dev[0], "SAKE")
  318. def test_ap_wpa2_eap_eke(dev, apdev):
  319. """WPA2-Enterprise connection using EAP-EKE"""
  320. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  321. hostapd.add_ap(apdev[0]['ifname'], params)
  322. id = eap_connect(dev[0], "EKE", "eke user", password="hello")
  323. eap_reauth(dev[0], "EKE")
  324. logger.info("Test forced algorithm selection")
  325. for phase1 in [ "dhgroup=5 encr=1 prf=2 mac=2",
  326. "dhgroup=4 encr=1 prf=2 mac=2",
  327. "dhgroup=3 encr=1 prf=2 mac=2",
  328. "dhgroup=3 encr=1 prf=1 mac=1" ]:
  329. dev[0].set_network_quoted(id, "phase1", phase1)
  330. ev = dev[0].wait_event(["CTRL-EVENT-EAP-SUCCESS"], timeout=10)
  331. if ev is None:
  332. raise Exception("EAP success timed out")
  333. ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=10)
  334. if ev is None:
  335. raise Exception("Association with the AP timed out")
  336. logger.info("Test failed algorithm negotiation")
  337. dev[0].set_network_quoted(id, "phase1", "dhgroup=9 encr=9 prf=9 mac=9")
  338. ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=10)
  339. if ev is None:
  340. raise Exception("EAP failure timed out")
  341. def test_ap_wpa2_eap_ikev2(dev, apdev):
  342. """WPA2-Enterprise connection using EAP-IKEv2"""
  343. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  344. hostapd.add_ap(apdev[0]['ifname'], params)
  345. eap_connect(dev[0], "IKEV2", "ikev2 user", password="ike password")
  346. eap_reauth(dev[0], "IKEV2")
  347. def test_ap_wpa2_eap_pax(dev, apdev):
  348. """WPA2-Enterprise connection using EAP-PAX"""
  349. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  350. hostapd.add_ap(apdev[0]['ifname'], params)
  351. eap_connect(dev[0], "PAX", "pax.user@example.com",
  352. password_hex="0123456789abcdef0123456789abcdef")
  353. eap_reauth(dev[0], "PAX")
  354. def test_ap_wpa2_eap_psk(dev, apdev):
  355. """WPA2-Enterprise connection using EAP-PSK"""
  356. params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
  357. params["wpa_key_mgmt"] = "WPA-EAP-SHA256"
  358. params["ieee80211w"] = "2"
  359. hostapd.add_ap(apdev[0]['ifname'], params)
  360. eap_connect(dev[0], "PSK", "psk.user@example.com",
  361. password_hex="0123456789abcdef0123456789abcdef", sha256=True)
  362. eap_reauth(dev[0], "PSK", sha256=True)
  363. def test_ap_wpa_eap_peap_eap_mschapv2(dev, apdev):
  364. """WPA-Enterprise connection using EAP-PEAP/EAP-MSCHAPv2"""
  365. params = hostapd.wpa_eap_params(ssid="test-wpa-eap")
  366. hostapd.add_ap(apdev[0]['ifname'], params)
  367. dev[0].connect("test-wpa-eap", key_mgmt="WPA-EAP", eap="PEAP",
  368. identity="user", password="password", phase2="auth=MSCHAPV2",
  369. ca_cert="auth_serv/ca.pem", wait_connect=False,
  370. scan_freq="2412")
  371. eap_check_auth(dev[0], "PEAP", True, rsn=False)
  372. hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
  373. eap_reauth(dev[0], "PEAP", rsn=False)