Registry - make minimum TLS version user configurable
Signed-off-by: J. Gregory Rebholz <gregrebholz@gmail.com>
This commit is contained in:
parent
91b0f0559e
commit
cdb62b2b77
4 changed files with 26 additions and 3 deletions
|
@ -135,10 +135,26 @@ func (registry *Registry) ListenAndServe() error {
|
|||
}
|
||||
|
||||
if config.HTTP.TLS.Certificate != "" || config.HTTP.TLS.LetsEncrypt.CacheFile != "" {
|
||||
var tlsMinVersion uint16
|
||||
if config.HTTP.TLS.MinimumTLS == "" {
|
||||
tlsMinVersion = tls.VersionTLS10
|
||||
} else {
|
||||
switch config.HTTP.TLS.MinimumTLS {
|
||||
case "tls1.0":
|
||||
tlsMinVersion = tls.VersionTLS10
|
||||
case "tls1.1":
|
||||
tlsMinVersion = tls.VersionTLS11
|
||||
case "tls1.2":
|
||||
tlsMinVersion = tls.VersionTLS12
|
||||
default:
|
||||
return fmt.Errorf("unknown minimum TLS level '%s' specified for http.tls.minimumtls", config.HTTP.TLS.MinimumTLS)
|
||||
}
|
||||
dcontext.GetLogger(registry.app).Infof("restricting TLS to %s or higher", config.HTTP.TLS.MinimumTLS)
|
||||
}
|
||||
tlsConf := &tls.Config{
|
||||
ClientAuth: tls.NoClientCert,
|
||||
NextProtos: nextProtos(config),
|
||||
MinVersion: tls.VersionTLS10,
|
||||
MinVersion: tlsMinVersion,
|
||||
PreferServerCipherSuites: true,
|
||||
CipherSuites: []uint16{
|
||||
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue