-
Notifications
You must be signed in to change notification settings - Fork 819
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 support for secure TLS connections #699
Conversation
Thanks for the PR, if you need, I would be able to test it next week. |
I already did manual tests, but I want it to be "tested" in the ci. |
@1technophile should we keep the |
We should remove it, while we don't test Arduino IDE with the CI we don't need it anymore |
how we then "test"(compile) the TLS code in the CI pipeline? |
If you need |
For just compiling we don't need a real certificat, and for manual testing I use my own ca from my MQTT broker. |
@1technophile Were in the docs should I put the documentation for the TLS MQTT connection? Is there a section for the MQTT broker connection setup, I did not found any. |
@Legion2 maybe we should add an advanced_configuration.md in the beginning of the upload section? |
An advanced configuration section sounds good. The tests fail on ESP32 because there is no more free Flash when compiling the esp32dev-all example:
|
I don't think it is a big issue, as I think also that we should differentiate test and production env and do not upload the binaries to github for the test ones. |
Ok good idea to make special test environments, @1technophile which of the current env do you consider to be only test related? |
Here they are:
We should keep on extracting the libraries from these environments as it enables to have all the libraries in one zip file. But their binaries are in my point of view not necessary and can mislead the user. |
I have never uploaded a BIN file directly on an Arduino Mega neither searched how to do it. |
oh ok |
currently we use the name of the env for the name of the uploaded files. So if we add |
Maybe we should do it the other way and don't publish the binaries that end with |
but then other |
Like that?
|
@1technophile I create a new pull request for this change |
@1technophile how do I add a new page to the docs? |
You create a new .md page in the wished directory and you add the directory/page_name in the config.js for the docs (sidebar section) |
on ESP32 and ESP8266 close #101
fixed some some isues in the documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took me sometime to setup the necessary environment to test but now I'm up and running.
Thanks for the work first, this is a waited feature!
Here is my test report:
Board | Modules or env | Result | Comments |
---|---|---|---|
barebone ESP32 | no | OK | |
barebone ESP32 | IR & RF | OK | |
m5stickc | esp32-m5stick-c-ble | - | CoreDump after BLE Scan begin |
barebone ESP32 | esp32dev-ble | - | CoreDump after BLE Scan begin |
nodemcuv2 | RF, BT, DHT, ONOFF, ADC, GPIOInput | - | W: failed, ssl error code=54 |
nodemcuv2 | RF | - | W: failed, ssl error code=54 |
With the nodemcu v2 I'm using the same MQTT server and the same certificate as the working esp32 configuration.
here is the log extract on the ESP8266:
E: Failed connecting 1st time to mqtt, you should put TRIGGER_GPIO to LOW or erase the flash
W: Wifi Protocol changed to WIFI_11G: 2
W: ESP8266: Forcing to wifi 2
W: MQTT connection...
W: failure_number_mqtt: 30
W: failed, rc=-2
W: failed, ssl error code=54
here is the coredump extract:
************* WELCOME TO OpenMQTTGateway **************
{"mqtt_server":"secure.les.com","mqtt_port":"8883","mqtt_user":"chevaliers","mqtt_pass":"duzodiaque","mqtt_topic":"home/","gateway_name":"OpenMQTTGateway_ESP32_M5STICK_C_BLE_IR"}*WM: [3] allocating params bytes: 20
*WM: [2] Added Parameter: server
*WM: [2] Added Parameter: port
*WM: [2] Added Parameter: user
*WM: [2] Added Parameter: pass
*WM: [2] Added Parameter: name
*WM: [3] Updated _max_params: 10
*WM: [3] re-allocating params bytes: 40
*WM: [2] Added Parameter: topic
N: Attempting Wifi connection with saved AP: 0
{"mqtt_server":"secure.les.com","mqtt_port":"8883","mqtt_user":"chevaliers","mqtt_pass":"duzodiaque","mqtt_topic":"home/","gateway_name":"OpenMQTTGateway_ESP32_M5STICK_C_BLE_IR"}N: BLEinterval: 55555
N: Minrssi: -100
N: Low Power Mode: 0
N: Setup OpenMQTTGateway end
W: MQTT connection...
N: Connected to broker
N: Subject: /SYStoMQTT
N: Received json : {"uptime":3,"version":"version_tag","freemem":95092,"rssi":-48,"SSID":"monreseau","ip":"9.9.9.9","mac":"D8:DD:EE:57:HH:55","wifiprt":0,"lowpowermode":0,"interval":55555,"modules":"BTHADiscovery"}
N: Scan begin
Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4000c46c PS : 0x00060f30 A0 : 0x801b3ff0 A1 : 0x3fff7610
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000130 A5 : 0x00000000
A6 : 0x3f426318 A7 : 0x00000013 A8 : 0x80085039 A9 : 0x3fff75b0
A10 : 0x00000000 A11 : 0x00001800 A12 : 0x00000000 A13 : 0x00000003
A14 : 0x00000001 A15 : 0x00000006 SAR : 0x00000008 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000012
The main differences I see between the coredumping configurations and the others are:
- less memory available due to the size of the BLE library
- use of the 2 cores, the BLE scan is done on a different core
This is not related to your work I think but maybe a side effect.
mean "Certificate is expired or not yet valid." this can be due to NTP does not set the time correctly. Can you confirm that the time is set correctly, this maybe take a while and it should be eventually set correctly. The normal connection retry should then successfully connect with the correct time set. |
On target, I just uncommented Sumup
Should we add something on the troubleshooting doc about |
yes I will also add |
can you decode the core dump so we know in which function the error happens |
Never done that, but there is always a first time! Let's try |
Here is the decoding of the stack trace:
|
Seems that we are not alone on this: |
As a complementary info, I also tried to change the partition type to I'm getting:
And still the core dump when the scan begin:
|
yeah, from what I read, both (TLS and BLE) allocate huge amount of memory and so they can't be used together. We would have to do many memory usage optimizations to get both working at the same time. |
Some ideas here, here and here also. I'm going to do some tests this week by changing different parameters and having a closer memory followup. In all the case ESP-IDF will support NimBLE; a lighter BLE stack compared to BlueDroid, so as a last option we may add a note in the documentation about the current incompatibility and wait for the NimBLE integration into Arduino ESP32. |
A better solution, I have found this library: |
Ok |
support TLS on ESP32 and ESP8266 close #101
TODO: