IoT and Smart Systems Engineer · Projects

Project 3: Safe over-the-air updates

Marking guide version 1 · Lessons: IO9 lessons 1–5, IO10 lesson 4

The problem and who it's for

Once tanks are installed, nobody wants to climb up to each one to fix a bug. In the starter, the update code doesn't check signatures, accepts any different version (even an older one), writes over the firmware that's running, starts again from the beginning after a dropped download, ignores the battery, has no trial or rollback, and picks rollout devices at random. A signing seed is written in the code, and the rollout sends every update to every device at once. The committee needs updates that only come from the project, can't leave a tank monitor dead, and reach a few devices before all of them.

Scope

Not included

Before you start

Starter files

Download everything at once: starter/iot-starter.zip.

Milestones

  1. Read docs/FORMATS.md and sim/factory.py, make a key pair outside the project, and sign a test release.
  2. Check signatures and hashes, and add anti-rollback (tests 1 and 2).
  3. Download into the other slot with resume and the battery check (tests 3, 4 and 5).
  4. Add trial boots and rollback without reinstalling (test 6).
  5. Remove the seed from the code and fix .gitignore (test 7).
  6. Write the rollout plan and docs/ota-design.md (test 8), then run all 8 tests twice in a row.

Expected outputs

Acceptance tests

# Input Expected result
1 pytest tests/test_ota.py 8 of 8 pass, twice in a row
2 A changed image; a manifest signed with another key; an older version Each is refused, and nothing is downloaded for a bad signature (tests 1 and 2)
3 An update; a dropped download; a low battery The running slot is untouched, the download resumes from the last chunk, and no update starts below the battery minimum (tests 3, 4 and 5)
4 Healthy and unhealthy new firmware Healthy firmware is confirmed; unhealthy firmware rolls back after three boots and isn't reinstalled (test 6)
5 The project's files; ota/rollout.json; docs/ota-design.md No key in the code or repository, the tools work with a key kept outside, stages with halt rules and a fixed choice of devices, and the design written down (tests 7 and 8)

Failure and recovery exercises

  1. Turn off the signature check and run test 1. Explain what an attacker on the same network could do, then restore it.
  2. Write the update over the running slot and run test 3. Explain what a power cut mid-update would do, then restore the second slot.
  3. Pick stage devices at random and run test 8. Explain why the stages stop meaning anything, then restore the hash of the device ID.

Evidence to submit

Marking guide and self-check

Pass rule: every Safety-critical (S) and Mandatory (M) item must be met. A single unmet safety item means the project is not complete, whatever else is done. Quality items are for your own improvement.

Your answers are saved in this browser on this device. Self-checked means you checked your own work against this guide; it is not a reviewer's approval. Never paste passwords, keys, tokens or real customer data here.

Checklist (marking guide version 1)
Evidence

← PreviousReadings that survive drops and power cuts
ProLearners Assist