Skip to content
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

rpcclient: support SkipVerify of TLS certificate. #39

Merged
merged 1 commit into from
May 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions rpcclient/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,9 @@ type ConnConfig struct {
// the wire in cleartext.
DisableTLS bool

// SkipVerify instruct the client to skip verifying TLS certificate.
SkipVerify bool

// Certificates are the bytes for a PEM-encoded certificate chain used
// for the TLS connection. It has no effect if the DisableTLS parameter
// is true.
Expand Down Expand Up @@ -1295,7 +1298,8 @@ func newHTTPClient(config *ConnConfig) (*http.Client, error) {
pool := x509.NewCertPool()
pool.AppendCertsFromPEM(config.Certificates)
tlsConfig = &tls.Config{
RootCAs: pool,
RootCAs: pool,
InsecureSkipVerify: config.SkipVerify,
}
}
}
Expand All @@ -1318,7 +1322,8 @@ func dial(config *ConnConfig) (*websocket.Conn, error) {
var scheme = "ws"
if !config.DisableTLS {
tlsConfig = &tls.Config{
MinVersion: tls.VersionTLS12,
MinVersion: tls.VersionTLS12,
InsecureSkipVerify: config.SkipVerify,
}
if len(config.Certificates) > 0 {
pool := x509.NewCertPool()
Expand Down