This repository was archived by the owner on Mar 2, 2026. It is now read-only.
Generate SSL key and csr on device and support installing a certificate via MQTT#15
Open
mattbnz wants to merge 9 commits into
Open
Generate SSL key and csr on device and support installing a certificate via MQTT#15mattbnz wants to merge 9 commits into
mattbnz wants to merge 9 commits into
Conversation
This is step 1 towards providing an improved "first boot with SSL" experience.
Struggling with stack size here...
Generating a key requires a reasonable number of multi-kb buffers. If we naively put those on the stack we have to enlarge the stack size for the MQTT task, which permanently denies other tasks use of that memory, even though it's going to be almost always unused in the MQTT stack given key generation is a very rare operation. Allocating these buffers explicitly on the heap means the memory is free for everything else to use the rest of the time.
This allows the server to pass back a signed certificate for the monitor, which will check it is signed by the trusted CA and matches the private key previously generated by a requestCert/regenerateKey command and then install it and reboot. This is fully functional for bootstrapping SSL on a device now, but not yet production ready - need further support for updating config, etc first.
Owner
|
Can you give this branch a try please? |
Contributor
Author
|
What are the changes? It's a bit tedious to get a diff between what's in this pull request and what's in the branch because of the changed filenames, etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'd like to be able to have new devices self-register for secure MQTT without having to generate and transfer keys/certs off the device and then flash them on via a full filesytem update.
This adds the necessary logic to have the device itself generate a new key and associated CSR which it will submit via MQTT, and then await receipt of a signed certificate via a return MQTT message. How and if the server actually signs/generates the certs and sends it back is left up to the user, as its likely to be highly context specific.