From 94eff503069d4f1a73cd4f52f0c2813c0cd44ce2 Mon Sep 17 00:00:00 2001 From: Andrea Scarpino Date: Mon, 13 Jan 2025 19:14:26 +0000 Subject: [PATCH] root: redis, make sure tlscacert isn't an empty string (#12407) * root: redis, make sure tlscacert isn't an empty string * make TLSCaCert a string instead of pointer Signed-off-by: Jens Langhammer --------- Signed-off-by: Jens Langhammer Co-authored-by: Jens Langhammer --- internal/config/struct.go | 16 ++++++++-------- internal/outpost/proxyv2/application/session.go | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/config/struct.go b/internal/config/struct.go index a9252ec4e3..4bd4cd97c3 100644 --- a/internal/config/struct.go +++ b/internal/config/struct.go @@ -26,14 +26,14 @@ type Config struct { } type RedisConfig struct { - Host string `yaml:"host" env:"HOST, overwrite"` - Port int `yaml:"port" env:"PORT, overwrite"` - DB int `yaml:"db" env:"DB, overwrite"` - Username string `yaml:"username" env:"USERNAME, overwrite"` - Password string `yaml:"password" env:"PASSWORD, overwrite"` - TLS bool `yaml:"tls" env:"TLS, overwrite"` - TLSReqs string `yaml:"tls_reqs" env:"TLS_REQS, overwrite"` - TLSCaCert *string `yaml:"tls_ca_certs" env:"TLS_CA_CERT, overwrite"` + Host string `yaml:"host" env:"HOST, overwrite"` + Port int `yaml:"port" env:"PORT, overwrite"` + DB int `yaml:"db" env:"DB, overwrite"` + Username string `yaml:"username" env:"USERNAME, overwrite"` + Password string `yaml:"password" env:"PASSWORD, overwrite"` + TLS bool `yaml:"tls" env:"TLS, overwrite"` + TLSReqs string `yaml:"tls_reqs" env:"TLS_REQS, overwrite"` + TLSCaCert string `yaml:"tls_ca_certs" env:"TLS_CA_CERT, overwrite"` } type ListenConfig struct { diff --git a/internal/outpost/proxyv2/application/session.go b/internal/outpost/proxyv2/application/session.go index 9ce892954c..a2f73208ee 100644 --- a/internal/outpost/proxyv2/application/session.go +++ b/internal/outpost/proxyv2/application/session.go @@ -45,15 +45,15 @@ func (a *Application) getStore(p api.ProxyOutpostConfig, externalHost *url.URL) break } ca := config.Get().Redis.TLSCaCert - if ca != nil { + if ca != "" { // Get the SystemCertPool, continue with an empty pool on error rootCAs, _ := x509.SystemCertPool() if rootCAs == nil { rootCAs = x509.NewCertPool() } - certs, err := os.ReadFile(*ca) + certs, err := os.ReadFile(ca) if err != nil { - a.log.WithError(err).Fatalf("Failed to append %s to RootCAs", *ca) + a.log.WithError(err).Fatalf("Failed to append %s to RootCAs", ca) } // Append our cert to the system pool if ok := rootCAs.AppendCertsFromPEM(certs); !ok {