WPA2-Enterprise keyfile and certfile invalid path
I' trying to connect to an WPA2-Enterprise network using WiFi. Unfortunately I'm running into an early error. The connect method is not finding the files and claims that the file path is wrong. But I'm quit sure that the files are there.
What am I doing wrong ?
print("Wifi test") wlan = WLAN(mode=WLAN.STA) wlan.antenna(WLAN.EXT_ANT) file = open("/flash/cert/GoeSubCA_2020.pem", "r")#only for testing the path file.close() file = open('/flash/cert/GOEHMQ001-client.key','r')#only for testing the path file.close() file = open('/flash/cert/GOEHMQ001-client.crt','r')#only for testing the path file.close() wlan.connect(ssid= essentials['wifi_ssid'], auth=(WLAN.WPA2_ENT,), identity='GOEHMQ001', keyfile = '/flash/cert/GOEHMQ001-client.key', certfile = '/flash/cert/GOEHMQ001-client.crt') while not wlan.isconnected(): WLAN.status() machine.idle() while True: print(wlan.isconnected())
Output: (line 19 is the one with the connect method)
Pycom MicroPython 1.20.2.r1 [v1.11-a5aa0b8] on 2020-09-09; LoPy4 with ESP32
Pybytes Version: 1.6.0
Type "help()" for more information.
Reading file status
[1/1] Writing file main.py (3kb)
Upload done, resetting board...
OKets Jun 8 2016 00:22:57
rst:0x7 (TG0WDT_SYS_RESET),boot:0x3b (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
mode:DIO, clock div:1
ho 0 tail 12 room 4
Traceback (most recent call last):
File "main.py", line 19, in <module>
ValueError: invalid file path
Well, it could also be a problem on my side, let me know what you get!
thanks for your answer! I uploaded the new firmware and the error is not showing up anymore. Unfortunately I can not establish a connection but this might be a problem with the files itself. To verify this I have to speak with peoples of our IT department.
I will report to this next week!
Today I had some time to dive deeper into this issue. Its quite complicated though and Ill try my best to explain it here:
It seems the function that loads the certificate files is added in the
wlan = WLAN()operation, though that does not accept the keyword arguments for these files.
wlan.connect()assumes the files are already read and then discovers they are 'empty', returning a bad-file error.
I have now implemented the read-file function before the files are needed, probably solving the issue (I dont have a WPA2-ENT network to test with currently).
I attached the custom firmware here, let me know if that works for you! You can upload it using the firmware updater. I can also compile a version with Pybytes/Pygate if that is what you need!
NB. you use the function
WLAN.status(), that does not seem to exist