From d6a3d9adb13d8f365ff1f16a4ffdea9b83b3e2e9 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Mon, 29 Jun 2020 20:56:13 -0700 Subject: [PATCH] Don't obliterate custom SSL locations if defined closes pterodactyl/panel#2121 --- router/router_system.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/router/router_system.go b/router/router_system.go index f5dfed3..2e1ed13 100644 --- a/router/router_system.go +++ b/router/router_system.go @@ -9,6 +9,7 @@ import ( "github.com/pterodactyl/wings/server" "github.com/pterodactyl/wings/system" "net/http" + "strings" ) // Returns information about the system that wings is running on. @@ -78,6 +79,16 @@ func postUpdateConfiguration(c *gin.Context) { 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 = ccopy.Api.Ssl.KeyFile + cfg.Api.Ssl.CertificateFile = ccopy.Api.Ssl.CertificateFile + } + config.Set(&cfg) if err := config.Get().WriteToDisk(); err != nil { // If there was an error writing to the disk, revert back to the configuration we had