使用CACert目录保存证书

This commit is contained in:
xljiulang 2021-07-18 13:58:33 +08:00
parent b8ac5864cc
commit e9f960e8e8
4 changed files with 12 additions and 9 deletions

View File

@ -30,13 +30,16 @@ namespace FastGithub
/// 监听https的反向代理
/// </summary>
/// <param name="kestrel"></param>
/// <param name="caPublicCerPath"></param>
/// <param name="caPrivateKeyPath"></param>
public static void ListenHttpsReverseProxy(this KestrelServerOptions kestrel, string caPublicCerPath, string caPrivateKeyPath)
public static void ListenHttpsReverseProxy(this KestrelServerOptions kestrel)
{
var loggerFactory = kestrel.ApplicationServices.GetRequiredService<ILoggerFactory>();
var logger = loggerFactory.CreateLogger($"{nameof(FastGithub)}.{nameof(ReverseProxy)}");
const string CAPATH = "CACert";
Directory.CreateDirectory(CAPATH);
var caPublicCerPath = $"{CAPATH}/{Environment.MachineName}.cer";
var caPrivateKeyPath = $"{CAPATH}/{Environment.MachineName}.key";
GeneratorCaCert(caPublicCerPath, caPrivateKeyPath);
InstallCaCert(caPublicCerPath, logger);

View File

@ -52,7 +52,7 @@ namespace FastGithub
.ConfigureWebHostDefaults(web =>
{
web.Configure(app => app.UseHttpsReverseProxy("README.html"));
web.UseKestrel(kestrel => kestrel.ListenHttpsReverseProxy($"FastGithub_{Environment.MachineName}.cer", $"FastGithub_{Environment.MachineName}.key"));
web.UseKestrel(kestrel => kestrel.ListenHttpsReverseProxy());
});
}
}

View File

@ -2,14 +2,14 @@
github加速神器
### 本机使用[推荐]
* 运行FastGithub程序自动本机的网络适配器的dns会为127.0.0.1和安装FastGithub.cer
* 运行FastGithub程序自动本机的网络适配器的dns会为127.0.0.1和安装CA证书
* 如果网络适配器的dns没有变成127.0.0.1请手工修改网络适配器的dns
* 如果浏览器提示无效的证书,请手工安装FastGithub.cer到`将所有的证书都放入下载存储\受信任的根证书颁发机构`
* 如果浏览器提示无效的证书,请手工安装CA证书到`将所有的证书都放入下载存储\受信任的根证书颁发机构`
### 局域网服务器使用
* 在局域网服务器运行FastGithub程序
* 手工修改你电脑的网络适配器的dns值为局域网服务器的ip
* 在你的电脑安装FastGithub.cer到`将所有的证书都放入下载存储\受信任的根证书颁发机构`
* 在你的电脑安装CA证书到`将所有的证书都放入下载存储\受信任的根证书颁发机构`
### 以windows服务运行
* FastGithub.exe start // 安装并启动服务

View File

@ -16,11 +16,11 @@
<h3>本机使用[推荐]</h3>
<ul><li>运行FastGithub程序自动本机的网络适配器的dns会为127.0.0.1和安装FastGithub.cer</li><li>如果网络适配器的dns没有变成127.0.0.1请手工修改网络适配器的dns</li><li>如果浏览器提示无效的证书,请手工安装FastGithub.cer<code>将所有的证书都放入下载存储\受信任的根证书颁发机构</code></li></ul>
<ul><li>运行FastGithub程序自动本机的网络适配器的dns会为127.0.0.1和安装CA证书</li><li>如果网络适配器的dns没有变成127.0.0.1请手工修改网络适配器的dns</li><li>如果浏览器提示无效的证书,请手工安装CA证书<code>将所有的证书都放入下载存储\受信任的根证书颁发机构</code></li></ul>
<h3>局域网服务器使用</h3>
<ul><li>在局域网服务器运行FastGithub程序</li><li>手工修改你电脑的网络适配器的dns值为局域网服务器的ip</li><li>在你的电脑安装FastGithub.cer<code>将所有的证书都放入下载存储\受信任的根证书颁发机构</code></li></ul>
<ul><li>在局域网服务器运行FastGithub程序</li><li>手工修改你电脑的网络适配器的dns值为局域网服务器的ip</li><li>在你的电脑安装CA证书<code>将所有的证书都放入下载存储\受信任的根证书颁发机构</code></li></ul>
<h3>以windows服务运行</h3>