-
Notifications
You must be signed in to change notification settings - Fork 241
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
expose MinTLSVersion config for TLS handshake #3103
base: master
Are you sure you want to change the base?
Conversation
cns/service.go
Outdated
|
||
// TLSVersionNumber returns the version number for the provided TLS version name | ||
// (e.g. 0x0301) | ||
func TLSVersionNumber(versionName string) (uint16, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am surprised the standard library doesn't have a parse function for this. I would change this to parseTLSVersionNumber
since that's the convention you would find there.
cns/service.go
Outdated
case "TLS 1.3": | ||
return tls.VersionTLS13, nil | ||
default: | ||
return 0, errors.Wrap(errBootConfig, "unsupported TLS version name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"configuration error" isn't adding a whole lot of information here. I think you can just have unsupported TLS version name
as the constantized error, then include what you tried to parse (the versionName
arg) in the Wrapf
.
cns/service.go
Outdated
@@ -226,8 +232,13 @@ func getTLSConfigFromKeyVault(tlsSettings localtls.TlsSettings, errChan chan<- e | |||
errChan <- cr.Refresh(ctx, tlsSettings.KeyVaultCertificateRefreshInterval) | |||
}() | |||
|
|||
minTLSVersionNumber, err := TLSVersionNumber(tlsSettings.MinTLSVersion) | |||
if err != nil { | |||
return nil, errors.Wrap(err, "MinTLSVersion is not valid") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, for error wrapping, I put what I was trying to do when the error emerged. Here it would be:
return nil, errors.Wrap(err, "MinTLSVersion is not valid") | |
return nil, errors.Wrap(err, "parsing MinTLSVersion from config") |
Doing this gives you a progressive chain of explanation.
Reason for Change:
A configuration change is required in CNS to be able to specify the optional config of minimum TLS version support desired for TLS handshake
Issue Fixed:
Requirements:
Notes: