Set the ServerName for TLS configuration (#988)
When TLS hostname validation used for the MySQL connection, the ServerName property needs to be set so that it knows which name to validate on the certificate. Without this option and with InsecureSkipVerify set to false, validation will error here with a fatal error otherwise: ``` FATAL tls: either ServerName or InsecureSkipVerify must be specified in the tls.Config ```
This commit is contained in:
parent
9bc508f068
commit
40acde0222
@ -92,6 +92,7 @@ func (this *ConnectionConfig) UseTLS(caCertificatePath, clientCertificate, clien
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.tlsConfig = &tls.Config{
|
this.tlsConfig = &tls.Config{
|
||||||
|
ServerName: this.Key.Hostname,
|
||||||
Certificates: certs,
|
Certificates: certs,
|
||||||
RootCAs: rootCertPool,
|
RootCAs: rootCertPool,
|
||||||
InsecureSkipVerify: allowInsecure,
|
InsecureSkipVerify: allowInsecure,
|
||||||
|
Loading…
Reference in New Issue
Block a user