From 8aa9105ed3676bb24a05237e52816ea6f7fe1e08 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 29 Nov 2020 11:47:52 -0800 Subject: [PATCH] Make paths lowercase for cert serving; closes pterodactyl/panel#2745 --- cmd/root.go | 5 +---- router/router_system.go | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index ca1cd87..5fb4028 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -336,7 +336,6 @@ func rootCmdRun(*cobra.Command, []string) { if err := s.ListenAndServeTLS("", ""); err != nil { log.WithFields(log.Fields{"auto_tls": true, "tls_hostname": tlsHostname, "error": err}). Fatal("failed to configure HTTP server using auto-tls") - os.Exit(1) } return @@ -344,9 +343,8 @@ func rootCmdRun(*cobra.Command, []string) { // Check if main http server should run with TLS. if c.Api.Ssl.Enabled { - if err := s.ListenAndServeTLS(c.Api.Ssl.CertificateFile, c.Api.Ssl.KeyFile); err != nil { + if err := s.ListenAndServeTLS(strings.ToLower(c.Api.Ssl.CertificateFile), strings.ToLower(c.Api.Ssl.KeyFile)); err != nil { log.WithFields(log.Fields{"auto_tls": false, "error": err}).Fatal("failed to configure HTTPS server") - os.Exit(1) } return } @@ -355,7 +353,6 @@ func rootCmdRun(*cobra.Command, []string) { s.TLSConfig = nil if err := s.ListenAndServe(); err != nil { log.WithField("error", err).Fatal("failed to configure HTTP server") - os.Exit(1) } } diff --git a/router/router_system.go b/router/router_system.go index 6b5ea0e..5c54a93 100644 --- a/router/router_system.go +++ b/router/router_system.go @@ -89,8 +89,8 @@ func postUpdateConfiguration(c *gin.Context) { // // 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 = ccopy.Api.Ssl.KeyFile - cfg.Api.Ssl.CertificateFile = ccopy.Api.Ssl.CertificateFile + cfg.Api.Ssl.KeyFile = strings.ToLower(ccopy.Api.Ssl.KeyFile) + cfg.Api.Ssl.CertificateFile = strings.ToLower(ccopy.Api.Ssl.CertificateFile) } config.Set(&cfg)