Skip to content

Commit 6dea408

Browse files
committed
Tweak insecure certificate validation.
1 parent fc29c36 commit 6dea408

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: lib/srv/db/common/auth.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,15 @@ func (a *dbAuth) getTLSConfigVerifyFull(ctx context.Context, sessionCtx *Session
382382
// getTLSConfigInsecure generates tls.Config when TLS mode is equal to 'insecure'.
383383
// Generated configuration will accept any certificate provided by database.
384384
func (a *dbAuth) getTLSConfigInsecure(ctx context.Context, sessionCtx *Session) (*tls.Config, error) {
385-
tlsConfig := &tls.Config{
386-
RootCAs: x509.NewCertPool(),
385+
tlsConfig, err := a.getTLSConfigVerifyFull(ctx, sessionCtx)
386+
if err != nil {
387+
return nil, trace.Wrap(err)
387388
}
388389

389390
// Accept any certificate provided by database.
390391
tlsConfig.InsecureSkipVerify = true
392+
// Remove certificate validation if set.
393+
tlsConfig.VerifyConnection = nil
391394

392395
return a.appendClientCert(ctx, sessionCtx, tlsConfig)
393396
}

0 commit comments

Comments
 (0)