diff --git a/transport/internet/connection.go b/transport/internet/connection.go index 58ae2144c..61435cbdf 100644 --- a/transport/internet/connection.go +++ b/transport/internet/connection.go @@ -28,12 +28,13 @@ const ( ) type TLSSettings struct { - Certs []tls.Certificate + AllowInsecure bool + Certs []tls.Certificate } func (this *TLSSettings) GetTLSConfig() *tls.Config { config := &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: this.AllowInsecure, } config.Certificates = this.Certs diff --git a/transport/internet/connection_json.go b/transport/internet/connection_json.go index 2d17da916..eba3b0e85 100644 --- a/transport/internet/connection_json.go +++ b/transport/internet/connection_json.go @@ -17,7 +17,8 @@ func (this *TLSSettings) UnmarshalJSON(data []byte) error { KeyFile string `json:"keyFile"` } type JSONConfig struct { - Certs []*JSONCertConfig `json:"certificates"` + Insecure bool `json:"allowInsecure"` + Certs []*JSONCertConfig `json:"certificates"` } jsonConfig := new(JSONConfig) if err := json.Unmarshal(data, jsonConfig); err != nil { @@ -31,6 +32,7 @@ func (this *TLSSettings) UnmarshalJSON(data []byte) error { } this.Certs[idx] = cert } + this.AllowInsecure = jsonConfig.Insecure return nil }