Signed Mender OTA updates¶
Signed firmware updates delivered over Mender's OTA channel, with the manufacturer's signing key held inside the HSM.
See it in practice: watch the 90-second walkthrough for this flow on laavat.io.
Secure boot keeps a device from running firmware you did not authorise. Signed updates make sure that what reaches it over the air is equally authentic, for the whole of the product's supported life. The CRA's essential requirements on update distribution and integrity ask for both.
How to read this
This is an example configuration, not a design guide. It shows how a Mender artifact gets its signature from the platform and what the device checks, so that a manufacturer with a Mender setup of its own can take the parts that fit. Building a device this way does not by itself make a product CRA compliant; the Annex I mapping sets out which requirements the platform supports and which remain yours.
Client version
The commands on this page need signing-tool 3.11.0 or later, and were tested on an
Ubuntu 24.04 build host with GNU tar, GNU sed and mender-artifact 4.4.2. The config
file test.ini is set up once, as described in
providing the token.
The three parties¶
-
LAAVAT
Signer
The HSM holds the manufacturer's signing key. It sees only a 32-byte digest of the artifact manifest, never the firmware.
Provides — a signature over the manifest
-
Mender server
Distribution
Hosts the signed
.menderartifact and runs the rollout: scheduling, retries, status reporting.Holds — the artifact, but cannot forge one: devices check the signature
-
mender-client
Verifier and installer
On each device: verifies the signature against the provisioned public key, streams the payload into the inactive partition while checking every file's hash, reboots.
Trusts — the public key or keys in its configuration
Core property — HSM-resident signing key
The RSA or EC private key that authenticates every OTA update stays inside the HSM and has no online export path. What crosses the wire is only a digest of the artifact manifest and the signature over it. Every device in the fleet verifies against the public key or keys in its configuration. See key custody.
What Mender is, and is not¶
Mender is an open-source OTA update system for embedded Linux devices. It solves delivery: getting a signed artifact from a server to a fleet, with rollback. It does not generate signing keys and does not run an HSM.
Mender handles distribution and installation, and LAAVAT handles signing. They meet at
manifest.sig, a base64 signature inside the outer tar of every .mender artifact. The
client trusts an update when that signature verifies against the public key it was
provisioned with.
Inside a .mender artifact¶
A .mender artifact is a plain, uncompressed tar with a strictly ordered layout. The
signature covers the manifest, and the manifest covers every other file by SHA-256.
firmware-v2.1.mender # outer tar (uncompressed)
├── version # format version (v3). Required first.
├── manifest # SHA-256 of version, the header and each payload file, sha256sum(1) format
├── manifest.sig # base64 signature over the manifest: what LAAVAT produces
├── manifest-augment # optional, for augmented/delta artifacts
├── header.tar[.gz|.xz|.zst] # artifact metadata: name, device types, update type
├── header-augment.tar[...] # optional, for augmented artifacts
└── data/0000.tar[.gz|.xz|.zst] # the payload files in a tar, e.g. rootfs.ext4
The format specification fixes the order: version first, then manifest, then the
optional manifest.sig, then the header files, then the data. A changed payload no longer
matches its hash in the manifest, and a changed manifest no longer matches its signature,
so signing the manifest protects the whole artifact. In a delta (augmented) artifact,
manifest-augment and header-augment are not covered by the signature; Mender restricts
what they may contain for that reason
(artifact format v3).
The LAAVAT product¶
Mender signing needs no PKI hierarchy: the device holds a raw public key, not a
certificate chain. One product with one DigestSigning operation is enough. The key is RSA
(Mender recommends at least 3072 bits) or EC P-256. signing-tool produces an RSA PKCS #1
v1.5 signature over SHA-256, or for EC P-256 an ECDSA signature over SHA-256 as 64 bytes (r
and s, 32 bytes each), and base64-encodes either as Mender expects. See
supported keys.
Example product definition¶
Replace the group placeholders with your own group ids; see Approval rule below.
{
"name": "Mender OTA signing",
"description": "Sign Mender .mender artifacts for OTA delivery",
"productType": "Production",
"enabled": true,
"caInfo": [], "rndKeys": [],
"productOperations": [
{ "name": "Mender artifact signing",
"description": "Sign the manifest of a .mender artifact",
"operationType": "DigestSigning",
"token": { "name": "Mender signing key", "description": "RSA key for Mender manifest signing", "keyType": "RSA3072" },
"approvalRule": { "name": "Release", "description": "Release group requests, approver group approves",
"allowedGroups": ["<release-group-uuid>"], "approvalGroups": ["<approver-group-uuid>"], "blanketGroups": [] } }
]
}
Approval rule. The rule decides who may sign. A member of allowedGroups submits the
signing request; it then waits until a member of approvalGroups approves it, in the LAAVAT
console or with signing-tool, and only then does the HSM sign. If the requester is also a
member of one of the blanketGroups, no approval is needed and the request is signed
straight away; that is how an unattended build pipeline, such as a Jenkins job, signs. It
skips the human check, so keep those groups narrow. The group ids in the rule are the object
ids of groups in your identity provider (Microsoft Entra ID or Google Cloud Identity). See
approval rules and
configuration groups.
The public half is exported once with product getpubkey (see
Verifying without a device) and copied to every device as
artifact-verify-key.pem, referenced by ArtifactVerifyKey in the mender-client
configuration.
Replacing the key on a deployed fleet¶
Add a second DigestSigning operation to the product in the LAAVAT console and export its
public key with product getpubkey. Ship an update, still signed with the old key, whose
root filesystem carries the new public key file and a mender.conf that lists both key
files in ArtifactVerifyKeys. After that update every device accepts an artifact that
either key verifies. Sign new artifacts with the new operation once the whole fleet runs the
update, keep the old operation until then, and drop the old key from the list in a later
update. Simplest is to use the list form, ArtifactVerifyKeys, in
/etc/mender/mender.conf from the first image: a rotation is then only adding an entry.
Mender documents the pieces this relies on: ArtifactVerifyKeys takes a list of key files
and only one of ArtifactVerifyKey and ArtifactVerifyKeys may be set
(configuration options);
the main /etc/mender/mender.conf is on the root filesystem, so an update replaces it, while
settings in the persistent fallback file apply only where the main file is silent
(configuration file); several
keys are meant for key rotation
(sign and verify).
Two different keys
This page covers the manufacturer's artifact-signing key. Each Mender client also has its own device-identity key pair for authenticating to the Mender server. That is a separate key with a separate lifecycle, generated on the device at first boot, and out of scope here.
Signing a release¶
Signing takes three steps. The firmware never leaves the build host; only the manifest's digest reaches LAAVAT.
1. Build the unsigned artifact¶
mender-artifact write rootfs-image \
--compatible-types <target-device-type> \
--artifact-name <fw-name-v2.1.0> \
--file rootfs.ext4 \
--output-path firmware.unsigned.mender
For other update types use
mender-artifact write module-image --type <module> --file payload.tar.gz ...; the outer
tar has the same layout.
2. Sign the manifest¶
tar -xf firmware.unsigned.mender manifest
signing-tool -n test.ini imagesigning envelope mender -P <product-uuid> --operid <mender-operation-uuid> \
--state-dir .sign -F manifest -O manifest.sig \
-N "fw 2.1.0" -D "Mender OTA signing"
signing-tool hashes the manifest, sends the digest, waits until the request is approved,
checks the returned signature against the operation's public key and writes manifest.sig,
base64 encoded as Mender expects. If the request is rejected or fails, nothing is written.
--state-dir lets a rerun of the same command pick up a pending request instead of creating
a new request that would need approving again.
3. Put manifest.sig into the artifact¶
mkdir artifact && tar -C artifact -xf firmware.unsigned.mender
cp manifest.sig artifact/
tar -C artifact --format=ustar -cf firmware.signed.mender \
$(tar -tf firmware.unsigned.mender | sed '/^manifest$/a manifest.sig')
The member list comes from the unsigned artifact with manifest.sig added directly after
manifest, so the order is right whatever the header compression and for augmented
artifacts. --format=ustar keeps the POSIX tar format that mender-artifact itself writes.
The result is equivalent to what mender-artifact sign produces, except that the private key
never touched the build host. Signing needs only signing-tool and tar.
What the device does at update time¶
Once the artifact is downloaded, every step is offline: no contact with LAAVAT, and none with the Mender server for the cryptography.
- Verify the manifest signature against the key or keys in
ArtifactVerifyKey(s). If it fails, the update stops before anything is written. - Stream the payload into the inactive partition, hashing it on the way. The running partition is never touched.
- Compare each file's hash with the manifest when its stream ends. A mismatch aborts the update before the reboot.
- Commit or roll back. If the update is not committed after the reboot into the new partition, the bootloader returns to the previous one.
The order follows the client's source: the signature is checked before the payload is read (parser.cpp), and each file's checksum is compared when its stream ends (sha.cpp).
Verifying without a device¶
Fetch the operation's public key once; it is also the file every device's image carries as
artifact-verify-key.pem.
signing-tool -n test.ini product getpubkey -P <product-uuid> --operid <mender-operation-uuid> -O mender_pub.pem
mender-artifact validate -k mender_pub.pem firmware.signed.mender
mender-artifact validate runs the same checks as the client: the signature, every file's
hash and the layout. If it passes, a device with the same public key accepts the artifact.
Where off-device verification stops¶
| Claim | Off-device | What would close the gap |
|---|---|---|
| The manifest signature is valid, for an RSA and an EC P-256 key | Checked on the build host with mender-artifact validate |
Not needed |
| Every payload file's hash matches the manifest; the layout is what the client parses | Checked on the build host with mender-artifact validate |
Not needed |
| A changed payload, a changed signature, another key or a missing signature is rejected | Checked on the build host with mender-artifact validate |
Not needed |
| The device has the right public key provisioned | Not testable off-device | The manufacturing or first-boot provisioning step |
| An Update Module's install script behaves correctly on the target | Not tested | Integration test on the target hardware or in QEMU |
| Rollback on a failed boot actually reverts | Out of scope | Bootloader integration test on the target hardware |
Mapping to the CRA¶
| Annex I requirement | Covered by |
|---|---|
| Part I (2)(f): protect the integrity of programs, commands and configuration against manipulation or modification not authorised by the user | mender-client verifies the manifest signature and every file's hash before the reboot into the new partition |
| Part I (2)(c): vulnerabilities can be addressed through security updates. Part II (7): mechanisms to securely distribute updates | Signed artifacts over Mender, installed to an inactive partition with rollback |
| Supporting evidence, not an Annex I product requirement: custody of the signing key | The signing key stays in the HSM. Only members of the release group can request a signature, and each request is signed only after a member of the approver group approves it. Every request is in the platform's audit trail |
Related¶
- Digest signing — the
envelope menderoptions and the other envelope kinds - Signatures with digest signing — the solution page for raw signatures, CMS and the other envelopes
- Signed SWUpdate updates — the same idea with SWUpdate
- Secure boot and CRA — the other half of the requirement, only running firmware you authorised
- Secure boot on Nordic nRF devices — a secure boot chain on Nordic devices
- Annex I mapping — where secure update distribution sits among the essential requirements
- Security and architecture — where the keys live and who can reach them
References¶
Try this on your own board
A free LAAVAT evaluation runs on the hosted platform. Bring one real image or one device-certificate flow and take it from first login to a verified signature.