Rename signing secret to BMW_NISSAN_FIRMWARE_SIGNING_KEY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,7 @@ name: Firmware
|
|||||||
# "patrol-a|<tag>|<sha256>"). This is what `ota install`
|
# "patrol-a|<tag>|<sha256>"). This is what `ota install`
|
||||||
# on the controller pulls.
|
# on the controller pulls.
|
||||||
#
|
#
|
||||||
# Signing key: repo secret FIRMWARE_SIGNING_KEY (PEM, EC P-256). Its public
|
# Signing key: repo secret BMW_NISSAN_FIRMWARE_SIGNING_KEY (PEM, EC P-256). Its public
|
||||||
# half is compiled into the firmware (include/config/ota_config.h) and kept in
|
# half is compiled into the firmware (include/config/ota_config.h) and kept in
|
||||||
# tools/ota/firmware_signing_pub.pem, which this job uses to self-check the
|
# tools/ota/firmware_signing_pub.pem, which this job uses to self-check the
|
||||||
# signature before publishing. See wiki/pages/ota-updates.md.
|
# signature before publishing. See wiki/pages/ota-updates.md.
|
||||||
@@ -74,15 +74,15 @@ jobs:
|
|||||||
- name: Sign + manifest (tags only)
|
- name: Sign + manifest (tags only)
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
env:
|
env:
|
||||||
FIRMWARE_SIGNING_KEY: ${{ secrets.FIRMWARE_SIGNING_KEY }}
|
BMW_NISSAN_FIRMWARE_SIGNING_KEY: ${{ secrets.BMW_NISSAN_FIRMWARE_SIGNING_KEY }}
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
[ -n "$FIRMWARE_SIGNING_KEY" ] || { echo "::error::secret FIRMWARE_SIGNING_KEY is not set"; exit 1; }
|
[ -n "$BMW_NISSAN_FIRMWARE_SIGNING_KEY" ] || { echo "::error::secret BMW_NISSAN_FIRMWARE_SIGNING_KEY is not set"; exit 1; }
|
||||||
SHA=$(sha256sum dist/firmware.bin | cut -d' ' -f1)
|
SHA=$(sha256sum dist/firmware.bin | cut -d' ' -f1)
|
||||||
SIZE=$(stat -c%s dist/firmware.bin)
|
SIZE=$(stat -c%s dist/firmware.bin)
|
||||||
printf '%s' "patrol-a|${VERSION}|${SHA}" > stmt.txt
|
printf '%s' "patrol-a|${VERSION}|${SHA}" > stmt.txt
|
||||||
umask 077
|
umask 077
|
||||||
printf '%s\n' "$FIRMWARE_SIGNING_KEY" > key.pem
|
printf '%s\n' "$BMW_NISSAN_FIRMWARE_SIGNING_KEY" > key.pem
|
||||||
openssl dgst -sha256 -sign key.pem -out sig.der stmt.txt
|
openssl dgst -sha256 -sign key.pem -out sig.der stmt.txt
|
||||||
rm -f key.pem
|
rm -f key.pem
|
||||||
# Self-check against the public key the firmware carries.
|
# Self-check against the public key the firmware carries.
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ Settings persist across power cycles via ESP32 NVS (Non-Volatile Storage):
|
|||||||
|
|
||||||
### OTA updates (`ota` console)
|
### OTA updates (`ota` console)
|
||||||
|
|
||||||
`src/modules/ota_update.cpp` pulls signed firmware from this repo's Gitea releases (`include/config/ota_config.h`: server, repo, Let's Encrypt roots, signing public key). Manual only: `ota status | check | install [force] | rollback` - the future password-gated Diagnostics screen will call the same code. Install is refused unless parked (engine off, shaft still, lever not in a drive gear; silent bus = parked), checked before download and again before the slot switch. The manifest's ECDSA P-256 signature over `patrol-a|version|sha256` is checked before download; the streamed image must match that sha256. `verifyRollbackLater()` is overridden so a new image stays pending until `Ota::tick()` confirms it after 30 s - a reset before that rolls back. CI: `.gitea/workflows/firmware.yml` (push `main` -> rolling unsigned pre-release `main-latest`; tag `v*` -> signed release, needs repo secret `FIRMWARE_SIGNING_KEY`). Never put secrets in firmware source - the repo and its release binaries are public. Details: `wiki/pages/ota-updates.md`.
|
`src/modules/ota_update.cpp` pulls signed firmware from this repo's Gitea releases (`include/config/ota_config.h`: server, repo, Let's Encrypt roots, signing public key). Manual only: `ota status | check | install [force] | rollback` - the future password-gated Diagnostics screen will call the same code. Install is refused unless parked (engine off, shaft still, lever not in a drive gear; silent bus = parked), checked before download and again before the slot switch. The manifest's ECDSA P-256 signature over `patrol-a|version|sha256` is checked before download; the streamed image must match that sha256. `verifyRollbackLater()` is overridden so a new image stays pending until `Ota::tick()` confirms it after 30 s - a reset before that rolls back. CI: `.gitea/workflows/firmware.yml` (push `main` -> rolling unsigned pre-release `main-latest`; tag `v*` -> signed release, needs repo secret `BMW_NISSAN_FIRMWARE_SIGNING_KEY`). Never put secrets in firmware source - the repo and its release binaries are public. Details: `wiki/pages/ota-updates.md`.
|
||||||
|
|
||||||
### ESP-NOW link
|
### ESP-NOW link
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Nothing in here is secret: the CA roots and the signing PUBLIC key are meant
|
* Nothing in here is secret: the CA roots and the signing PUBLIC key are meant
|
||||||
* to be public. The signing private key lives only in the Gitea repo secret
|
* to be public. The signing private key lives only in the Gitea repo secret
|
||||||
* FIRMWARE_SIGNING_KEY (plus the owner's offline backup).
|
* BMW_NISSAN_FIRMWARE_SIGNING_KEY (plus the owner's offline backup).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OTA_CONFIG_H
|
#ifndef OTA_CONFIG_H
|
||||||
|
|||||||
+1
-1
@@ -112,4 +112,4 @@ Tightened the live-data findings after checking the full capture: the Launch use
|
|||||||
|
|
||||||
## [2026-09-26] build | OTA updates for Controller A
|
## [2026-09-26] build | OTA updates for Controller A
|
||||||
|
|
||||||
Repartitioned A to dual OTA slots (2 x 7.9 MB, SPIFFS dropped, nvs/otadata offsets kept - tunables v150 survived the one-time USB flash on COM10, verified). New src/modules/ota_update.cpp + include/config/ota_config.h: manual `ota status|check|install|rollback` console; HTTPS pull from the (now public) Gitea repo's latest release, ECDSA P-256 signature over "patrol-a|version|sha256" checked before download, image hashed while streaming, parked gate before download and before slot switch, rollback via verifyRollbackLater() override + 30 s confirm. TLS trusts ISRG Root X1 + Root YR (both verified against the server chain). CI: .gitea/workflows/firmware.yml (main -> rolling unsigned pre-release main-latest; v* tag -> signed release with manifest.txt). Decisions: manual trigger (future Diagnostics screen), public repos instead of a device token, Controller B to be updated by A over ESP-NOW (wire is one-way). Wrote pages/ota-updates.md. Pending: FIRMWARE_SIGNING_KEY repo secret, enable repo Actions, first v* tag to test end-to-end.
|
Repartitioned A to dual OTA slots (2 x 7.9 MB, SPIFFS dropped, nvs/otadata offsets kept - tunables v150 survived the one-time USB flash on COM10, verified). New src/modules/ota_update.cpp + include/config/ota_config.h: manual `ota status|check|install|rollback` console; HTTPS pull from the (now public) Gitea repo's latest release, ECDSA P-256 signature over "patrol-a|version|sha256" checked before download, image hashed while streaming, parked gate before download and before slot switch, rollback via verifyRollbackLater() override + 30 s confirm. TLS trusts ISRG Root X1 + Root YR (both verified against the server chain). CI: .gitea/workflows/firmware.yml (main -> rolling unsigned pre-release main-latest; v* tag -> signed release with manifest.txt). Decisions: manual trigger (future Diagnostics screen), public repos instead of a device token, Controller B to be updated by A over ESP-NOW (wire is one-way). Wrote pages/ota-updates.md. Pending: BMW_NISSAN_FIRMWARE_SIGNING_KEY repo secret, enable repo Actions, first v* tag to test end-to-end.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ How Controller A updates itself from this repo's Gitea releases, why each piece
|
|||||||
```
|
```
|
||||||
git push tag vX.Y.Z ──► Gitea Actions (.gitea/workflows/firmware.yml, runner ubuntu-latest)
|
git push tag vX.Y.Z ──► Gitea Actions (.gitea/workflows/firmware.yml, runner ubuntu-latest)
|
||||||
pio run (-DFW_VERSION="vX.Y.Z")
|
pio run (-DFW_VERSION="vX.Y.Z")
|
||||||
sign "patrol-a|vX.Y.Z|<sha256>" with secret FIRMWARE_SIGNING_KEY
|
sign "patrol-a|vX.Y.Z|<sha256>" with secret BMW_NISSAN_FIRMWARE_SIGNING_KEY
|
||||||
release vX.Y.Z: firmware.bin + firmware.elf + manifest.txt
|
release vX.Y.Z: firmware.bin + firmware.elf + manifest.txt
|
||||||
│ public repo, HTTPS, no token
|
│ public repo, HTTPS, no token
|
||||||
Controller A `ota install` ◄──────┘ (parked, Wi-Fi joined)
|
Controller A `ota install` ◄──────┘ (parked, Wi-Fi joined)
|
||||||
@@ -60,7 +60,7 @@ Wi-Fi must be joined via the Settings screen first. Joining an AP moves the radi
|
|||||||
|
|
||||||
## Secrets and keys
|
## Secrets and keys
|
||||||
|
|
||||||
- `FIRMWARE_SIGNING_KEY` — Gitea **repo secret** (Settings → Actions → Secrets), the EC P-256 private key PEM. Generated 2026-09-26; keep an offline backup. Losing it means devices only accept updates after one USB flash with a new public key.
|
- `BMW_NISSAN_FIRMWARE_SIGNING_KEY` — Gitea **repo secret** (Settings → Actions → Secrets), the EC P-256 private key PEM. Generated 2026-09-26; keep an offline backup. Losing it means devices only accept updates after one USB flash with a new public key.
|
||||||
- Public key: compiled in (`OTA_SIGNING_PUBKEY_PEM`) and in `tools/ota/firmware_signing_pub.pem` (CI self-checks each signature against it before publishing).
|
- Public key: compiled in (`OTA_SIGNING_PUBKEY_PEM`) and in `tools/ota/firmware_signing_pub.pem` (CI self-checks each signature against it before publishing).
|
||||||
- Rotating the key: new keypair → update both public-key copies → USB-flash once (a device only trusts the key it was built with).
|
- Rotating the key: new keypair → update both public-key copies → USB-flash once (a device only trusts the key it was built with).
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user