Skip to content

Commit 3330b9b

Browse files
committed
Add tls_max_version support
1 parent eed0f2d commit 3330b9b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

configutil/listener.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type Listener struct {
4343
TLSCertFile string `hcl:"tls_cert_file"`
4444
TLSKeyFile string `hcl:"tls_key_file"`
4545
TLSMinVersion string `hcl:"tls_min_version"`
46+
TLSMaxVersion string `hcl:"tls_max_version"`
4647
TLSCipherSuites []uint16 `hcl:"-"`
4748
TLSCipherSuitesRaw string `hcl:"tls_cipher_suites"`
4849
TLSPreferServerCipherSuites bool `hcl:"-"`

listenerutil/listener.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,25 @@ PASSPHRASECORRECT:
111111
l.TLSMinVersion = "tls12"
112112
}
113113

114+
if l.TLSMaxVersion == "" {
115+
l.TLSMaxVersion = "tls13"
116+
}
117+
114118
var ok bool
115119
tlsConf.MinVersion, ok = tlsutil.TLSLookup[l.TLSMinVersion]
116120
if !ok {
117121
return nil, nil, fmt.Errorf("'tls_min_version' value %q not supported, please specify one of [tls10,tls11,tls12,tls13]", l.TLSMinVersion)
118122
}
119123

124+
tlsConf.MaxVersion, ok = tlsutil.TLSLookup[l.TLSMaxVersion]
125+
if !ok {
126+
return nil, nil, fmt.Errorf("'tls_max_version' value %q not supported, please specify one of [tls10,tls11,tls12,tls13]", l.TLSMaxVersion)
127+
}
128+
129+
if tlsConf.MaxVersion < tlsConf.MinVersion {
130+
return nil, nil, fmt.Errorf("'tls_max_version' must be greater than or equal to 'tls_min_version'")
131+
}
132+
120133
if len(l.TLSCipherSuites) > 0 {
121134
// HTTP/2 with TLS 1.2 blacklists several cipher suites.
122135
// https://tools.ietf.org/html/rfc7540#appendix-A

0 commit comments

Comments
 (0)