mirror of
https://github.com/documize/community.git
synced 2025-07-18 20:59:43 +02:00
Support TLS version selection
Allow config file and ENV variables to define minimum TLS version used for SSL connections. tlsversion=1.3
This commit is contained in:
parent
828c01d189
commit
876775b395
3 changed files with 28 additions and 5 deletions
|
@ -127,11 +127,21 @@ func Start(rt *env.Runtime, s *store.Store, ready chan struct{}) {
|
|||
rt.Log.Info("***")
|
||||
}
|
||||
|
||||
rt.Log.Info("Web Server: starting SSL server on " + rt.Flags.HTTPPort + " with " + rt.Flags.SSLCertFile + " " + rt.Flags.SSLKeyFile)
|
||||
|
||||
cfg := &tls.Config{
|
||||
MinVersion: tls.VersionTLS12,
|
||||
cfg := &tls.Config{}
|
||||
if rt.Flags.TLSVersion == "1.0" {
|
||||
cfg.MinVersion = tls.VersionTLS10
|
||||
}
|
||||
if rt.Flags.TLSVersion == "1.1" {
|
||||
cfg.MinVersion = tls.VersionTLS11
|
||||
}
|
||||
if rt.Flags.TLSVersion == "1.2" {
|
||||
cfg.MinVersion = tls.VersionTLS12
|
||||
}
|
||||
if rt.Flags.TLSVersion == "1.3" {
|
||||
cfg.MinVersion = tls.VersionTLS13
|
||||
}
|
||||
|
||||
rt.Log.Info("Web Server: starting SSL server on " + rt.Flags.HTTPPort + " with " + rt.Flags.SSLCertFile + " " + rt.Flags.SSLKeyFile + " TLS: " + rt.Flags.TLSVersion)
|
||||
|
||||
server := &http.Server{Addr: ":" + rt.Flags.HTTPPort, Handler: n, TLSConfig: cfg}
|
||||
server.SetKeepAlivesEnabled(true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue