Skip to content

Commit 78ba85a

Browse files
authored
Merge c6b9415 into 0b2d104
2 parents 0b2d104 + c6b9415 commit 78ba85a

File tree

8 files changed

+653
-334
lines changed

8 files changed

+653
-334
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2.6.3
2+
* Fixed reenrollment or ODKG job when RDN Components contained escaped commas.
3+
* Updated renewal job for IIS Certs to delete the old cert if not bound or used by other web sites.
4+
* Improved Inventory reporting of CSP when cert uses newer CNG Keys.
5+
* Fixed an issue with complex PFX passwords that contained special characters such as '@' or '$', etc.
6+
* Fixed an issue when adding certificate to store, sometimes the wrong thumbprint was returned, thus breaking web site binding.
7+
* Removed the IIS bindings check. Now bindings are handled similar to IIS - if you bind a cert to a site using the same bindings, you risk the possibility of one of the duplicate sites to stop working and the certificate being bound to either site. Refer to IIS Documentation pertaining to HTTPS binding.
8+
* Fixed an issue with (remote) ODKG jobs that caused an error when the CSP was not specified.
9+
110
2.6.2
211
* Fixed error when attempting to connect to remote computer using UO service account
312
* Fixed error when connecting to remote computer using HTTPS; was defaulting to HTTP

IISU/ImplementedStoreTypes/WinIIS/Inventory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public JobResult ProcessJob(InventoryJobConfiguration jobConfiguration, SubmitIn
9595
{
9696
Result = OrchestratorJobStatusJobResult.Success,
9797
JobHistoryId = jobConfiguration.JobHistoryId,
98-
FailureMessage = ""
98+
FailureMessage = $"Inventory completed returning {inventoryItems.Count} Items."
9999
};
100100
}
101101

IISU/ImplementedStoreTypes/WinIIS/Management.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using System;
1717
using System.Collections.Generic;
1818
using System.Collections.ObjectModel;
19+
using System.Linq;
1920
using System.Management.Automation;
2021
using Keyfactor.Extensions.Orchestrator.WindowsCertStore.Models;
2122
using Keyfactor.Logging;
@@ -89,6 +90,7 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
8990
string protocol = jobProperties?.WinRmProtocol;
9091
string port = jobProperties?.WinRmPort;
9192
bool includePortInSPN = (bool)jobProperties?.SpnPortFlag;
93+
string alias = config.JobCertificate?.Alias?.Split(':').FirstOrDefault() ?? string.Empty; // Thumbprint is first part of the alias
9294

9395
_psHelper = new(protocol, port, includePortInSPN, _clientMachineName, serverUserName, serverPassword);
9496

@@ -171,6 +173,14 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
171173
psResult = OrchestratorJobStatusJobResult.Unknown;
172174
}
173175

176+
// Only is the binding returns successful, check of original cert is still bound to any site, if not remove it from the store
177+
if (psResult == OrchestratorJobStatusJobResult.Success && !string.IsNullOrEmpty(alias))
178+
{
179+
_logger.LogTrace("Attempting to remove original certificate from store if it is no longer bound to any site.");
180+
RemoveIISCertificate(alias);
181+
_logger.LogTrace("Returned from removing cert if not used.");
182+
}
183+
174184
complete = new JobResult
175185
{
176186
Result = psResult,

IISU/PSHelper.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public Collection<PSObject> ExecutePowerShellScript(string script)
386386
}
387387

388388
// Add Parameters if provided
389-
if (parameters != null)
389+
if (parameters != null && parameters.Count > 0)
390390
{
391391
if (isLocalMachine || isScript)
392392
{
@@ -398,13 +398,18 @@ public Collection<PSObject> ExecutePowerShellScript(string script)
398398
else
399399
{
400400
// Remote execution: Use ArgumentList for parameters
401-
var paramBlock = string.Join(", ", parameters.Select(p => $"[{p.Value.GetType().Name}] ${p.Key}"));
401+
var paramBlock = string.Join(", ", parameters.Select(p =>
402+
{
403+
string typeName = p.Value?.GetType().Name ?? "object";
404+
return $"[{typeName}] ${p.Key}";
405+
}));
406+
402407
var paramUsage = string.Join(" ", parameters.Select(p => $"-{p.Key} ${p.Key}"));
403408

404409
string scriptBlockWithParams = $@"
405-
param({paramBlock})
406-
{commandOrScript} {paramUsage}
407-
";
410+
param({paramBlock})
411+
{commandOrScript} {paramUsage}
412+
";
408413

409414
PS.Commands.Clear(); // Clear previous commands
410415
PS.AddCommand("Invoke-Command")

0 commit comments

Comments
 (0)