Skip to content

Commit

Permalink
Merge pull request #32 from dbudworth/add_tls_insecure
Browse files Browse the repository at this point in the history
added tls_insecure option
  • Loading branch information
twmb authored Aug 4, 2023
2 parents 2841326 + c181f09 commit 9724026
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type CfgTLS struct {
ClientKeyPath string `toml:"client_key_path,omitempty"`
ServerName string `toml:"server_name,omitempty"`

InsecureSkipVerify bool `toml:"insecure,omitempty"`

MinVersion string `toml:"min_version,omitempty"`
CipherSuites []string `toml:"cipher_suites"`
CurvePreferences []string `toml:"curve_preferences"`
Expand Down Expand Up @@ -294,6 +296,7 @@ func (c *Client) processOverrides() {
"tls_ca_cert_path": func(c *Cfg, v string) error { mktls(c); c.TLS.CACert = v; return nil },
"tls_client_cert_path": func(c *Cfg, v string) error { mktls(c); c.TLS.ClientCertPath = v; return nil },
"tls_client_key_path": func(c *Cfg, v string) error { mktls(c); c.TLS.ClientKeyPath = v; return nil },
"tls_insecure": func(c *Cfg, _ string) error { mktls(c); c.TLS.InsecureSkipVerify = true; return nil },
"tls_server_name": func(c *Cfg, v string) error { mktls(c); c.TLS.ServerName = v; return nil },
"tls_min_version": func(c *Cfg, v string) error { mktls(c); c.TLS.MinVersion = v; return nil },
"tls_cipher_suites": func(c *Cfg, v string) error { mktls(c); return intoStrSlice(v, &c.TLS.CipherSuites) },
Expand Down Expand Up @@ -444,6 +447,7 @@ func (c *Client) loadTLS() (*tls.Config, error) {

tc := new(tls.Config)

tc.InsecureSkipVerify = c.cfg.TLS.InsecureSkipVerify
switch strings.ToLower(c.cfg.TLS.MinVersion) {
case "", "v1.2", "1.2":
tc.MinVersion = tls.VersionTLS12 // the default
Expand Down

0 comments on commit 9724026

Please sign in to comment.