Repository navigation
feat(agent): add the fog-agent CA, CSR signing and the public CA files - #184
Merged
Merged
Conversation
fog-agent enrolls by sending a CSR and getting a client certificate signed by the server's agent CA. This gives fog-node the same two CAs as FOG 1.6, so one agent binary works against either server. - tools/setup/pki.js: ensurePki(dir) makes the root (FOG Server CA) and the agent CA with the 1.6 parameters and regeneration rules, and the bundle. Setup and setup:dev call it after they write config/local.js. - api/helpers/agent/sign-csr.js: signs a CSR as "CN=fog-agent host <id>, O=FOG Project, OU=FOG Agent", 365 days, clientAuth, chain = agent CA only, and verifies the result. - api/helpers/agent/key-fingerprint.js: sha256 of the public-key PEM text. - GET /management/other/ca.cert.pem, ca.cert.der, agent-ca-bundle.pem. - @peculiar/x509 1.x (CommonJS) is the one new dependency. Beyond 1.6: a missing root.pem with a root.key present renames the old key with a timestamp before a new root is made, so a CA key is never lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
fog-node gets the fog-agent certificate authority, exactly as FOG 1.6 makes it, so one fog-agent binary can enroll against either server. This adds no agent route yet; the enroll PR uses it.
tools/setup/pki.jsensurePki(dir): root "FOG Server CA" and "FOG Agent CA" (RSA 4096, sha512, 10950 days, 1.6 subjects and extensions),agent-ca-bundle.pem. 1.6 regeneration rules: the certificate defines "exists"; a re-mint renames the old pair with a UTC timestamp. Keys are 0600 in a 0700 folder.sails.helpers.agent.signCsr: leafCN=fog-agent host <id>, O=FOG Project, OU=FOG Agent, 365 days, clientAuth, no SAN, chain = agent CA only. Checks proof of possession, then verifies the result.sails.helpers.agent.keyFingerprint: sha256 of the public-key PEM text (the 1.6 / agent value, not the DER hash).GET /management/other/ca.cert.pem,ca.cert.der,agent-ca-bundle.pem(public, as in 1.6).npm run setupandsetup:devcallensurePkiafter writingconfig/local.js; acustom.pkiDiroverride is carried forward.@peculiar/x5091.14.3 (1.x is CommonJS). The lockfile diff is additions only.Beyond 1.6: if
root.pemis missing butroot.keyexists, the old key is renamed with a timestamp before a new root is made.Verification
npm test: 242 passing.npm run test:install: all six checks pass.api/helpers/agent/removed, the new tests fail (9 failing).openssl verify -purpose sslclient -CAfile root.pem -untrusted agent-ca.pem leaf.pem→ OK. The fingerprint equalsopenssl pkey -pubout | sha256sum.Reviews: spec (opus) clean; standards (opus) round-2 test duplication fixed.
🤖 Generated with Claude Code