[GH-ISSUE #11] Exception during running DNS challenge scripts #10

Closed
opened 2026-02-25 21:30:48 +03:00 by kerem · 3 comments
Owner

Originally created by @nomailme on GitHub (Sep 17, 2020).
Original GitHub issue: https://github.com/certera-io/certera/issues/11

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.

Originally created by @nomailme on GitHub (Sep 17, 2020). Original GitHub issue: https://github.com/certera-io/certera/issues/11 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.
kerem closed this issue 2026-02-25 21:30:48 +03:00
Author
Owner

@certeraio commented on GitHub (Sep 17, 2020):

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!

<!-- gh-comment-id:694431362 --> @certeraio commented on GitHub (Sep 17, 2020): 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!
Author
Owner

@nomailme commented on GitHub (Sep 18, 2020):

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

<!-- gh-comment-id:694821726 --> @nomailme commented on GitHub (Sep 18, 2020): Everything turns out to be more simple than it looks. Submitted a pull request. Works fine on Ubuntu 20.04
Author
Owner

@certeraio commented on GitHub (Sep 20, 2020):

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!

<!-- gh-comment-id:695831276 --> @certeraio commented on GitHub (Sep 20, 2020): 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!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/certera#10
No description provided.