-
Notifications
You must be signed in to change notification settings - Fork 15
Support mTLS #25
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
Support mTLS #25
Conversation
build: adding MBedTLS v3.6.4 as submodule
feat: initialize tls with client cert / key if available (mTLS) test: MQTTc to support client cert & key
X-Ryl669
left a comment
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.
Thank you for your work. It's well written, only a few nitpick changes. I'll come back to you ASAP after trying to merge it in esp-eMQTT5 repo to see if the changes in the CMakeLists.txt file doesn't break mbedtls there.
| else() | ||
| message(WARNING "As of 06/28/2020, MBedTLS is not correctly CMake compatible and does not generate a mbedtls-config.cmake file. You'll need to apply the patch from my branch found in pull request #3465") | ||
| find_package(mbedtls CONFIG REQUIRED) | ||
| endif() |
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.
I haven't checked if the issue was solved on the MBedTLS source code. It seems you're ignoring the mbedtls-config.cmake file and directly specify the libraries in the file. This will work for a direct compilation target but I'm not sure it'll work for cross compiling since the library might be elsewhere (and heavily patched, like in esp-idf's version or Zephyr). Usually, I'm porting this library to ESP32 (in the esp-eMQTT5 repo) and I'm using mbedTLS there. I'll try this port and see if it breaks or if it works.
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.
I added MBedTLS repo as a submodule so the dependencies are built from the sources directly and no packages are searched. But this can be left out her and addressed separately if wanted since it has nothing to do with the mTLS feature directly and is just helpful if you dont want mbedtls as a system requirement.
git submodule add https://github.com/Mbed-TLS/mbedtls
cd mbedtls
git checkout mbedtls-3.6
git submodule update --init --recursive
In this version the header <mbedtls/certs.h> seems to be not available anymore.
|
Ok, I've merged your PR, thanks. It was not possible to embed MbedTLS as a submodule as it broke with our other platforms, so instead, I've reworked the code so you can build mbedtls the way you want, and install it. You can have any version of MbedTLS (heavily patched like ESP-IDF does or vanilla from Github) and it will work. You'll need to specify the path to the Please let me know if it works ok for you this way. |
|
I tested it with building Quick how-to: Thanks for cleaning this up |
Optional arguments added for client certificate & private key and use them for the TLS configuration so we are able to support mutual / two-way TLS.
Also I added the possibility to build
MBedTLSwhen added as a submodule to the project.Tested against a mosquitto broker with self-signed certificates and
MBedTLS v3.6.4