-
Notifications
You must be signed in to change notification settings - Fork 58
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
server: accept TLS certificate and key #2398
Conversation
Fixes a bug in the cliopts hook for FromString. It was incorrectly returning the reflect.Value instead of the underlying value.
BasicConstraintsValid: true, | ||
} | ||
|
||
caPrivKey, err := rsa.GenerateKey(rand.Reader, 4096) | ||
caBytes, err := x509.CreateCertificate(rand.Reader, ca, ca, &caPrivKey.PublicKey, caPrivKey) |
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.
Previously we were only creating the x509.Certificate
manually, which does not give us any way to serialize it (as far as I can tell).
By calling CreateCertificate
it creates the asn.1 DER bytes we need to serialize the certificate. When doing this I ran into an error which I believe is because we were not setting IsCA
above.
I left a TODO below about this, but I could not find any other way to allow us to serialize this CA.
// certificate, or that will be used to generate a certificate if one was | ||
// not provided. | ||
CA types.StringOrFile | ||
CAPrivateKey string |
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.
What will the CAPrivateKey here be used for? It's only in a test at the moment and frequently people won't have access to this.
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.
Good question, it gets used in #2401 which is the follow up to this
Co-authored-by: Bruce MacDonald <[email protected]>
Summary
Allow a user to specify the certificate and key to use for TLS.
Also fixes a couple bugs:
cliopts
hook for using aSet(string) error
function to parse a config field from a stringRelated Issues
This is part 1 of #2176