Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Fine committed Jan 29, 2025
1 parent 84b1cbe commit c14a153
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
7 changes: 1 addition & 6 deletions RemoteFile/RemoteCertificateStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,9 @@ internal void Initialize(string sudoImpersonatedUser)
bool treatAsLocal = Server.ToLower().EndsWith(LOCAL_MACHINE_SUFFIX);

if (ServerType == ServerTypeEnum.Linux || RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
RemoteHandler = treatAsLocal ? new LinuxLocalHandler() as IRemoteHandler : new SSHHandler(Server, ServerId, ServerPassword, ServerType == ServerTypeEnum.Linux, sudoImpersonatedUser) as IRemoteHandler;
}
else
{
RemoteHandler = new WinRMHandler(Server, ServerId, ServerPassword, treatAsLocal);
((WinRMHandler)RemoteHandler).SetIncludeSPN(IncludePortInSPN);
}
RemoteHandler = new WinRMHandler(Server, ServerId, ServerPassword, treatAsLocal, IncludePortInSPN);

logger.MethodExit(LogLevel.Debug);
}
Expand Down
8 changes: 2 additions & 6 deletions RemoteFile/RemoteHandlers/WinRMHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WinRMHandler : BaseRemoteHandler
private WSManConnectionInfo connectionInfo { get; set; }
private bool RunLocal { get; set; }

internal WinRMHandler(string server, string serverLogin, string serverPassword, bool treatAsLocal)
internal WinRMHandler(string server, string serverLogin, string serverPassword, bool treatAsLocal, bool includePortInSPN)
{
_logger.MethodEntry(LogLevel.Debug);

Expand All @@ -37,6 +37,7 @@ internal WinRMHandler(string server, string serverLogin, string serverPassword,
if (!RunLocal)
{
connectionInfo = new WSManConnectionInfo(new System.Uri($"{Server}/wsman"));
connectionInfo.IncludePortInSPN = includePortInSPN;
if (!string.IsNullOrEmpty(serverLogin))
{
connectionInfo.Credential = new PSCredential(serverLogin, new NetworkCredential(serverLogin, serverPassword).SecurePassword);
Expand Down Expand Up @@ -142,11 +143,6 @@ public override string RunCommand(string commandText, object[] parameters, bool
}
}

public void SetIncludeSPN(bool includePortInSPN)
{
connectionInfo.IncludePortInSPN = includePortInSPN;
}

private byte[] RunCommandBinary(string commandText)
{
_logger.MethodEntry(LogLevel.Debug);
Expand Down

0 comments on commit c14a153

Please sign in to comment.