HTTP: Add TLS version configurability for Grafana server (#67482)
Co-authored-by: Rao B V Chalapathi <b_v_chalapathi.rao@nokia.com> Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
This commit is contained in:
co-authored by
Rao B V Chalapathi
Christopher Moyer
parent
5155455c55
commit
b9e53f628f
@@ -166,6 +166,7 @@ type Cfg struct {
|
||||
ReadTimeout time.Duration
|
||||
EnableGzip bool
|
||||
EnforceDomain bool
|
||||
MinTLSVersion string
|
||||
|
||||
// Security settings
|
||||
SecretKey string
|
||||
@@ -1796,6 +1797,11 @@ func (cfg *Cfg) readServerSettings(iniFile *ini.File) error {
|
||||
cfg.SocketPath = server.Key("socket").String()
|
||||
}
|
||||
|
||||
cfg.MinTLSVersion = valueAsString(server, "min_tls_version", "TLS1.2")
|
||||
if cfg.MinTLSVersion == "TLS1.0" || cfg.MinTLSVersion == "TLS1.1" {
|
||||
return fmt.Errorf("TLS version not configured correctly:%v, allowed values are TLS1.2 and TLS1.3", cfg.MinTLSVersion)
|
||||
}
|
||||
|
||||
cfg.Domain = valueAsString(server, "domain", "localhost")
|
||||
cfg.HTTPAddr = valueAsString(server, "http_addr", DefaultHTTPAddr)
|
||||
cfg.HTTPPort = valueAsString(server, "http_port", "3000")
|
||||
|
||||
Reference in New Issue
Block a user