You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: Add support for custom root CA subject - #14
Hi, first of all, thanks for creating minica! Finally a solution that doesn't make my head explode because of cryptic openssl commands.
I added the feature to declare a custom subject for the root CA by providing a JSON file with the necessary fields.
There's still an issue I don't know how to fix: The result looks like OU=,O=Frederic Hemberger,POSTALCODE=,STREET=,L=,ST=,C=DE if not all fields exist in the JSON file. Unfortunately, this gives me a parsing error on macOS because of the empty fields. Is there a way in Go to map only existing fields to avoid this?
I don't have much experience with Go, so I hope the code changes are not too far off.
Hi, first of all, thanks for creating minica! Finally a solution that doesn't make my head explode because of cryptic openssl commands.
You're welcome! Thanks for the kind words, and sorry it's taken a while to get back to you.
I added the feature to declare a custom subject for the root CA by providing a JSON file with the necessary fields.
My goal with minica is to keep it radically simple. Right now it generates a random subject CN, as you've probably seen. Customizing the subject beyond that doesn't add compatibility, standards compliance, or features as far as I know, so my inclination is to not incorporate that into the main program. Please let me know if I'm wrong in that evaluation.
However, minica will load any file named minica.pem in the current directory, so you can definitely create your own self-signed root with another program (or, indeed, with a forked and modified copy of minica).
There's still an issue I don't know how to fix: The result looks like OU=,O=Frederic Hemberger,POSTALCODE=,STREET=,L=,ST=,C=DE if not all fields exist in the JSON file. Unfortunately, this gives me a parsing error on macOS because of the empty fields. Is there a way in Go to map only existing fields to avoid this?
You are unconditionally setting these fields to a one-element slice which sometimes contains an empty string:
PostalCode: []string{subject.PostalCode},
If you want the PostalCode field (for example) to be empty, you need to set it to nil, or possible an empty slice.
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
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.
Hi, first of all, thanks for creating
minica! Finally a solution that doesn't make my head explode because of crypticopensslcommands.I added the feature to declare a custom subject for the root CA by providing a JSON file with the necessary fields.
There's still an issue I don't know how to fix: The result looks like
OU=,O=Frederic Hemberger,POSTALCODE=,STREET=,L=,ST=,C=DEif not all fields exist in the JSON file. Unfortunately, this gives me a parsing error on macOS because of the empty fields. Is there a way in Go to map only existing fields to avoid this?I don't have much experience with Go, so I hope the code changes are not too far off.