Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
a method to skip server ssl verification (#277)
Browse files Browse the repository at this point in the history
* Update tls.go

when we try to skip server ssl verification. like docker's insecure-registry or kaniko's --skip-tls-verify-registry parameters.

* Update tls.go
  • Loading branch information
wutongjie23hao authored Apr 30, 2020
1 parent ee37808 commit 58cdaa6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/utils/httputil/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func (c *TLSConfig) BuildClient() (*tls.Config, error) {
return c.tls, nil
}

var insecureSkipVerify bool
if c.CA.Disabled {
log.Infof("CA TLS is disabled")
insecureSkipVerify = true
}
var caPool *x509.CertPool
var certs []tls.Certificate
var err error
Expand Down Expand Up @@ -94,7 +99,7 @@ func (c *TLSConfig) BuildClient() (*tls.Config, error) {
RootCAs: caPool,
ServerName: c.Name,
PreferServerCipherSuites: true,
InsecureSkipVerify: false, // This is important to enforce verification of server.
InsecureSkipVerify: insecureSkipVerify, // This is important to enforce verification of server.
}
return c.tls, nil
}
Expand Down

0 comments on commit 58cdaa6

Please sign in to comment.