You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-06-15 00:15:00 +02:00
Add option to specify the tls-min-version for the server
This commit is contained in:
@ -91,7 +91,7 @@ func (s *server) setupTLSListener(opts Opts) error {
|
||||
}
|
||||
|
||||
config := &tls.Config{
|
||||
MinVersion: tls.VersionTLS12,
|
||||
MinVersion: tls.VersionTLS12, // default, override below
|
||||
MaxVersion: tls.VersionTLS13,
|
||||
NextProtos: []string{"http/1.1"},
|
||||
}
|
||||
@ -104,6 +104,17 @@ func (s *server) setupTLSListener(opts Opts) error {
|
||||
}
|
||||
config.Certificates = []tls.Certificate{cert}
|
||||
|
||||
if len(opts.TLS.MinVersion) > 0 {
|
||||
switch opts.TLS.MinVersion {
|
||||
case "TLS1.2":
|
||||
config.MinVersion = tls.VersionTLS12
|
||||
case "TLS1.3":
|
||||
config.MinVersion = tls.VersionTLS13
|
||||
default:
|
||||
return errors.New("unknown TLS MinVersion config provided")
|
||||
}
|
||||
}
|
||||
|
||||
listenAddr := getListenAddress(opts.SecureBindAddress)
|
||||
|
||||
listener, err := net.Listen("tcp", listenAddr)
|
||||
|
Reference in New Issue
Block a user