Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ad9188d
Win cert changes (#49)
fiddlermikey Mar 15, 2023
ac13480
Update generated README
Mar 15, 2023
44ec4da
Refactored WinIIS to IISU. Updated ReadMe to reflect changes.
Mar 16, 2023
183df51
Update generated README
Mar 16, 2023
b3edffc
Merge pull request #52 from Keyfactor/RefactorCertStoreName
rcpokorny Mar 16, 2023
f570859
Updated Change Log.
Mar 16, 2023
a6fd838
Merge branch 'RefactorCertStoreName' of https://github.com/Keyfactor/…
Mar 16, 2023
676afac
Merge pull request #53 from Keyfactor/RefactorCertStoreName
rcpokorny Mar 16, 2023
60156ab
Removed loggin of PAM credentials which was logging the info in plain…
rcpokorny Mar 20, 2023
c333c70
Removed loggin of PAM credentials which was logging the info in plain…
fiddlermikey Mar 20, 2023
c2a86c4
Created custom Configuration Property Parser (#57)
rcpokorny Mar 23, 2023
74873a2
Updated change log to reference removing passwords from trace logs. (…
rcpokorny Mar 30, 2023
a8293a4
Update integration-manifest.json
spbsoluble Apr 7, 2023
2e82091
Updated ReadMe to better reflect IISU and WinCert settings.
Apr 9, 2023
20e0bcd
Update generated README
Apr 9, 2023
329f3bd
Updated Cert Stores and images
Apr 10, 2023
8f51415
Merge branch 'Update_ReadME' of https://github.com/Keyfactor/iis-orch…
Apr 10, 2023
a28d5c4
Update generated README
Apr 10, 2023
06a197a
Replaced Images
Apr 10, 2023
905935f
Merge branch 'Update_ReadME' of https://github.com/Keyfactor/iis-orch…
Apr 10, 2023
dd2f89f
Update generated README
Apr 10, 2023
7e0e87b
fix casing
fiddlermikey Apr 10, 2023
82c63e1
Update generated README
Apr 10, 2023
fbdfc3c
Merge pull request #61 from Keyfactor/Update_ReadME
rcpokorny Apr 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
2.0.1
2.1.0
* Fixed issue that was occuring during renewal when there were bindings outside of http and https like net.tcp
* Added PAM registration/initialization documentation in README.md
* Resolved Null HostName error
* Added WinCert Cert Store Type
* Added custom property parser to not show any passwords
* Removed any password references in trace logs and output settings in JSON format

2.0.0
* Add support for reenrollment jobs (On Device Key Generation) with the ability to specify a cryptographic provider. Specification of cryptographic provider allows HSM (Hardware Security Module) use.
Expand Down
1 change: 1 addition & 0 deletions IISU/ClientPSCertStoreManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function InstallPfxToMachineStore([byte[]]$bytes, [string]$password, [string]$st
$certStore.Open(5)
$cert = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $bytes, $password, 18 <# Persist, Machine #>
$certStore.Add($cert)

$certStore.Close();
}";

Expand Down
13 changes: 7 additions & 6 deletions IISU/ClientPSCertStoreReEnrollment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Keyfactor.Extensions.Orchestrator.WindowsCertStore.WinIIS;
using Keyfactor.Logging;
using Keyfactor.Orchestrators.Common.Enums;
using Keyfactor.Orchestrators.Extensions;
Expand All @@ -34,8 +33,8 @@ namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
{
internal class ClientPSCertStoreReEnrollment
{
private ILogger _logger;
private IPAMSecretResolver _resolver;
private readonly ILogger _logger;
private readonly IPAMSecretResolver _resolver;

public ClientPSCertStoreReEnrollment(ILogger logger, IPAMSecretResolver resolver)
{
Expand All @@ -59,8 +58,10 @@ public JobResult PerformReEnrollment(ReenrollmentJobConfiguration config, Submit
JobProperties properties = JsonConvert.DeserializeObject<JobProperties>(config.CertificateStoreDetails.Properties,
new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Populate });

WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri($"{properties?.WinRmProtocol}://{config.CertificateStoreDetails.ClientMachine}:{properties?.WinRmPort}/wsman"));
connectionInfo.IncludePortInSPN = properties.SpnPortFlag;
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri($"{properties?.WinRmProtocol}://{config.CertificateStoreDetails.ClientMachine}:{properties?.WinRmPort}/wsman"))
{
IncludePortInSPN = properties.SpnPortFlag
};
var pw = new NetworkCredential(serverUserName, serverPassword).SecurePassword;
_logger.LogTrace($"Credentials: UserName:{serverUserName}");

Expand Down Expand Up @@ -91,7 +92,7 @@ public JobResult PerformReEnrollment(ReenrollmentJobConfiguration config, Submit
Collection<PSObject> results;

// If the provider name is null, default it to the Microsoft CA
if (providerName == null) providerName = "Microsoft Strong Cryptographic Provider";
providerName ??= "Microsoft Strong Cryptographic Provider";

// Create the script file
ps.AddScript("$infFilename = New-TemporaryFile");
Expand Down
8 changes: 4 additions & 4 deletions IISU/ClientPSIIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ internal class ClientPSIIManager

private long JobHistoryID { get; set; }

private ILogger _logger;
private Runspace _runSpace;
private readonly ILogger _logger;
private readonly Runspace _runSpace;

private PowerShell ps;

Expand Down Expand Up @@ -82,7 +82,7 @@ public ClientPSIIManager(ReenrollmentJobConfiguration config, string serverUsern
Port = config.JobProperties["Port"].ToString();
HostName = config.JobProperties["HostName"]?.ToString();
Protocol = config.JobProperties["Protocol"].ToString();
SniFlag = config.JobProperties["SniFlag"].ToString()?.Substring(0, 1);
SniFlag = config.JobProperties["SniFlag"]?.ToString()[..1];
IPAddress = config.JobProperties["IPAddress"].ToString();

PrivateKeyPassword = ""; // A reenrollment does not have a PFX Password
Expand Down Expand Up @@ -119,7 +119,7 @@ public ClientPSIIManager(ManagementJobConfiguration config, string serverUsernam
Port = config.JobProperties["Port"].ToString();
HostName = config.JobProperties["HostName"]?.ToString();
Protocol = config.JobProperties["Protocol"].ToString();
SniFlag = config.JobProperties["SniFlag"].ToString()?.Substring(0, 1);
SniFlag = config.JobProperties["SniFlag"].ToString()?[..1];
IPAddress = config.JobProperties["IPAddress"].ToString();

PrivateKeyPassword = ""; // A reenrollment does not have a PFX Password
Expand Down
4 changes: 2 additions & 2 deletions IISU/ImplementedStoreTypes/Win/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.Win
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.WinCert
{
public class Inventory : WinCertJobTypeBase, IInventoryJobExtension
{
Expand Down Expand Up @@ -55,7 +55,7 @@ private JobResult PerformInventory(InventoryJobConfiguration config, SubmitInven
{
var inventoryItems = new List<CurrentInventoryItem>();

_logger.LogTrace($"Job Configuration: {JsonConvert.SerializeObject(config)}");
_logger.LogTrace(JobConfigurationParser.ParseInventoryJobConfiguration(config));

string serverUserName = PAMUtilities.ResolvePAMField(_resolver, _logger, "Server UserName", config.ServerUsername);
string serverPassword = PAMUtilities.ResolvePAMField(_resolver, _logger, "Server Password", config.ServerPassword);
Expand Down
60 changes: 6 additions & 54 deletions IISU/ImplementedStoreTypes/Win/Management.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using System.Net;
using Keyfactor.Logging;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.Win
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.WinCert
{
public class Management : WinCertJobTypeBase, IManagementJobExtension
{
Expand All @@ -47,11 +47,13 @@ public Management(IPAMSecretResolver resolver)

public JobResult ProcessJob(ManagementJobConfiguration config)
{
_logger = LogHandler.GetClassLogger<Management>();
_logger.MethodEntry();

try
{
_logger = LogHandler.GetClassLogger<Management>();
_logger.MethodEntry();

_logger.LogTrace(JobConfigurationParser.ParseManagementJobConfiguration(config));

string serverUserName = PAMUtilities.ResolvePAMField(_resolver, _logger, "Server UserName", config.ServerUsername);
string serverPassword = PAMUtilities.ResolvePAMField(_resolver, _logger, "Server Password", config.ServerPassword);

Expand Down Expand Up @@ -112,56 +114,6 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
}
}

//private JobResult PerformManagement(ManagementJobConfiguration config)
//{
// try
// {
// _logger.MethodEntry();

// ServerUserName = PAMUtilities.ResolvePAMField(_resolver, _logger, "Server UserName", config.ServerUsername);
// ServerPassword = PAMUtilities.ResolvePAMField(_resolver, _logger, "Server Password", config.ServerPassword);

// var complete = new JobResult
// {
// Result = OrchestratorJobStatusJobResult.Failure,
// JobHistoryId = config.JobHistoryId,
// FailureMessage =
// "Invalid Management Operation"
// };

// switch (config.OperationType)
// {
// case CertStoreOperationType.Add:
// {
// _logger.LogTrace("Adding...");
// if (config.JobProperties.ContainsKey("RenewalThumbprint"))
// {
// _thumbprint = config.JobProperties["RenewalThumbprint"].ToString();
// _logger.LogTrace($"Found Thumbprint Will renew all cers with this Thumbprint: {_thumbprint}");
// }

// _logger.LogTrace("Before PerformAddition...");
// complete = performAddition(config);
// _logger.LogTrace("After PerformAddition...");

// break;
// }
// case CertStoreOperationType.Remove:
// {
// break;
// }
// }

// return complete;
// }

// catch (Exception e)
// {
// _logger.LogError($"Error Occurred in Management.PerformManagement: {e.Message}");
// throw;
// }
//}

private JobResult performAddition(ManagementJobConfiguration config)
{
try
Expand Down
2 changes: 1 addition & 1 deletion IISU/ImplementedStoreTypes/Win/ReEnrollment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using Keyfactor.Orchestrators.Extensions.Interfaces;
using Microsoft.Extensions.Logging;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.Win
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.WinCert
{
public class ReEnrollment : WinCertJobTypeBase, IReenrollmentJobExtension
{
Expand Down
2 changes: 1 addition & 1 deletion IISU/ImplementedStoreTypes/Win/WinInventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Management.Automation.Runspaces;
using System.Text;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.Win
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.WinCert
{
internal class WinInventory : ClientPSCertStoreInventory
{
Expand Down
6 changes: 3 additions & 3 deletions IISU/ImplementedStoreTypes/WinIIS/IISManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.WinIIS
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.IISU
{
public class IISManager
{
Expand Down Expand Up @@ -66,7 +66,7 @@ public IISManager(ReenrollmentJobConfiguration config, string serverUserName, st
Port = config.JobProperties["Port"].ToString();
HostName = config.JobProperties["HostName"]?.ToString();
Protocol = config.JobProperties["Protocol"].ToString();
SniFlag = config.JobProperties["SniFlag"].ToString()?.Substring(0, 1);
SniFlag = config.JobProperties["SniFlag"].ToString()?[..1];
IpAddress = config.JobProperties["IPAddress"].ToString();

PrivateKeyPassword = ""; // A reenrollment does not have a PFX Password
Expand Down Expand Up @@ -105,7 +105,7 @@ public IISManager(ManagementJobConfiguration config, string serverUserName, stri
Port = config.JobProperties["Port"].ToString();
HostName = config.JobProperties["HostName"]?.ToString();
Protocol = config.JobProperties["Protocol"].ToString();
SniFlag = config.JobProperties["SniFlag"].ToString()?.Substring(0, 1);
SniFlag = config.JobProperties["SniFlag"].ToString()?[..1];
IpAddress = config.JobProperties["IPAddress"].ToString();

PrivateKeyPassword = config.JobCertificate.PrivateKeyPassword;
Expand Down
6 changes: 4 additions & 2 deletions IISU/ImplementedStoreTypes/WinIIS/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.WinIIS
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.IISU
{
public class Inventory : WinCertJobTypeBase, IInventoryJobExtension
{
Expand All @@ -52,7 +52,9 @@ private JobResult PerformInventory(InventoryJobConfiguration config, SubmitInven
{
var inventoryItems = new List<CurrentInventoryItem>();

_logger.LogTrace($"Job Configuration: {JsonConvert.SerializeObject(config)}");
string myConfig = config.ToString();

_logger.LogTrace(JobConfigurationParser.ParseInventoryJobConfiguration(config));

string serverUserName = PAMUtilities.ResolvePAMField(_resolver, _logger, "Server UserName", config.ServerUsername);
string serverPassword = PAMUtilities.ResolvePAMField(_resolver, _logger, "Server Password", config.ServerPassword);
Expand Down
8 changes: 2 additions & 6 deletions IISU/ImplementedStoreTypes/WinIIS/Management.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@
using Microsoft.PowerShell.Commands;
using Newtonsoft.Json;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.WinIIS
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.IISU
{
public class Management : WinCertJobTypeBase, IManagementJobExtension
{
private ILogger _logger;

public string ExtensionName => string.Empty;

private string _thumbprint = string.Empty;

private Runspace myRunspace;

public Management(IPAMSecretResolver resolver)
Expand All @@ -49,7 +47,7 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
_logger = LogHandler.GetClassLogger<Management>();
_logger.MethodEntry();

_logger.LogTrace($"Job Configuration: {JsonConvert.SerializeObject(config)}");
_logger.LogTrace(JobConfigurationParser.ParseManagementJobConfiguration(config));

string serverUserName = PAMUtilities.ResolvePAMField(_resolver, _logger, "Server UserName", config.ServerUsername);
string serverPassword = PAMUtilities.ResolvePAMField(_resolver, _logger, "Server Password", config.ServerPassword);
Expand Down Expand Up @@ -139,8 +137,6 @@ private JobResult PerformRemoveCertificate(ManagementJobConfiguration config, st
{
_logger.LogTrace("Before Remove Certificate...");

string certificateContents = config.JobCertificate.Contents;
string privateKeyPassword = config.JobCertificate.PrivateKeyPassword;
string storePath = config.CertificateStoreDetails.StorePath;
long jobNumber = config.JobHistoryId;

Expand Down
2 changes: 1 addition & 1 deletion IISU/ImplementedStoreTypes/WinIIS/ReEnrollment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using Keyfactor.Orchestrators.Extensions.Interfaces;
using Microsoft.Extensions.Logging;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.WinIIS
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.IISU
{
public class ReEnrollment: WinCertJobTypeBase, IReenrollmentJobExtension
{
Expand Down
2 changes: 1 addition & 1 deletion IISU/ImplementedStoreTypes/WinIIS/WinIISInventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using System.Management.Automation.Runspaces;
using System.Text;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.WinIIS
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.IISU
{
internal class WinIISInventory : ClientPSCertStoreInventory
{
Expand Down
11 changes: 11 additions & 0 deletions IISU/Interfaces/ICertificateStoreDetailsBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
{
internal interface ICertificateStoreDetailsBase
{
public CertificateStoreDetailsDTO CertificateStoreDetails { get; set; }
}
}
7 changes: 7 additions & 0 deletions IISU/Interfaces/IInventoryCertStoreDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
{
internal interface IInventoryCertStoreDetails
{
public CertificateStoreDetailsDTO CertificateStoreDetails { get; set; }
}
}
10 changes: 10 additions & 0 deletions IISU/Interfaces/IInventoryJobLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
{
internal interface IInventoryJobLogger : IJobConfigurationLoggerBase, IInventoryCertStoreDetails
{
}
}
24 changes: 24 additions & 0 deletions IISU/Interfaces/IJobConfigurationLoggerBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Keyfactor.Orchestrators.Extensions;
using System;
using System.Collections.Generic;
using System.Text;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
{
internal interface IJobConfigurationLoggerBase
{
public bool JobCancelled { get; set; }
public ServerFault ServerError { get; set; }
public long JobHistoryID { get; set; }
public int RequestStatus { get; set; }
public string ServerUserName { get; set; }
public string ServerPassword { get; set; }
public JobProperties JobConfigurationProperties { get; set; }
public bool UseSSL { get; set; }
public Guid JobTypeID { get; set; }
public Guid JobID { get; set; }
public string Capability { get; set; }

public IEnumerable<PreviousInventoryItem> LastInventory { get; set; }
}
}
12 changes: 12 additions & 0 deletions IISU/Interfaces/IManagementCertStoreDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
{
internal interface IManagementCertStoreDetails
{
public CertificateStoreDetailsDTO CertificateStoreDetails { get; set; }
public CertificateStoreDetailPropertiesDTO CertificateStoreDetailProperties { get; set; }
}
}
13 changes: 13 additions & 0 deletions IISU/Interfaces/IManagementJobLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Keyfactor.Orchestrators.Common.Enums;

namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
{
internal interface IManagementJobLogger : IJobConfigurationLoggerBase, IManagementCertStoreDetails
{
public CertStoreOperationType OperationType { get; set; }
public bool Overwrite { get; set; }

public JobCertificateDTO JobCertificateProperties { get; set; }

}
}
Loading