-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add option to set certificate in-memory #6831
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,6 +178,10 @@ type TLSConfig struct { | |
// the Nomad server SSL certificate. | ||
CAPath string | ||
|
||
// CAInMemCert is the PEM-encoded CA cert to use to verify the Nomad server | ||
// SSL certificate. | ||
CAInMemCert []byte | ||
|
||
// ClientCert is the path to the certificate for Nomad communication | ||
ClientCert string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably should expose a raw field for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. I added both. |
||
|
||
|
@@ -348,8 +352,9 @@ func ConfigureTLS(httpClient *http.Client, tlsConfig *TLSConfig) error { | |
|
||
clientTLSConfig := httpClient.Transport.(*http.Transport).TLSClientConfig | ||
rootConfig := &rootcerts.Config{ | ||
CAFile: tlsConfig.CACert, | ||
CAPath: tlsConfig.CAPath, | ||
CAFile: tlsConfig.CACert, | ||
CAPath: tlsConfig.CAPath, | ||
CACertificate: tlsConfig.CAInMemCert, | ||
} | ||
if err := rootcerts.ConfigureTLS(clientTLSConfig, rootConfig); err != nil { | ||
return err | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
I feel a tad uneasy about
InMem
as a public field to indicate that this is the raw cert bytes. I'd probably consider using something with bytes, raw, or even Pem, e.g.CACertPEM
.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.
Agreed. I changed it to
CACertPEM
. What do you think?