Skip to content

Commit cd31a1d

Browse files
Http challenge: locate certify.exe in current or parent directory
1 parent 59fdee1 commit cd31a1d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Certify.Core/Management/CertifyManager/CertifyManager.ManagedCertificates.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,19 @@ private async Task<bool> StartHttpChallengeServer()
791791

792792
var cliPath = System.IO.Path.Combine(AppContext.BaseDirectory, isWindows ? "certify.exe" : "certify");
793793

794+
if (!File.Exists(cliPath) && AppContext.BaseDirectory.IndexOf("service", StringComparison.InvariantCultureIgnoreCase) > -1)
795+
{
796+
// if running as a deployed service in a subdirectory, adjust the path to the executable
797+
cliPath = System.IO.Path.Combine(AppContext.BaseDirectory, "..", isWindows ? "certify.exe" : "certify");
798+
}
799+
800+
if (!File.Exists(cliPath))
801+
{
802+
_serviceLog?.Error($"Http Challenge Server process not found at {cliPath}");
803+
_httpChallengeProcess = null;
804+
return false;
805+
}
806+
794807
_httpChallengeProcessInfo = new ProcessStartInfo(cliPath, $"httpchallenge keys={_httpChallengeControlKey},{_httpChallengeCheckKey}")
795808
{
796809
RedirectStandardInput = true,

0 commit comments

Comments
 (0)