-
Notifications
You must be signed in to change notification settings - Fork 21
Add device security verification guide #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
tdewey-rpi
commented
Aug 7, 2025
- Introduced a comprehensive guide for verifying the security configuration of provisioned Raspberry Pi devices, covering secure boot enforcement, firmware version checks, device-specific encryption key validation, encryption key usage, and JTAG status verification.
- Included detailed prerequisites, verification procedures, and troubleshooting tips to assist users in ensuring device security compliance.
- Added an automated verification script and API-based verification methods for enhanced usability and efficiency in security checks.
Written with the liberal help of Claude - I've took a few review passes at it, but I'm too close to the doc to find more problems now. |
Thanks for the effort on this one, it's a great start. I've had a few issues with the verification process against a newly provisioned CM4 using rpi-sb-provisioner v2.0.5:
What did work:
Happy to provide additional information on any of the items above if it'd be helpful. |
Could you go into a bit more detail about how to do this? I'd like to try to reproduce. |
Regarding the scaling recommendations documentation that you removed: what is a provisioning station and also what is a provisioning station head? Is that a raspberry pi 5 device running rpi-sb-provisioner? |
Certainly. I then downloaded and compiled a fresh copy of the secure-boot example:
Then I signed the EEPROM image and booted the CM4 from it to generate the metadata file:
The "CUSTOMER_KEY_HASH" value in the metadata json file doesn't match the SHA256 of the private key used to provision the device. |
- Introduced a comprehensive guide for verifying the security configuration of provisioned Raspberry Pi devices, covering secure boot enforcement, firmware version checks, device-specific encryption key validation, encryption key usage, and JTAG status verification. - Included detailed prerequisites, verification procedures, and troubleshooting tips to assist users in ensuring device security compliance. - Added an automated verification script and API-based verification methods for enhanced usability and efficiency in security checks.
…erification procedures - Revised the device verification guide to include updated SQL queries for checking secure boot status, customer key programming, and JTAG locking from the manufacturing database. - Improved clarity in expected results for secure boot and encryption verification steps. - Added comprehensive on-device and manufacturing database verification scripts to streamline security checks. - Enhanced documentation for better user understanding of verification processes and expected outcomes.
15a32da
to
4a8bb03
Compare
I'm technically on PTO for another week, but the curiosity of this got the better of me - until I realised it was likely a framing problem. I've pushed an update to the guide that should address most of the concerns - most notably, newer versions of rpi-sb-provisioner capture much more of the relevant data in the manufacturing database. |
The manual calculation of the key hash in the comment is wrong because it’s using the DER encoding so you can’t attempt to manually verify it this way. The bootrom uses the big number values directly. |
See https://github.com/raspberrypi/rpi-eeprom/blob/master/tools/rpi-bootloader-key-convert for how to extract the components of the key used by the bootrom |
|
||
[source,bash] | ||
---- | ||
# Use rpiboot to fetch device metadata and verify customer signing key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MAC_ADDR=$(jq -r '.MAC_ADDR // "unknown"' "$METADATA_FILE") | ||
USER_BOARDREV=$(jq -r '.USER_BOARDREV // "unknown"' "$METADATA_FILE") | ||
echo " Device MAC: $MAC_ADDR" | ||
echo " Board revision: $USER_BOARDREV" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not suer USER_BOARDREV has been used
**Expected Result**: | ||
- `vcgencmd version` returns a git commit hash (e.g., `5560078dcc8591a00f57b9068d13e5544aeef3aa`) rather than a date-based version name. This is normal behavior, and should be verified against the bootloader version you selected during provisioning. | ||
- `rpi-eeprom-update -a` shows the firmware file used and available updates | ||
- `vcgencmd bootloader_config | strings` filters the binary output to show readable configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rpi-eeprom-config without arugments is preferred over vcgencmd. We should use the direct device-tree interface wherever possible instead of vcgencmd / vcmailbox
Thanks for all the extra effort on this. I've re-provisioned a CM4 using v2.1.1 of rpi-sb-provisioner, however I'm still running into a few issues while verifying the status after provisioning is complete:
Below is an output of the comprehensive verification script when run on the provisioned device:
I'm happy to assist in any way I can with this, please let me know if there's any further tests or details required. |
@octal-ip Just to confirm - did you use the latest version of this PR? |