[GH-ISSUE #47] Wrong Powershell credentials #32

Closed
opened 2026-02-26 10:35:19 +03:00 by kerem · 17 comments
Owner

Originally created by @julianmaria on GitHub (Jul 10, 2014).
Original GitHub issue: https://github.com/Pro/dkim-exchange/issues/47

im trying to install 2.0.0-beta.2 with Configuration.DkimSigner.exe
Either if I choose to download from GUI or to install from zip, the same happens:

notnull

Error at Copying new files:
"Value can not be null"
"Parameter: path2"

Im using EDGE ROLE of Exchange Server 2010 SP2 (spanish) in Windows Server 2008 R2

The gui seems to start copying files to "C:\Program Files\Exchange DkimSigner\Configuration"

the files copied until error are:
Configuration.DkimSigner.exe
Configuration.DkimSigner.pdb
Configuration.DkimSigner.exe.config
Ionic.Zip.dll
System.Management.Automation.dll

Hope this may help

Originally created by @julianmaria on GitHub (Jul 10, 2014). Original GitHub issue: https://github.com/Pro/dkim-exchange/issues/47 im trying to install 2.0.0-beta.2 with Configuration.DkimSigner.exe Either if I choose to download from GUI or to install from zip, the same happens: ![notnull](https://cloud.githubusercontent.com/assets/8127994/3543901/e761d97e-0866-11e4-9e82-266eb9c6b759.png) Error at Copying new files: "Value can not be null" "Parameter: path2" Im using EDGE ROLE of Exchange Server 2010 SP2 (spanish) in Windows Server 2008 R2 The gui seems to start copying files to "C:\Program Files\Exchange DkimSigner\Configuration" the files copied until error are: Configuration.DkimSigner.exe Configuration.DkimSigner.pdb Configuration.DkimSigner.exe.config Ionic.Zip.dll System.Management.Automation.dll Hope this may help
kerem 2026-02-26 10:35:19 +03:00
  • closed this issue
  • added the
    bug
    gui
    labels
Author
Owner

@Pro commented on GitHub (Jul 11, 2014):

Thanks for your very detailed report!
Based on your infos it looks like the Exception is caused by: https://github.com/Pro/dkim-exchange/blob/master/Src/Configuration.DkimSigner/UpgradeWindow.cs#L200
meaning that the directoryFromExchangeVersion function couldn't detect the Exchange Version.

I wrote a small App to check the functionality of this function: https://github.com/Pro/dkim-exchange/blob/master/Src/Configuration.DkimSigner/ExchangeHelper.cs#L31
Can you please download it and post the output:
exchangeservertest.exe.png (replace the .png extension with .exe)

<!-- gh-comment-id:48702824 --> @Pro commented on GitHub (Jul 11, 2014): Thanks for your very detailed report! Based on your infos it looks like the Exception is caused by: https://github.com/Pro/dkim-exchange/blob/master/Src/Configuration.DkimSigner/UpgradeWindow.cs#L200 meaning that the `directoryFromExchangeVersion` function couldn't detect the Exchange Version. I wrote a small App to check the functionality of this function: https://github.com/Pro/dkim-exchange/blob/master/Src/Configuration.DkimSigner/ExchangeHelper.cs#L31 Can you please download it and post the output: ![exchangeservertest.exe.png](https://cloud.githubusercontent.com/assets/251973/3549775/d65216ae-08ce-11e4-9405-c9cdacc4f0e0.png) (replace the .png extension with .exe)
Author
Owner

@Pro commented on GitHub (Jul 11, 2014):

@julianmaria forgot to mention you in previous message so that you get the notification. Just to be sure

<!-- gh-comment-id:48721737 --> @Pro commented on GitHub (Jul 11, 2014): @julianmaria forgot to mention you in previous message so that you get the notification. Just to be sure
Author
Owner

@julianmaria commented on GitHub (Jul 11, 2014):

Domain: corp.local
EXCEPTION: Error de inicio de sesión: nombre de usuario desconocido o contraseña incorrecta.

(EXCEPTION: Error in login session: user unknown or incorrect pass)

Im using a Local Administrator (EDGE Server is Not part of the domain, following MS best practices)

My exact Exchange Server Version (2010, SP2)
"14.02.0247.005"

may be is that: it should be 14.02, and not 14.2

PATH of Exchange Server:
"c:\Program Files\Microsoft\Exchange Server\V14" (x64 of course)

<!-- gh-comment-id:48728718 --> @julianmaria commented on GitHub (Jul 11, 2014): Domain: corp.local EXCEPTION: Error de inicio de sesión: nombre de usuario desconocido o contraseña incorrecta. (EXCEPTION: Error in login session: user unknown or incorrect pass) Im using a Local Administrator (EDGE Server is Not part of the domain, following MS best practices) My exact Exchange Server Version (2010, SP2) "14.02.0247.005" may be is that: it should be 14.02, and not 14.2 PATH of Exchange Server: "c:\Program Files\Microsoft\Exchange Server\V14\" (x64 of course)
Author
Owner

@Pro commented on GitHub (Jul 11, 2014):

Thanks for your info.
The problem is that your Exchange Server isn't part of the domain but the code only detects Exchange Servers which are within the domain of the local machine which is wrong.
I already found a solution for this problem and will upload a new beta version shortly.

<!-- gh-comment-id:48735908 --> @Pro commented on GitHub (Jul 11, 2014): Thanks for your info. The problem is that your Exchange Server isn't part of the domain but the code only detects Exchange Servers which are within the domain of the local machine which is wrong. I already found a solution for this problem and will upload a new beta version shortly.
Author
Owner

@Pro commented on GitHub (Jul 11, 2014):

@julianmaria the problem should be fixed in 2.0.0-beta.3
Could you please try again using these instructions and give feedback? https://github.com/Pro/dkim-exchange/blob/master/INSTALL_2.md

Thanks!

<!-- gh-comment-id:48738209 --> @Pro commented on GitHub (Jul 11, 2014): @julianmaria the problem should be fixed in 2.0.0-beta.3 Could you please try again using these instructions and give feedback? https://github.com/Pro/dkim-exchange/blob/master/INSTALL_2.md Thanks!
Author
Owner

@julianmaria commented on GitHub (Jul 11, 2014):

Of course:
I was checking the code and yes:

checkExchangeVersionInstalled() in ExchangeHelper.cs returns: "Not Installed" because u use LDAP to detect Exchange Version and my Edge Server is not part of the Domain

let me try beta 3 :>
Thank you :D

<!-- gh-comment-id:48739483 --> @julianmaria commented on GitHub (Jul 11, 2014): Of course: I was checking the code and yes: checkExchangeVersionInstalled() in ExchangeHelper.cs returns: "Not Installed" because u use LDAP to detect Exchange Version and my Edge Server is not part of the Domain let me try beta 3 :> Thank you :D
Author
Owner

@julianmaria commented on GitHub (Jul 11, 2014):

The same as 1st Post:

With

//ADD
String fuckingshitnotfunctioning = ExchangeHelper.checkExchangeVersionInstalled();
MessageBox.Show(fuckingshitnotfunctioning, "ME");
//uptohere

I recieve this:
1

It seems there's some problems with Authentication/trustedhosts when running Exchange Powershell Console commands from code.

From EPC u can see the same u are traying to obtain from code
2

<!-- gh-comment-id:48742484 --> @julianmaria commented on GitHub (Jul 11, 2014): The same as 1st Post: With //ADD String fuckingshitnotfunctioning = ExchangeHelper.checkExchangeVersionInstalled(); MessageBox.Show(fuckingshitnotfunctioning, "ME"); //uptohere I recieve this: ![1](https://cloud.githubusercontent.com/assets/8127994/3554347/e97792bc-090b-11e4-89ca-1196c6edcbc1.png) It seems there's some problems with Authentication/trustedhosts when running Exchange Powershell Console commands from code. From EPC u can see the same u are traying to obtain from code ![2](https://cloud.githubusercontent.com/assets/8127994/3554518/7388b75a-090d-11e4-81c5-233323959fca.png)
Author
Owner

@Pro commented on GitHub (Jul 11, 2014):

Damn it!
This problem will occur with all the powershell commands (not only getting the version, but also registering the agent and so on).
I somehow need to set the correct credentials at this line: https://github.com/Pro/dkim-exchange/blob/master/Src/Configuration.DkimSigner/ExchangeHelper.cs#L90
(If they are set to null it should use the current windows user, http://blogs.msdn.com/b/dvespa/archive/2010/02/22/how-to-use-windows-authentication-with-the-pscredential-class.aspx)

Will do some research...

<!-- gh-comment-id:48743668 --> @Pro commented on GitHub (Jul 11, 2014): Damn it! This problem will occur with all the powershell commands (not only getting the version, but also registering the agent and so on). I somehow need to set the correct credentials at this line: https://github.com/Pro/dkim-exchange/blob/master/Src/Configuration.DkimSigner/ExchangeHelper.cs#L90 (If they are set to `null` it should use the current windows user, http://blogs.msdn.com/b/dvespa/archive/2010/02/22/how-to-use-windows-authentication-with-the-pscredential-class.aspx) Will do some research...
Author
Owner

@Pro commented on GitHub (Jul 11, 2014):

@julianmaria do you have the possibility to compile and test the code?
If yes, then could you add
connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;
to https://github.com/Pro/dkim-exchange/blob/master/Src/Configuration.DkimSigner/ExchangeHelper.cs#L92 at line 92 (right after the constructor)

<!-- gh-comment-id:48744440 --> @Pro commented on GitHub (Jul 11, 2014): @julianmaria do you have the possibility to compile and test the code? If yes, then could you add `connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;` to https://github.com/Pro/dkim-exchange/blob/master/Src/Configuration.DkimSigner/ExchangeHelper.cs#L92 at line 92 (right after the constructor)
Author
Owner

@julianmaria commented on GitHub (Jul 11, 2014):

let me see. I was compiling the code before trying to figure it out. Let me see

<!-- gh-comment-id:48745065 --> @julianmaria commented on GitHub (Jul 11, 2014): let me see. I was compiling the code before trying to figure it out. Let me see
Author
Owner

@julianmaria commented on GitHub (Jul 11, 2014):

3

it says we cannot use Kerberos as Auth method cause Machine is not member of the domain

See: http://stackoverflow.com/questions/16010091/connecting-to-remote-server-failed-using-winrm-from-powershell

<!-- gh-comment-id:48746547 --> @julianmaria commented on GitHub (Jul 11, 2014): ![3](https://cloud.githubusercontent.com/assets/8127994/3554927/bce392c2-0911-11e4-9f61-f349fab11e23.png) it says we cannot use Kerberos as Auth method cause Machine is not member of the domain See: http://stackoverflow.com/questions/16010091/connecting-to-remote-server-failed-using-winrm-from-powershell
Author
Owner

@Pro commented on GitHub (Jul 11, 2014):

Well, that was a wild guess, maybe another AuthenticationMechanism works, e.g. Default (http://msdn.microsoft.com/en-us/library/system.management.automation.runspaces.authenticationmechanism%28v=vs.85%29.aspx)

Another wild guess: try to set hostName = "localhost" at https://github.com/Pro/dkim-exchange/blob/master/Src/Configuration.DkimSigner/ExchangeHelper.cs#L88

Otherwise I'll have to implement a dialog to ask the user for the correct credentials which is quite ugly: http://stackoverflow.com/a/1624590/869402
http://farnet.googlecode.com/svn/!svn/bc/308/trunk/PowerShellFar/NativeMethods.cs

Here's another example where the credentials are set from a string:

string livePass = "mySecurePassword";
string username = "myUsername";
System.Security.SecureString password = new System.Security.SecureString();
foreach (char c in livePass.ToCharArray())
{
    password.AppendChar(c);
}
PSCredential psc = new PSCredential(username, password);
<!-- gh-comment-id:48747665 --> @Pro commented on GitHub (Jul 11, 2014): Well, that was a wild guess, maybe another AuthenticationMechanism works, e.g. Default (http://msdn.microsoft.com/en-us/library/system.management.automation.runspaces.authenticationmechanism%28v=vs.85%29.aspx) Another wild guess: try to set `hostName = "localhost"` at https://github.com/Pro/dkim-exchange/blob/master/Src/Configuration.DkimSigner/ExchangeHelper.cs#L88 Otherwise I'll have to implement a dialog to ask the user for the correct credentials which is quite ugly: http://stackoverflow.com/a/1624590/869402 http://farnet.googlecode.com/svn/!svn/bc/308/trunk/PowerShellFar/NativeMethods.cs Here's another example where the credentials are set from a string: ``` string livePass = "mySecurePassword"; string username = "myUsername"; System.Security.SecureString password = new System.Security.SecureString(); foreach (char c in livePass.ToCharArray()) { password.AppendChar(c); } PSCredential psc = new PSCredential(username, password); ```
Author
Owner

@julianmaria commented on GitHub (Jul 11, 2014):

I dont know if there's another option for Edge Servers. it doesnt matter to put credentials to authenticate in this cases

<!-- gh-comment-id:48748772 --> @julianmaria commented on GitHub (Jul 11, 2014): I dont know if there's another option for Edge Servers. it doesnt matter to put credentials to authenticate in this cases
Author
Owner

@Pro commented on GitHub (Jul 14, 2014):

Ok, we then should first try to execute powershell commands without asking the user. If this fails, we will ask the user for Username and Password. Something like a 'TryAuthenticate' method. This will take some time.

<!-- gh-comment-id:48876067 --> @Pro commented on GitHub (Jul 14, 2014): Ok, we then should first try to execute powershell commands without asking the user. If this fails, we will ask the user for Username and Password. Something like a 'TryAuthenticate' method. This will take some time.
Author
Owner

@AlexLaroche commented on GitHub (Jul 27, 2014):

May the problem would be solve with next beta. I need to finish re-implement all functions but I have rewrited the most part of ExchangeHelper class in a new class ExchangeServer and I have changed the powershell invocation. I think the problem would be fix. I hope to be able to post a new beta release in a week.

<!-- gh-comment-id:50254638 --> @AlexLaroche commented on GitHub (Jul 27, 2014): May the problem would be solve with next beta. I need to finish re-implement all functions but I have rewrited the most part of ExchangeHelper class in a new class ExchangeServer and I have changed the powershell invocation. I think the problem would be fix. I hope to be able to post a new beta release in a week.
Author
Owner

@Pro commented on GitHub (Aug 27, 2014):

@julianmaria Can you test the current binary within this commit if it is working for you:
https://github.com/Pro/dkim-exchange/tree/master/Src/Configuration.DkimSigner/bin/Release
(You need all the files from Release directory)

<!-- gh-comment-id:53650947 --> @Pro commented on GitHub (Aug 27, 2014): @julianmaria Can you test the current binary within this commit if it is working for you: https://github.com/Pro/dkim-exchange/tree/master/Src/Configuration.DkimSigner/bin/Release (You need all the files from Release directory)
Author
Owner

@Pro commented on GitHub (Sep 11, 2014):

We changed a lot in the new release 2.0.2
Please check that one if it is working. If not, please reopen this issue.

<!-- gh-comment-id:55280873 --> @Pro commented on GitHub (Sep 11, 2014): We changed a lot in the new release 2.0.2 Please check that one if it is working. If not, please reopen this issue.
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/dkim-exchange-Pro#32
No description provided.