Skip to content
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

Added another overloaded WiFiSTAClass::begin() function that provides… #6398

Merged
merged 3 commits into from
Mar 15, 2022

Conversation

jpswensen
Copy link
Contributor

… an easy way of creating a WPA2 Enterprise connections.


Summary

The examples demonstrate how to create a WPA2 Enterprise connection, but it requires using various direct esp_idf functions. This patch is intended to create another overloaded version of the WiFi.begin() function that allows a user to create a WPA2 Enterprise connection in much the same way as different kinds of connections.

My only question for the core maintainers is whether I should leave those #ifdef's in there. I added them so that it was easy to disable all the code I added via defines from my platformio.ini file, but they technically aren't necessary.

Impact

This should make it easier for novice users to create WPA2 Enterprise connections. For my university, I didn't need a root certificate or the client certificate or client key, so I haven't been able to debug those scenarios, but I built the begin functions to allow any one of those to be used, if needed.

I can confirm that eduroam-style WPA2 Enterprise networks that only require authentication with a username and password works as expected.

Related links

N/A

… an easy way of creating a WPA2 Enterprise connection.
@CLAassistant
Copy link

CLAassistant commented Mar 9, 2022

CLA assistant check
All committers have signed the CLA.

@@ -31,6 +31,12 @@
#include "esp_smartconfig.h"
#include "wifi_provisioning/manager.h"

#ifdef ENABLE_WPA2_AUTHENTICATION
#include <WiFiClient.h>
#include <WiFiClientSecure.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are those two included? Just esp_wpa2.h is enough, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that esp_wpa2.h is enough. If you look just above the new WiFiSTAClass::begin() function that I created, I declared a static WiFiClientSecure. This is necessary for negotiating the various types of cert processes that are sometimes needed with WPA2 Enterprise. esp_wpa2.h does not include WiFiClientSecure.h, as the former is a esp-idf header and the latter is an arduino-espressif32 header.

I could/should arguably move these into the WiFiSTA.cpp file (and I don't think I actually need WiFiClient.h) to prevent unnecessary #includes, however.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes please :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSVALIDATE.01 ¤ "Meta"
-----[\HTTPS://BITCOINNEWS.COM----]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is was is s someone added their Business camera sytem to my computer... now i have identity issues

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Screwballs"tied his camera system to my computer... now i cannot access any of my own stuff
20220405_174156

@@ -31,6 +31,12 @@
#include "esp_smartconfig.h"
#include "wifi_provisioning/manager.h"

#ifdef ENABLE_WPA2_AUTHENTICATION
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it need to be disabled? Would it not work for all chips/cases? Having it guarded like that would require some way to enable this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this guard in there because I wasn't sure if there was any shared code between the WiFi portions of the Arduino cores for ESP8266 and ESP32. AFAIK based on fairly recent testing, I don't think the WPA2 Enterprise authentication works for ESP8266, so I was thinking ahead to try and make it capable of being guarded easily. I can remove those, if you want me to.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the client nowhere being used other than to set some certs that yu provide as arguments to the function. You should be able to safely skip those and add them to the sketch. BTW could you please provide an example of the use?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gh pr checkout 6398 hey
I cant help someone tied the SWAN CAMERA SYSTEM TO MY COMPUTER

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a company profile on linkedin that can be used to identify me currently, a IBM is a computer of the guy that is stealing my identity.

…ent back to the esp-edf wpa2 example to get this corrected. (2) I updated the WiFiClientEnterprise example to use this new method and to add a bunch of comments and commented-out examples about the three most common scenarios.
@jpswensen
Copy link
Contributor Author

OK. I think my latest two commits both fix those issues and fixed another issue I realized I had. Since I don't have a WiFi system available that requires cert files, I don't have a way of testing those. I can test on my local WPA2 Enterprise system that requires PEAP identity, username, and password (but not cert files). However, as I was double checking everything I realized that I had mistakenly been working off an example that was showing interaction with a secure server using a secure client, instead of showing the cert-file WPA2 Enterprise authentication.

So, I went back to the base esp-idf example that demonstrates the cert-file WPA2 Enterprise authentication and made fixes to ensure this is now correct (I think). I still don't have a way of testing this, but I think it should be correct (assuming the esp-idf SDK example works).

I also modified the WiFiClientEnterprise.ino example in the WiFi library to use this new method and added a whole bunch of comments to explain the three most common modes of use that a typical user would see (TLS+certs, TTLS/PEAP+no_certs, TTLS/PEAP+certs).

@me-no-dev me-no-dev mentioned this pull request Mar 14, 2022
1 task
@me-no-dev me-no-dev merged commit d977359 into espressif:master Mar 15, 2022
@me-no-dev
Copy link
Member

Thanks @jpswensen :)

Jason2866 added a commit to Jason2866/arduino-esp32 that referenced this pull request Mar 15, 2022
Jason2866 added a commit to Jason2866/arduino-esp32 that referenced this pull request Mar 16, 2022
* Fix wdt OTA update

* Fix ESP32-Solo WDT on HTTP OTA update

Co-authored-by: Theo Arends <[email protected]>

* Fix ESP32-Solo WDT on HTTP OTA update

* Fix ESP32-Solo WDT on HTTP OTA update

Co-authored-by: Theo Arends <[email protected]>

* IDF master c69f0ec32

* Fix WDT only for solo core

* IDF master 58022f859

* IDF master 606557b48

* IDF master 8131d6f46

* IDF master 59aa60d52

* IDF master 83956ebba

* IDF master 83956ebbae

* IDF master b1c3ee71c5

* IDF master 2c49af9e75

* IDF master eb1a66e7c9

* IDF master a20df743f1

* Fix build compilation due to changes in the HW_TIMER's structs

* Fix compilation warnings and errors with USB

* Update USBCDC.cpp

* Update CMakeLists.txt

* IDF master b63ec47238

* Update libarduino_tinyusb.a

* Update HWCDC.cpp

* IDF master 5f38b766a8

* IDF master b1f851b8f8

* IDF master 61299f879e

* Delete tools/sdk/esp32/include/coap directory

* Delete tools/sdk/esp32c3/include/coap directory

* Delete tools/sdk/esp32s2/include/coap directory

* solve conflicts

* force Dynamic Buffer instead of Static ones

* Remove debug if

* Resolve conflicts

* Revert espressif#5861

* add GPIO defines for C3

* Edit sd_diskio to check card status

* Update CMakeLists.txt

* Delete libraries/RainMaker directory

* Update README.md

* Update README.md

* Revert "RMT refactor"

* Fixes Lib Builder compiling errors

* Fixes Lib Builder compiling errors

* Revert "Revert "RMT refactor""

* Update esp32-hal-rmt.c

* Update esp32-hal-rmt.c

* Update esp32-hal-rmt.c

* Update esp32-hal-rmt.c

* Update esp32-hal-gpio.c

* Bugfix of ff_sd_status

* Fix I2C Slave Compile

I2C Slave currently doesn't compile for projects where Arduino is an IDF component.  This adds missing conditionals.

* add missing c3 define

when disable HAL lock is set

* add ESP32C3 `esp32_adc2gpio`

* Fixes UART MODBUS and Loopback issue

* Update esp32-hal-uart.c

* Revert "Fixing interrupts in LEDC (espressif#6160)"

This reverts commit a593206.

* Update esp32-hal.h

* use Tasmota github

* Use Tasmota platform for CI

* tasmota eaptool v3.2

* add missing c3 define

* enable SPI hal for S3

* revert enable spi for S3

* Update Esp.cpp

* Update Esp.cpp

* fix S3 uart gpios

* Update HardwareSerial.cpp

* Update Esp.cpp

* Update Esp.cpp

* Bootloader is at 0x0000 for S3

* Update esp32-hal-cpu.c

* Update esp32-hal-spi.c

* Update install-platformio-esp32.sh

* Fix replace() failing

* Update CMakeLists.txt

* remove Rainmaker

* Update CMakeLists.txt

* try to find lib builder fail

* Update CMakeLists.txt

* Update idf_component.yml

* Update esp32-hal-ledc.c

* Update esp32-hal-gpio.c

* Update esp32-hal-gpio.h

* Update boards.txt

* Update idf_component.yml

* Update esp32-hal-gpio.c

* Update esp32-hal-ledc.c

* Update idf_component.yml

* Add files via upload

* Update HTTPClient.cpp

* Update HTTPClient.h

* Fixes RMT examples and adds ESP32-S3 config

* Fixes RMT examples and adds ESP32-S3 config

* fix compile

* fix compile 2

* fix compile 3

* revert cookie changes

* revert cookie jar support

* cookie jar

* cookie jar

* Support mbedtls 2.28.x

* Update esp32c3.rom.ld

* GPIO refactoring

GPIO now using ESP-IDF API on all chips.
LEDC interrupt fix removed - no longer needed.
Edited pins_arduino.h in variants according to changes in gpio.

* Update esp32-hal-gpio.c

* Update esp32-hal-ledc.c

* Update HTTPClient.cpp

* Update ssl_client.cpp

* Update boards.txt

* Update esp32-hal-gpio.c

* Update esp32-hal-ledc.c

* Edited analog channels functions

* Update esp32-hal-gpio.c

* Update esp32-hal-gpio.h

* Update esp32-hal-ledc.c

* Fix CDC+JTAG is disabled when WiFi is used on ESP32-C3

Fixes: espressif#6264
Thanks @Spritetm

* ADC esp32s2 attenuation fix for DAC pins

* Revert "ADC esp32s2 attenuation fix for DAC pins"

* revert6134

espressif#6134

* revert2

* revert3

* revert

* Update HardwareSerial.cpp

* Update HardwareSerial.h

* Update esp32-hal-uart.c

* Update esp32-hal-uart.h

* S3

* Update esp32-hal-adc.c

* Fix ethenet

* align with arduino upstream

* Adds C++ std::function to Serial.onReceive() PR6364 upstream

* Update esp32-hal-uart.c

* Update HardwareSerial.cpp

* Update esp32-hal-uart.c

* Update boards.txt

* Update HardwareSerial.cpp

* Update HardwareSerial.h

* Update WiFiAP.cpp

* Update WiFiGeneric.cpp

* Update WiFiGeneric.h

* Update WiFiSTA.cpp

* Update WiFiSTA.h

* Update HardwareSerial.cpp

* Update HardwareSerial.h

* Delete libraries/RainMaker directory

* remove rainmaker

* Fixes USB CDC setRxBufferSize(), begin(), _onRX()

* Fixes SetRxBufferSize(0) with end()

* Fixes reset when 2x call to end()

* publish.yml: Limit the running scope of the publish Workflow. (espressif#6428)

1. Don't run the publish test result workflow on the master
branch.
2. Run only on Pull Requests to be able to publish the result as a PR comment.
3. Avoid running when the triggering workflow was skipped, this will
   cause a failure as no file will be uploaded.

Signed-off-by: Abdelatif Guettouche <[email protected]>

* Add missing include in AsyncUDP.h (espressif#6412)

In my project I'm getting the error 
```
In file included from lib/Discovery/Discovery.cpp:2:
C:/Users/David/.platformio/packages/framework-arduinoespressif32/libraries/AsyncUDP/src/AsyncUDP.h:47:1: error: expected class-name before '{' token
```

Adding a reference to Stream.h fixes it.

* Some board variant fixes (espressif#6411)

* make work with rev C pcb

* use #define for easy testing

* Added another overloaded WiFiSTAClass::begin() function that provides… (espressif#6398)

Summary

The examples demonstrate how to create a WPA2 Enterprise connection, but it requires using various direct esp_idf functions. This patch is intended to create another overloaded version of the WiFi.begin() function that allows a user to create a WPA2 Enterprise connection in much the same way as different kinds of connections.

My only question for the core maintainers is whether I should leave those #ifdef's in there. I added them so that it was easy to disable all the code I added via defines from my platformio.ini file, but they technically aren't necessary.

Impact

This should make it easier for novice users to create WPA2 Enterprise connections. For my university, I didn't need a root certificate or the client certificate or client key, so I haven't been able to debug those scenarios, but I built the begin functions to allow any one of those to be used, if needed.

I can confirm that eduroam-style WPA2 Enterprise networks that only require authentication with a username and password works as expected.

* Fix boot freeze when trying to init PSRAM on Pico D4

* Revert "Added another overloaded WiFiSTAClass::begin() function that provides… (espressif#6398)"

This reverts commit d977359.

* fix rainmaker merge

Co-authored-by: Theo Arends <[email protected]>
Co-authored-by: me-no-dev <[email protected]>
Co-authored-by: me-no-dev <[email protected]>
Co-authored-by: Jan Procházka <[email protected]>
Co-authored-by: Jason2866 <[email protected]>
Co-authored-by: Rodrigo Garcia <[email protected]>
Co-authored-by: mrengineer7777 <[email protected]>
Co-authored-by: s-hadinger <[email protected]>
Co-authored-by: Abdelatif Guettouche <[email protected]>
Co-authored-by: Limor "Ladyada" Fried <[email protected]>
Co-authored-by: John P. Swensen <[email protected]>
Co-authored-by: Stephan Hadinger <[email protected]>
Jason2866 added a commit to tasmota/arduino-esp32 that referenced this pull request Mar 17, 2022
* publish.yml: Limit the running scope of the publish Workflow. (espressif#6428)

1. Don't run the publish test result workflow on the master
branch.
2. Run only on Pull Requests to be able to publish the result as a PR comment.
3. Avoid running when the triggering workflow was skipped, this will
   cause a failure as no file will be uploaded.

Signed-off-by: Abdelatif Guettouche <[email protected]>

* Add missing include in AsyncUDP.h (espressif#6412)

In my project I'm getting the error 
```
In file included from lib/Discovery/Discovery.cpp:2:
C:/Users/David/.platformio/packages/framework-arduinoespressif32/libraries/AsyncUDP/src/AsyncUDP.h:47:1: error: expected class-name before '{' token
```

Adding a reference to Stream.h fixes it.

* Some board variant fixes (espressif#6411)

* make work with rev C pcb

* use #define for easy testing

* Added another overloaded WiFiSTAClass::begin() function that provides… (espressif#6398)

Summary

The examples demonstrate how to create a WPA2 Enterprise connection, but it requires using various direct esp_idf functions. This patch is intended to create another overloaded version of the WiFi.begin() function that allows a user to create a WPA2 Enterprise connection in much the same way as different kinds of connections.

My only question for the core maintainers is whether I should leave those #ifdef's in there. I added them so that it was easy to disable all the code I added via defines from my platformio.ini file, but they technically aren't necessary.

Impact

This should make it easier for novice users to create WPA2 Enterprise connections. For my university, I didn't need a root certificate or the client certificate or client key, so I haven't been able to debug those scenarios, but I built the begin functions to allow any one of those to be used, if needed.

I can confirm that eduroam-style WPA2 Enterprise networks that only require authentication with a username and password works as expected.

Co-authored-by: Abdelatif Guettouche <[email protected]>
Co-authored-by: mrengineer7777 <[email protected]>
Co-authored-by: Limor "Ladyada" Fried <[email protected]>
Co-authored-by: John P. Swensen <[email protected]>
Jason2866 added a commit to Jason2866/arduino-esp32 that referenced this pull request Mar 17, 2022
Jason2866 added a commit to Jason2866/arduino-esp32 that referenced this pull request Mar 17, 2022
Copy link

@LinkedInprofile LinkedInprofile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include <WiFiClientSecure.h>
#include "esp_wpa2.h"
#endif

ESP_EVENT_DECLARE_BASE(ARDUINO_EVENTS);

typedef enum {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔🛫🛫🛫✔🛫🛫🔗 👋👋👋

D VERSION:3. 0 N: FN: EMAIL;TYPE=PREF:hello@247atmformula. com END:VCARD
[email protected]📁📂👋

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[default.PDF](https:/espressif/arduino-esp3libraries/WiFi/src/WiFiGeneric.h
2/files/8422799/default.PDF)

Copy link

@LinkedInprofile LinkedInprofile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include <WiFiClientSecure.h>
#include "esp_wpa2.h"
#endif

ESP_EVENT_DECLARE_BASE(ARDUINO_EVENTS);

typedef enum {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include <WiFiClientSecure.h>
#include "esp_wpa2.h"
#endif

ESP_EVENT_DECLARE_BASE(ARDUINO_EVENTS);

typedef enum {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[default.PDF](https:/espressif/arduino-esp3libraries/WiFi/src/WiFiGeneric.h
2/files/8422799/default.PDF)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants