Repository navigation
Add issue ca subcommand for subordinate certificate authorities. - #10
Merged
Merged
Conversation
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.
Adds
devca issue ca NAME [-d DOMAIN]... [-n NETWORK]..., which issues a subordinate certificate authority signed by the authority in the working directory (ca.crt/ca.key). It takes the same name-constraint flags asinit, but the name is required.The subordinate authority:
CertSign/CRLSignkey usage and pathlen 0, so it can issue server and code signing certificates but not other authorities;initname constraints, including the rule that a domains-only authority excludes every IP range;It writes
name-serial.crt/name-serial.keylike the other issue commands. To issue certificates with it, copy its files to a new directory asca.crt/ca.keyand rundevca issue serverordevca issue codesignthere; the README documents the workflow.Implementation notes:
internal/ca/ca.go:IssueCertificateAuthoritylives next toNewCertificateAuthorityand both share the excluded-networks rule.internal/ca/constraints.go: name-constraint knowledge in one place (excluded ranges and RFC 5280 nesting validation).internal/ca/issue.go: signing core extracted intosign; the leafissuepath still forcesIsCA = false.devca.go: newcaCommand;parseNetworkshelper shared byinitandissue ca.Tests cover the happy path (including full chain verification through the subordinate with
x509.Verify), constraint acceptance and rejection, excluded IP ranges, missing name, non-CA signer, pathlen-0 signer, expiring parent, and the constraint helpers. The chain was also verified end-to-end withopenssl verify.