DTS firmware signature verification issues
Component
Dasharo Tools Suite
Device
other
Dasharo version
v2.7.0
Dasharo Tools Suite version
No response
Test case ID
No response
Brief summary
When flashing firmware using DTS it tries to verify signature, with is good. But there are a few issues with that...
How reproducible
No response
How to reproduce
Review how DTS verifies firmware signatures
Expected behavior
There is a full unbroken chain of trust from DTS image to the firmare release. Specifically:
- Prerequisite: User gets DTS image and verifies its signature (using 3mdeb-secpack). iPXE situation could be better (https://github.com/Dasharo/dasharo-issues/issues/270) but at least one can workaround it with using USB and manual verification.
- DTS should have one of master keys embedded already (so the 1th step already establishes trust in that key). It probably should be "3mdeb Dasharo Master Key".
- Then DTS should check what keys are needed for each platform, fetch them, and either explicitly verify key signature, or have the master key preloaded and set to (ultimately) trusted. In the latter case,
gpg --status-fdoption will be useful and look for[GNUPG:] TRUST_FULLY(similar example, generally fail verification if gpg complains "WARNING: This key is not certified with a trusted signature!"); in the former option, look atgpg -k ...output, should have "full" or "ultimate" trust, not "unknown" (I don't know any script-friendly way of checking it this way, or on key import...). If you'd go with the first option, then file verification can use simplergpgvinstead ofgpg --verify. - Having relevant platform key, downloaded artifacts should be verified before using them.
Alternatively to fetching keys in 3, DTS can simply include signing keys for all releases. But that means the need for DTS release when any of them changes, so may not be ideal. OTOH, key URLs are already hardcoded in DTS, so that is already the case if new key version is introduced, so maybe not that bad? Definitely the script will be simpler if DTS would have all relevant keys included already.
Actual behavior
- The
get_signing_keysfunction fetches the release key without checking its signature: https://github.com/Dasharo/dts-scripts/blob/b43ab58df36dbe6fa55f044b45860c9565a2c1ea/include/dts-functions.sh#L719-L730. There is also no master key preloaded in DTS. - The
verify_artifactsfunction uses file before checking its signature: https://github.com/Dasharo/dts-scripts/blob/main/include/dts-functions.sh#L769-L780 (thesha256sumcall should be aftergpg --verify) - PLATFORM_SIGN_KEY is set only for Novacustom laptops, for example it is not set for MSI desktops (where releases are also signed): https://github.com/Dasharo/dts-scripts/blob/main/include/dts-functions.sh#L270
Screenshots
No response
Additional context
No response
Solutions you've tried
No response
@marmarek about point 3, board config is being migrated to https://github.com/Dasharo/dts-configs and PLATFORM_SIGN_KEY is defined there: