This repository was archived by the owner on Jan 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
Workarounds to make SSL/TLS work #899
Copy link
Copy link
Closed
Labels
Description
Setting-up an SSL/TLS enabled Server using the ESPAsyncWebServer library is not yet fully documented and straight-forward. I spent a lot of time and finally got it to work. I'd like to share what I have learned, so you can make it work, too.
My setup and basic requirements
- Sonoff-basic (ESP8266)
- Arduino IDE with debugging enabled
- Create a sketch which implements a https Server allowing upload of an updated sketch
- Install ESPAsyncWebServer and its dependency ESPAsyncTCP manually into the Arduino IDE
- starting point is the example sketch Setting up the Server
- Adding SSL functionality according to example needed for TLS #75
Here's an account of the caveats and how to work around them
- Compile error "class AsyncServer has no member named beginSecure"
- This is 'class AsyncServer' has no member named 'beginSecure' #392: Solution:
#define ASYNC_TCP_SSL_ENABLED 1
before#include <ESPAsyncTCP.h>
- This is 'class AsyncServer' has no member named 'beginSecure' #392: Solution:
- Link error:
no matching function for call to AsyncClient::_recv(tcp_pcb*&, pbuf*&, int)
or similar- This is a bug: When setting #define ASYNC_TCP_SSL_ENABLED 1 build fails ESPAsyncTCP#131
- Fix: Install the patched Version of ESPAsyncTCP: https://github.com/jeroenst/ESPAsyncTCP
- Link error:
undefined reference to AsyncWebServer::onSslFileRequest(std::function<int (void*, char const*, unsigned char**)>, void*)
or similar- This is a bug: See SSL TLS Server Secure problem #753 or https://gitter.im/me-no-dev/ESPAsyncWebServer?at=5d746080c59390272030908c
- add
#define ASYNC_TCP_SSL_ENABLED 1
to the top oflibraries/ESPAsyncTCP/src/async_config.h
(Arduino IDE) - This will increase code size even for projects not using SSL, but I didn't find another solution for it.
- don't add it as a compiler flag in platform.local.txt (Arduino IDE), it won't work!
- Now it compiles, but you may get a runtime error:
Error: Feature not supported
after callingserver.beginSecure()
- I tracked that one down to https://github.com/igrr/axtls-8266.
- I thought it just didn't work because I used an unsupported cypher suite. But it wasn't that and I couldn't figure out the reason
- but I found a configuration which works:
openssl genrsa -out Key.pem 1024
openssl req -x509 -out Cert.pem -key Key.pem -new -sha256 -subj /CN=your.domain -addext "keyUsage=digitalSignature,keyEncipherment" -addext extendedKeyUsage=serverAuth
I hope I could help somebody trying to set up an SSL-protected update-server
kind3r, michox, mm108, josemurillodev, hanusek and 4 more