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

Config parameter "tls_disable_client_certs" is wrongly evaluated. #4049

Merged
merged 10 commits into from
Feb 28, 2018
7 changes: 6 additions & 1 deletion command/server/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ PASSPHRASECORRECT:
if disableClientCerts && requireVerifyCerts {
return nil, nil, nil, fmt.Errorf("'tls_disable_client_certs' and 'tls_require_and_verify_client_cert' are mutually exclusive")
}
tlsConf.ClientAuth = tls.NoClientCert
if disableClientCerts {
tlsConf.ClientAuth = tls.NoClientCert
}
if !disableClientCerts {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if section shouldn't be here. Only the first is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If "tls_disable_client_certs" is set to false, then if client provides a certificate shouldn't it be validated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I overlooked the default value set.

tlsConf.ClientAuth = tls.VerifyClientCertIfGiven
}
}

ln = tls.NewListener(ln, tlsConf)
Expand Down