feat(security): pin two bootstrap signing keys (automated signer + offline backup) (F5)
The single pinned key CbyBk7... has no secret half on record, so it could never
sign anything. Bootstraps are now built, verified and signed weekly by a
dedicated signer box, and an offline backup key covers loss or revocation of
that key. A signature is accepted if it verifies against either pinned key.
- bootstrap.h: kBootstrapSignaturePublicKeysBase64[] = { hot GHgDNfZV..., cold MZi/rTuQ... }
- bootstrap.cpp: Bootstrap::signatureMatchesPinnedKey() checks every pinned key
(no network, unit-testable); a present signature matching none stays fatal.
- tests: the known answer is now a real signer-box signature over a real weekly
checksum (height 3449343); covers tamper, garbage, empty and wrong-key cases,
the two keys being distinct and valid, and CbyBk7 no longer being pinned.
- sign-bootstrap-release.sh: the key check accepts any pinned key.
kBootstrapRequireSignature stays false until every served bootstrap carries a
signature.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+11
-6
@@ -1162,14 +1162,19 @@ bool Bootstrap::verifyChecksums(const std::string& zipPath, const std::string& b
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bootstrap::verifyArchiveSignature(const std::string& sha256Content, const std::string& baseUrl) {
|
||||
const std::string pubKey = kBootstrapSignaturePublicKeyBase64 ? kBootstrapSignaturePublicKeyBase64 : "";
|
||||
bool Bootstrap::signatureMatchesPinnedKey(const std::string& sha256Content, const std::string& sigFileContent) {
|
||||
for (const char* pubKey : kBootstrapSignaturePublicKeysBase64) {
|
||||
if (util::verifyXmrigSignature(sha256Content, sigFileContent, pubKey)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Bootstrap::verifyArchiveSignature(const std::string& sha256Content, const std::string& baseUrl) {
|
||||
HttpGetOptions opt; opt.cancel = &cancel_requested_;
|
||||
const std::string sig = httpGetString(baseUrl + "/" + kZipName + ".sha256.sig", "[bootstrap]", opt);
|
||||
if (cancel_requested_) return false;
|
||||
|
||||
if (sig.empty() || pubKey.empty()) {
|
||||
if (sig.empty()) {
|
||||
if (kBootstrapRequireSignature) {
|
||||
DEBUG_LOGF("[Bootstrap] No ed25519 signature published - refusing (signature required)\n");
|
||||
setProgress(State::Failed, "Verification failed: the bootstrap is not signed. "
|
||||
@@ -1182,13 +1187,13 @@ bool Bootstrap::verifyArchiveSignature(const std::string& sha256Content, const s
|
||||
|
||||
// Verify over the EXACT .sha256 bytes the signer signed (not the parsed hash). A present-but-invalid
|
||||
// signature is always fatal — it means the checksum we just trusted was not issued by us.
|
||||
if (!util::verifyXmrigSignature(sha256Content, sig, pubKey)) {
|
||||
if (!signatureMatchesPinnedKey(sha256Content, sig)) {
|
||||
DEBUG_LOGF("[Bootstrap] ed25519 signature MISMATCH - refusing\n");
|
||||
setProgress(State::Failed, "Verification failed: the bootstrap signature did not match the pinned "
|
||||
setProgress(State::Failed, "Verification failed: the bootstrap signature did not match any pinned "
|
||||
"release key. Refusing to install.");
|
||||
return false; // fail CLOSED; archive is KEPT
|
||||
}
|
||||
DEBUG_LOGF("[Bootstrap] ed25519 signature verified against the pinned key\n");
|
||||
DEBUG_LOGF("[Bootstrap] ed25519 signature verified against a pinned key\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user