From 521cc2aef281ca12409cfeae79ee443e11fcf1e6 Mon Sep 17 00:00:00 2001 From: TacticalCatto <74693042+TacticalCatto@users.noreply.github.com> Date: Tue, 18 Jan 2022 11:22:13 +0800 Subject: [PATCH] Don't turn SSL into lowercase (#114) --- cmd/root.go | 2 +- router/router_system.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 3be824e..ab0dcc7 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -355,7 +355,7 @@ func rootCmdRun(cmd *cobra.Command, _ []string) { // Check if main http server should run with TLS. Otherwise reset the TLS // config on the server and then serve it over normal HTTP. if api.Ssl.Enabled { - if err := s.ListenAndServeTLS(strings.ToLower(api.Ssl.CertificateFile), strings.ToLower(api.Ssl.KeyFile)); err != nil { + if err := s.ListenAndServeTLS(api.Ssl.CertificateFile, api.Ssl.KeyFile); err != nil { log.WithFields(log.Fields{"auto_tls": false, "error": err}).Fatal("failed to configure HTTPS server") } return diff --git a/router/router_system.go b/router/router_system.go index 2f384af..d1e1469 100644 --- a/router/router_system.go +++ b/router/router_system.go @@ -103,15 +103,17 @@ func postUpdateConfiguration(c *gin.Context) { if err := c.BindJSON(&cfg); err != nil { return } + // Keep the SSL certificates the same since the Panel will send through Lets Encrypt // default locations. However, if we picked a different location manually we don't // want to override that. // // If you pass through manual locations in the API call this logic will be skipped. if strings.HasPrefix(cfg.Api.Ssl.KeyFile, "/etc/letsencrypt/live/") { - cfg.Api.Ssl.KeyFile = strings.ToLower(config.Get().Api.Ssl.KeyFile) - cfg.Api.Ssl.CertificateFile = strings.ToLower(config.Get().Api.Ssl.CertificateFile) + cfg.Api.Ssl.KeyFile = config.Get().Api.Ssl.KeyFile + cfg.Api.Ssl.CertificateFile = config.Get().Api.Ssl.CertificateFile } + // Try to write this new configuration to the disk before updating our global // state with it. if err := config.WriteToDisk(cfg); err != nil {