certera-io / certera

A central validation server for Let's Encrypt certificates

Home Page:https://docs.certera.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception during running DNS challenge scripts

nomailme opened this issue · comments

commented

Hello,
I have troubles using DNS challenge creation/deletion scripts. The thing is that when a certificate is being requested I get an exception during attempt to run a script.

System.ComponentModel.Win32Exception (2): No such file or directory at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at Certera.Web.AcmeProviders.CertesAcmeProvider.RunProcess(String file, String args, String envVars)

I figured out that the scripts are running fine unless you set any Environment Variables. So I belive that the problem is at CertesAcmeProvider.cs line number 258:
if (!isWindows) { file = EnvironmentVariableHelper.ToNixEnvVars(envVars) + file; }

I'll try to create a sample project this week to try to inject environment variables in a different manner and see if it will help

OS: Ubuntu 20.04

PS. These scripts work fine if I create a bash script and use environment variables there.

I suspected this could be an issue. I ran into some problems here due to the differences between Windows and *nix when it comes to setting environment variables.

I appreciate you looking into this! That is extremely helpful.

Also, I'm glad you found the work-around of using the bash script. That was exactly what I was going to recommend!

commented

Everything turns out to be more simple than it looks. Submitted a pull request.
Works fine on Ubuntu 20.04

Hi @nomailme!

Thanks for the PR. Merged and new release here: https://github.com/certera-io/certera/releases/tag/2.1.3

Looks like it boiled down to the following:

process.StartInfo.EnvironmentVariables[kv.Key] = kv.Value;

replaced with

process.StartInfo.Environment.Add(item.Key.Trim(), item.Value.Trim());

Great find!