Introduce GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY=1 to skip SSL cert verification for the runner. (#1616)

This commit is contained in:
Tingluo Huang
2022-01-19 10:31:17 -05:00
committed by GitHub
parent d8251bf912
commit ac31fd10b2
3 changed files with 20 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
using System;
using System.Net.Http;
using GitHub.Runner.Sdk;
@@ -13,7 +14,14 @@ namespace GitHub.Runner.Common
{
public HttpClientHandler CreateClientHandler(RunnerWebProxy webProxy)
{
return new HttpClientHandler() { Proxy = webProxy };
var client = new HttpClientHandler() { Proxy = webProxy };
if (StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY")))
{
client.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
}
return client;
}
}
}