Skip to content

Add an overload of WiFi.begin to support specifying a WPA2 EAP-TTLS phase 2 method #7915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
semicolonTransistor opened this issue Mar 2, 2023 · 12 comments · Fixed by #9639
Closed
1 task done
Assignees
Labels
Area: BT&Wifi BT & Wifi related issues Status: Test needed Issue needs testing Type: Feature request Feature request for Arduino ESP32
Milestone

Comments

@semicolonTransistor
Copy link

Related area

WiFi

Hardware specification

All WiFi capbale SoCs

Is your feature request related to a problem?

The WiFi.begin() overload for WPA2-Enterprise added in #6398 seems to default to either MSCHAPV2 or MSCHAP as the phase 2 method for EAP-TTLS. There is no parameter to change the TTLS phase 2 method. However, my university network requires using PAP as the phase 2 method. Currently, I am working around this by calling esp_wifi_sta_wpa2_ent_set_ttls_phase2_method(ESP_EAP_TTLS_PHASE2_PAP); before calling WiFi.begin(...)

I believe similar problems have been reported in #6427 and #5483.

Describe the solution you'd like

It would be nice if an overload of WiFi.begin() can be added that accepts a esp_eap_ttls_phase2_types as a parameter so the user can select which TTLS phase 2 method they would like to use.

Alternatively, WiFi.begin() could try all available phase 2 options for TTLS. Which could make it easier to use and more "plug and play". Although I am not sure if that is a good idea since I have very limited knowledge of WPA2-Enterprise.

Describe alternatives you've considered

I have used the following workaround to connect to my school network

  esp_wifi_sta_wpa2_ent_set_ttls_phase2_method(ESP_EAP_TTLS_PHASE2_PAP);
  WiFi.begin(ssid, WPA2_AUTH_TTLS, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD);

This works although it took considerable research to find. I think the WiFi library would be more user-friendly if the option is available in WiFi.begin() and didn't require a separate call to an ESP-IDF function.

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.
@semicolonTransistor semicolonTransistor added the Type: Feature request Feature request for Arduino ESP32 label Mar 2, 2023
@SuGlider SuGlider self-assigned this Mar 2, 2023
@SuGlider SuGlider added this to the 2.0.8 milestone Mar 2, 2023
@SuGlider
Copy link
Collaborator

SuGlider commented Mar 2, 2023

@semicolonTransistor
It sounds to be a nice feature.
Let's consider it for the next release 2.0.8 or 3.0.0.
Thanks for the contribution.

@SuGlider SuGlider added Status: To be implemented Selected for Development Area: BT&Wifi BT & Wifi related issues labels Mar 2, 2023
@VojtechBartoska VojtechBartoska modified the milestones: 2.0.8, 3.0.0 Mar 13, 2023
@VojtechBartoska
Copy link
Contributor

Possibly relates to #8760.

Lets evaluate this and set up the milestone.

@VojtechBartoska
Copy link
Contributor

Hello, can you please validate this against 3.0.0-RC1 version? Thanks

@VojtechBartoska VojtechBartoska added Status: Test needed Issue needs testing and removed Status: To be implemented Selected for Development labels Apr 12, 2024
@VojtechBartoska VojtechBartoska modified the milestones: 3.0.0-RC1, 3.0.0-RC2 Apr 12, 2024
@VojtechBartoska VojtechBartoska moved this from In Progress to In Review in Arduino ESP32 Core Project Roadmap Apr 12, 2024
@semicolonTransistor
Copy link
Author

I'm sorry for not getting back to you sooner. I tried the 3.0.0-RC1 version and it didn't appear to change anything. A separate function call is still required to set the TTLS phase 2 method. The connection sequence is shown in the snippet below. Without the first function call the connection fails to connect.

esp_eap_client_set_ttls_phase2_method(ESP_EAP_TTLS_PHASE2_PAP);
WiFi.begin(ssid, WPA2_AUTH_TTLS, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD);

If there is another way I should be doing this please let me know, I'll be happy to test it out.

@me-no-dev
Copy link
Member

@semicolonTransistor so that order of calls works for you?

How do you imagine that option be added? Like extra argument to WiFi.begin(ssid, WPA2_AUTH_TTLS, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD); ?

@semicolonTransistor
Copy link
Author

Yes, the 2 calls in the previous reply is working for connection to the network that requires PAP.

An extra argument to WiFi.begin(ssid, WPA2_AUTH_TTLS, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD) is probably a good way to do this.

@VojtechBartoska
Copy link
Contributor

@me-no-dev are here any actions points?

@VojtechBartoska VojtechBartoska moved this from In Review to Under investigation in Arduino ESP32 Core Project Roadmap May 14, 2024
@VojtechBartoska VojtechBartoska modified the milestones: 3.0.0-RC2, 3.0.0-RC3 May 14, 2024
@me-no-dev me-no-dev self-assigned this May 14, 2024
@me-no-dev
Copy link
Member

@VojtechBartoska will try to add it for RC3/final

@JAndrassy
Copy link
Contributor

@me-no-dev
Copy link
Member

@semicolonTransistor how about

WiFi.begin(ssid, WPA2_AUTH_TTLS, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD, NULL, NULL, NULL, ESP_EAP_TTLS_PHASE2_PAP);

@JAndrassy
Copy link
Contributor

JAndrassy commented May 15, 2024

Arduino API:

WiFi.beginEnterprise()

Description

Initializes the WiFiNINA library’s network settings for a common WPA2 Enterprise network with username and password authentication (PEAP/MSCHAPv2).

Syntax
WiFi.beginEnterprise(ssid, username, password);
WiFi.beginEnterprise(ssid, username, password, identity);
WiFi.beginEnterprise(ssid, username, password, identity, ca);

Parameters
ssid: the SSID (Service Set Identifier) is the name of the WiFi network you want to connect to.
username: username part of WPA2 Enterprise (RADIUS) credentials
password: password part of WPA2 Enterprise (RADIUS) credentials
identity: WPA2 enterprise identity (optional)
ca: root certificate (string) to validate against (optional)

Returns
WL_CONNECTED when connected to a network
WL_IDLE_STATUS when not connected to a network, but powered on

@me-no-dev
Copy link
Member

it's not the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BT&Wifi BT & Wifi related issues Status: Test needed Issue needs testing Type: Feature request Feature request for Arduino ESP32
Projects
Development

Successfully merging a pull request may close this issue.

5 participants