Secure OTA updates for small fleets without a big platform
How to run secure OTA updates on hundreds of devices: signed images, bootloader rollback, staged rollout and an update server you run yourself.

Secure OTA updates are one of those features every connected product needs and few small teams want to build. If you are shipping a few hundred or a few thousand devices, a full device-management platform can feel like buying a lorry to move a sofa, yet skipping the basics leaves you with a fleet you cannot safely fix once it is in the field.
This post is for founders and engineers in that middle ground. We set out the parts of an OTA pipeline that are not optional, the parts that can wait, and how to build the essentials with tools you probably already have.
What secure OTA updates actually need to guarantee
Before choosing tools, it helps to be precise about the job. A secure update mechanism has to guarantee four things, and everything else is convenience.
- Authenticity: the device only runs firmware that you signed. Not firmware from your server, not firmware over TLS, but firmware carrying a valid signature from your key.
- Integrity: a corrupted or truncated download is detected before it is booted, never after.
- Recoverability: a bad image, a power cut mid-write or a crash on first boot leaves the device on a working version, not bricked.
- No downgrades: an attacker cannot push an older, signed but vulnerable version back onto the device.
Notice that transport security is not on the list. TLS matters for privacy and for protecting your update server, but the device should trust the signature on the image, not the channel it arrived through. If your only defence is HTTPS, anyone who compromises the server, the CDN bucket or a certificate can ship code to your whole fleet.
Start in the bootloader, not the cloud
Most of the security lives on the device, and most of it is already written for you. The trick is to turn it on early, because some of these settings involve one-time eFuses or option bytes that are awkward to change once boards are in the field.
On the ESP32 family, ESP-IDF supports two OTA app partitions with a small data partition that records which one to boot. Enable app rollback in the bootloader configuration and the new image boots in a pending state; your application must call esp_ota_mark_app_valid_cancel_rollback() once it is satisfied it is healthy, or the bootloader reverts on the next reset. Secure Boot v2 verifies the signature of the bootloader and application at every boot, and flash encryption keeps the image unreadable if someone desolders the flash chip.
On STM32, nRF52 and most Zephyr targets, MCUboot plays the same role. It verifies signed images (ECDSA P-256 and Ed25519 are common choices), supports swap-based updates with a test-then-confirm flow, and can enforce a security counter in the image header so older images are refused. The application confirms itself after a successful boot, just as on the ESP32.
In both cases, design the “healthy” check deliberately. We usually require the device to boot, bring up its radio, reach the backend and complete one normal reporting cycle before it confirms. Confirming at the top of main() defeats the point of rollback.
Signing keys and the build pipeline
The private signing key is now the most valuable secret your company owns. If it leaks, every device you have shipped will accept whatever the holder signs, and with Secure Boot keys burned into eFuses you may not be able to rotate it at all. Some chips support several key slots with revocation, which is worth planning for even if you never use it.
For a small team, a practical setup looks like this:
- Build in CI from a tagged commit so every image is reproducible and traceable to source.
- Keep the production signing key out of CI. Sign on a separate step that uses a hardware token or a cloud key-management service, with a named person approving each release.
- Use a separate development key for test builds, and make sure production devices reject it.
- Record the image hash, version, security counter and signer for every release. You will want this the first time something goes wrong.
None of this needs a platform. It needs about a day of pipeline work and the discipline to never sign a production image on a laptop “just this once”.
A small-fleet update server you can run yourself
For fleets in the hundreds or low thousands, the server side can be simple. Store signed images in object storage, expose a manifest endpoint, and let devices poll it on a schedule or when nudged over MQTT. If you already have an IoT backend shared by the device, dashboard and app, the update service is just another module in it.
The manifest should tell each device which version it should be running, where to download it, the expected size and hash, and any conditions. The device reports back its current version, the result of the last attempt and, if it failed, why. That feedback loop is the difference between “we pushed an update” and “we know what the fleet is running”.
On constrained links, a few details save a lot of grief:
- Resumable downloads: support HTTP range requests or chunked transfer so a dropped connection does not restart a large download from zero.
- Preconditions: refuse to start below a battery threshold, typically somewhere around 20–40% depending on chemistry and how long a flash write takes, and avoid updating during active use.
- Back-off and jitter: randomise check-in times so a thousand devices do not all hit the server at 03:00.
Delta updates are tempting on LoRaWAN or NB-IoT, where a full image can take hours or be impractical. On Wi-Fi and LTE-M they are rarely worth the extra complexity for a small fleet. Ship full images first and add deltas only when bandwidth or airtime costs force it.
Staged rollouts and the rollback you hope not to use
The biggest operational risk is not an attacker, it is your own bug reaching every device at once. Staged rollout is cheap insurance, and with a manifest you control it is mostly a matter of choosing who gets which version.
| Stage | Who | Typical gate before moving on |
|---|---|---|
| Bench | Devices on your desk, including the oldest hardware revision | Clean boot, confirm and full reporting cycle |
| Canary | Internal units plus a small slice of the fleet, often 1–5% | No rise in resets, rollbacks or missed check-ins over a day or two |
| Wider | Around a quarter of the fleet | Same metrics stable across different sites and networks |
| Full | Everyone | Old version retired from the manifest |
Watch the right numbers while you do this. Update success rate, rollback count and reset reasons are the ones that catch problems early, which is why they belong near the top of any fleet dashboard. Keep a pause switch that stops further rollout without touching devices that have already updated.
Test the failure paths on the bench, not in the field. Pull power during the flash write. Ship a deliberately broken image that crashes before confirming. Try to install an image signed with the development key, and one with a lower security counter. If any of these leave a device stuck, you have found your most important bug.
What we would do on a small fleet
If we were setting up secure OTA updates for a new product of a few hundred to a few thousand units, this is the order we would work in:
- Choose the bootloader path (ESP-IDF with Secure Boot v2, or MCUboot) and enable signature checks and rollback on the first prototype, not the last.
- Size flash for two full application slots plus growth; running out of room for the second slot is a painful late discovery.
- Set up release signing outside CI with a protected production key and a separate development key.
- Build a minimal manifest service with version reporting before adding anything clever.
- Write the “healthy” check and test every failure path on the bench.
- Roll out in stages, every time, even for a one-line fix.
A large platform becomes worth it when you need fine-grained device groups, compliance reporting or tens of thousands of units. Until then, a signed image, a careful bootloader and a manifest you understand will keep your fleet both fixable and yours.