From c8f2a208a2eef835db55fed9195d62e3fbe4d85a Mon Sep 17 00:00:00 2001 From: Space Time Date: Sun, 6 Oct 2024 01:12:21 +0800 Subject: [PATCH] =?UTF-8?q?1.1.1=20->=201.1.2=20=E7=AC=AC35=E6=AC=A1?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Wins/MainWin.xaml.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Wins/MainWin.xaml.cs b/Wins/MainWin.xaml.cs index 8c1b042..aa87fb1 100644 --- a/Wins/MainWin.xaml.cs +++ b/Wins/MainWin.xaml.cs @@ -215,15 +215,12 @@ public partial class MainWin : Window File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "key.pem"), certKey.ExportPkcs8PrivateKeyPem()); using X509Store certStore = new(StoreName.Root, StoreLocation.CurrentUser, OpenFlags.ReadWrite); - bool isCertExist = false; foreach (X509Certificate2 cert in certStore.Certificates) if (cert.Subject == "CN=Cealing Cert Root") - isCertExist = true; - - if (!isCertExist) - certStore.Add(rootCert); + certStore.Remove(cert); + certStore.Add(rootCert); certStore.Close(); string hostsAppendContent = "# Cealing Nginx Start\n"; @@ -542,6 +539,7 @@ public partial class MainWin : Window .AddOrUpdate("worker_processes", "auto") .AddOrUpdate("events:worker_connections", "65536") .AddOrUpdate("http:proxy_set_header", "Host $http_host") + .AddOrUpdate("http:proxy_ssl_server_name", "on") .AddOrUpdate("http:server:return", "https://$host$request_uri"); foreach (List<(List<(string hostIncludeDomain, string hostExcludeDomain)> hostDomainPairs, string hostSni, string hostIp)> hostRules in HostRulesDict.Values) @@ -557,6 +555,7 @@ public partial class MainWin : Window .AddOrUpdate($"http:server[{ruleIndex}]:listen", "443 ssl") .AddOrUpdate($"http:server[{ruleIndex}]:ssl_certificate", "cert.pem") .AddOrUpdate($"http:server[{ruleIndex}]:ssl_certificate_key", "key.pem") + .AddOrUpdate($"http:server[{ruleIndex}]:proxy_ssl_name", hostSni) .AddOrUpdate($"http:server[{ruleIndex}]:location", "/", true) .AddOrUpdate($"http:server[{ruleIndex}]:location:proxy_pass", $"https://{hostIp}");