-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 tls client options to api/cli #2914
Conversation
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.
Just one fix to the help text, looks good!
command/base/command.go
Outdated
"can also be specified via the CONSUL_CACERT environment variable.") | ||
f.Var(&c.caPath, "ca-path", | ||
"Path to a directory of CA certificates to use for TLS when communicating "+ | ||
"with Consul. is enabled. This can also be specified via the CONSUL_CAPATH "+ |
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.
"when `verify_incoming` is enabled"
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.
shouldn't the "is enabled." just be removed here? the CA settings can be used even when verify_incoming
isn't enabled
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.
that's true
@@ -347,6 +368,41 @@ func NewClient(config *Config) (*Client, error) { | |||
config.HttpClient = defConfig.HttpClient | |||
} |
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.
So, with below I can pass my own HttpClient
, with my own RoundTripper
if config.HttpClient == nil {
config.HttpClient = defConfig.HttpClient
}
but the line
config.HttpClient.Transport.(*http.Transport).TLSClientConfig = tlsClientConfig
brakes it as it assumes standard RoundTripper
implementation
One way to solve that is to add new func I might be missing something with my train of thoughts so let me know if that's the case ;) |
This adds TLS client options to the api and cli for providing client certs and setting the TLS server name when connecting to Consul.