khoih-prog / ESPAsync_WiFiManager_Lite

Library using AsyncWebServer to configure MultiWiFi/Credentials at runtime for ESP32 (including ESP32-S2 and ESP32-C3) and ESP8266 boards. You can also specify DHCP HostName, static AP and STA IP. Use much less memory compared to full-fledge WiFiManager. Config Portal will be auto-adjusted to match the number of dynamic custom parameters. Optional default Credentials to be autoloaded into Config Portal to use or change instead of manually input. Credentials are saved in LittleFS, SPIFFS or EEPROM. New powerful-yet-simple-to-use feature to enable adding dynamic custom parameters from sketch and input using the same Config Portal. Double or MultiDetectDetector as well as Virtual Switches feature permits entering Config Portal as requested.
MIT License
57 stars 14 forks source link

Unable to connect to open access points #11

Closed benpeart closed 2 years ago

benpeart commented 2 years ago

I'm converting my Kaleidoscope project from using ESPAsync_WiFiManager to the _Lite version. I like that it enables me to provide default credentials so that in many situations, it will 'just work' without any user input. I also appreciate that the _Lite version has incorporated the DRD/MRD logic as well as the new 'Run' method that monitors the connection and will attempt to reconnect. I had to write the logic for these features before and appreciate being able to use you're more robust implementations. Thank you for making them available to us to use!

I've run into a couple of bugs/limitations I wanted to bring up. I'll open separate issues for each of them to make tracking them in Github easier.

First, I am unable to connect to open access points with ESPAsync_WiFiManager_Lite. I have a 'Guest' network/SSID that has no password. When I enter 'guest' and leave the password empty in the UI and press "Save" I get a popup that says '192.168.4.1 says Updated' but when it reboots, it fails to connect and enters AP mode and I have to enter the config portal again.

After doing some investigation, it appears from both the readme.md and looking at the code that any password shorter than 8 characters is considered invalid.

The SSIDs, Passwords must be input (or to make them different from blank). Otherwise, the Config Portal will re-open until those fields have been changed. If you don't need any field, just input anything or use duplicated data from similar field.

WiFi password min length now is 8, max length is 63 chars according to WPA2 standard.

if ( strlen(ESP_WM_LITE_config.WiFi_Creds[i].wifi_pw) >= PASSWORD_MIN_LEN )

After reading this, I tried entering 8 characters of garbage (ie 12345678) in the password field and that did get the UI to accept and save the SSID and password but it then fails to connect to the open access point given it doesn't require a password. I entered a 2nd SSID and password that does require a password and it correctly connect to the second, password protected access point correctly, it just won't connect to an open access point with no password.

khoih-prog commented 2 years ago

After doing some investigation, it appears from both the readme.md and looking at the code that any password shorter than 8 characters is considered invalid.

This is intentional for security reason, and I won't compromise the feature. Some router even won't let you connect if pwd length < 8 It's up to you to modify the code yourself for your special use-case.

benpeart commented 2 years ago

I'm a little confused/surprised. Are you saying you won't allow the library to connect to open networks? This network is configured with no authentication - no WEP, WPA, or WPA2. It is not configured with encryption (TKIP, AES). This is an entirely valid way to configure a network that is supported by every device and OS I've ever known.

Sure, I can fork the library and add support for connecting to open networks myself but that defeats much of the value of having shared libraries I can use without having to write it all myself.