From e913983bd5b89f6b0cf8d8a1b12a5793d3090d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E4=B9=9D?= <366193849@qq.com> Date: Sat, 13 Nov 2021 23:28:10 +0800 Subject: [PATCH] =?UTF-8?q?linux=E8=AF=81=E4=B9=A6crt=E5=90=8E=E7=BC=80?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.HttpServer/CaCertInstallerOfLinux.cs | 6 +++--- FastGithub.HttpServer/CertService.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FastGithub.HttpServer/CaCertInstallerOfLinux.cs b/FastGithub.HttpServer/CaCertInstallerOfLinux.cs index 29472d6..75ce003 100644 --- a/FastGithub.HttpServer/CaCertInstallerOfLinux.cs +++ b/FastGithub.HttpServer/CaCertInstallerOfLinux.cs @@ -41,7 +41,7 @@ namespace FastGithub.HttpServer /// 证书文件路径 public void Install(string caCertFilePath) { - var destCertFilePath = Path.Combine(this.CaCertStorePath, "fastgithub.crt"); + var destCertFilePath = Path.Combine(this.CaCertStorePath, Path.GetFileName(caCertFilePath)); if (File.Exists(destCertFilePath) && File.ReadAllBytes(caCertFilePath).SequenceEqual(File.ReadAllBytes(destCertFilePath))) { return; @@ -49,7 +49,7 @@ namespace FastGithub.HttpServer if (Environment.UserName != "root") { - this.logger.LogWarning($"无法自动安装CA证书{caCertFilePath},因为没有root权限"); + this.logger.LogWarning($"无法自动安装根证书{caCertFilePath},因为没有root权限"); return; } @@ -58,7 +58,7 @@ namespace FastGithub.HttpServer Directory.CreateDirectory(this.CaCertStorePath); File.Copy(caCertFilePath, destCertFilePath, overwrite: true); Process.Start(this.CaCertUpdatePath).WaitForExit(); - this.logger.LogInformation($"已自动向系统安装根证书"); + this.logger.LogInformation($"已自动向系统安装根证书{caCertFilePath}"); } catch (Exception ex) { diff --git a/FastGithub.HttpServer/CertService.cs b/FastGithub.HttpServer/CertService.cs index 8b8574e..b24f750 100644 --- a/FastGithub.HttpServer/CertService.cs +++ b/FastGithub.HttpServer/CertService.cs @@ -25,7 +25,7 @@ namespace FastGithub.HttpServer /// /// 获取证书文件路径 /// - public string CaCerFilePath { get; } = $"{CACERT_PATH}/fastgithub.cer"; + public string CaCerFilePath { get; } = OperatingSystem.IsLinux() ? $"{CACERT_PATH}/fastgithub.crt" : $"{CACERT_PATH}/fastgithub.cer"; /// /// 获取私钥文件路径