Skip to content

Commit 7804c83

Browse files
author
Lee Fine
committed
1 parent f4081f9 commit 7804c83

File tree

7 files changed

+488
-352
lines changed

7 files changed

+488
-352
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
v2.10.0
2+
- Added support for Eliptical Curve (EC) private keys for RFPEM.
3+
- For Linux hosted certificate stores, added ability to inherit file permissions and ownership when creating new stores by modifying default behavior when config.json and certificate store permissions/ownership settings are left empty.
4+
- Added new custom field to store type definitions - IncludePortInSPN - which will set this option when creating remote Powershell connections.
5+
- Fixed documentation error in Discovery section
6+
- Added RemoveRootCertificate custom field to integration-manifest.json. This option was previously added in v2.8.0 but never added to the integration-manifest.json.
7+
18
v2.9.1
29
- Bug Fix: Use AES encryption when creating PKCS12 files instead of less secure defaults
310

RemoteFile/InventoryBase.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ public JobResult ProcessJob(InventoryJobConfiguration config, SubmitInventoryUpd
5151
string sudoImpersonatedUser = properties.SudoImpersonatedUser == null || string.IsNullOrEmpty(properties.SudoImpersonatedUser.Value) ?
5252
ApplicationSettings.DefaultSudoImpersonatedUser :
5353
properties.SudoImpersonatedUser.Value;
54+
bool includePortInSPN = properties.IncludePortInSPN == null || string.IsNullOrEmpty(properties.IncludePortInSPN.Value) ?
55+
false :
56+
Convert.ToBoolean(properties.IncludePortInSPN.Value);
5457

55-
certificateStore = new RemoteCertificateStore(config.CertificateStoreDetails.ClientMachine, userName, userPassword, config.CertificateStoreDetails.StorePath, storePassword, config.JobProperties);
58+
certificateStore = new RemoteCertificateStore(config.CertificateStoreDetails.ClientMachine, userName, userPassword, config.CertificateStoreDetails.StorePath, storePassword, includePortInSPN);
5659
certificateStore.Initialize(sudoImpersonatedUser);
5760
certificateStore.LoadCertificateStore(certificateStoreSerializer, true);
5861

RemoteFile/ManagementBase.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
5353
bool removeRootCertificate = properties.RemoveRootCertificate == null || string.IsNullOrEmpty(properties.RemoveRootCertificate.Value) ?
5454
false :
5555
Convert.ToBoolean(properties.RemoveRootCertificate.Value);
56+
bool includePortInSPN = properties.IncludePortInSPN == null || string.IsNullOrEmpty(properties.IncludePortInSPN.Value) ?
57+
false :
58+
Convert.ToBoolean(properties.IncludePortInSPN.Value);
5659

57-
certificateStore = new RemoteCertificateStore(config.CertificateStoreDetails.ClientMachine, userName, userPassword, config.CertificateStoreDetails.StorePath, storePassword, config.JobProperties);
60+
certificateStore = new RemoteCertificateStore(config.CertificateStoreDetails.ClientMachine, userName, userPassword, config.CertificateStoreDetails.StorePath, storePassword, includePortInSPN);
5861
certificateStore.Initialize(sudoImpersonatedUser);
5962

6063
PathFile storePathFile = RemoteCertificateStore.SplitStorePathFile(config.CertificateStoreDetails.StorePath);

RemoteFile/ReenrollmentBase.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public JobResult ProcessJobToDo(ReenrollmentJobConfiguration config, SubmitReenr
7171
bool removeRootCertificate = properties.RemoveRootCertificate == null || string.IsNullOrEmpty(properties.RemoveRootCertificate.Value) ?
7272
false :
7373
Convert.ToBoolean(properties.RemoveRootCertificate.Value);
74+
bool includePortInSPN = properties.IncludePortInSPN == null || string.IsNullOrEmpty(properties.IncludePortInSPN.Value) ?
75+
false :
76+
Convert.ToBoolean(properties.IncludePortInSPN.Value);
7477
bool createCSROnDevice = properties.CreateCSROnDevice == null || string.IsNullOrEmpty(properties.CreateCSROnDevice.Value) ?
7578
ApplicationSettings.CreateCSROnDevice :
7679
Convert.ToBoolean(properties.CreateCSROnDevice.Value);
@@ -90,7 +93,7 @@ public JobResult ProcessJobToDo(ReenrollmentJobConfiguration config, SubmitReenr
9093
throw new RemoteFileException($"Unsupported KeyType value {keyType}. Supported types are {keyTypes}.");
9194
}
9295

93-
certificateStore = new RemoteCertificateStore(config.CertificateStoreDetails.ClientMachine, userName, userPassword, config.CertificateStoreDetails.StorePath, storePassword, config.JobProperties);
96+
certificateStore = new RemoteCertificateStore(config.CertificateStoreDetails.ClientMachine, userName, userPassword, config.CertificateStoreDetails.StorePath, storePassword, includePortInSPN);
9497
certificateStore.Initialize(sudoImpersonatedUser);
9598

9699
PathFile storePathFile = RemoteCertificateStore.SplitStorePathFile(config.CertificateStoreDetails.StorePath);

RemoteFile/RemoteCertificateStore.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@ internal enum ServerTypeEnum
5454
internal ServerTypeEnum ServerType { get; set; }
5555
internal List<string> DiscoveredStores { get; set; }
5656
internal string UploadFilePath { get; set; }
57+
internal bool IncludePortInSPN { get; set; }
5758

5859
private Pkcs12Store CertificateStore;
5960
private ILogger logger;
6061

6162

6263
internal RemoteCertificateStore() { }
6364

64-
internal RemoteCertificateStore(string server, string serverId, string serverPassword, string storeFileAndPath, string storePassword, Dictionary<string, object> jobProperties)
65+
internal RemoteCertificateStore(string server, string serverId, string serverPassword, string storeFileAndPath, string storePassword, bool includePortInSPN)
6566
{
6667
logger = LogHandler.GetClassLogger(this.GetType());
6768
logger.MethodEntry(LogLevel.Debug);
@@ -77,6 +78,7 @@ internal RemoteCertificateStore(string server, string serverId, string serverPas
7778
StorePassword = storePassword;
7879
ServerType = StorePath.Substring(0, 1) == "/" ? ServerTypeEnum.Linux : ServerTypeEnum.Windows;
7980
UploadFilePath = !string.IsNullOrEmpty(ApplicationSettings.SeparateUploadFilePath) && ServerType == ServerTypeEnum.Linux ? ApplicationSettings.SeparateUploadFilePath : StorePath;
81+
IncludePortInSPN = includePortInSPN;
8082
logger.LogDebug($"UploadFilePath: {UploadFilePath}");
8183

8284
if (!IsValueSafeRegex(StorePath + StoreFileName))
@@ -452,9 +454,14 @@ internal void Initialize(string sudoImpersonatedUser)
452454
bool treatAsLocal = Server.ToLower().EndsWith(LOCAL_MACHINE_SUFFIX);
453455

454456
if (ServerType == ServerTypeEnum.Linux || RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
457+
{
455458
RemoteHandler = treatAsLocal ? new LinuxLocalHandler() as IRemoteHandler : new SSHHandler(Server, ServerId, ServerPassword, ServerType == ServerTypeEnum.Linux, sudoImpersonatedUser) as IRemoteHandler;
459+
}
456460
else
461+
{
457462
RemoteHandler = new WinRMHandler(Server, ServerId, ServerPassword, treatAsLocal);
463+
((WinRMHandler)RemoteHandler).SetIncludeSPN(IncludePortInSPN);
464+
}
458465

459466
logger.MethodExit(LogLevel.Debug);
460467
}

RemoteFile/RemoteHandlers/WinRMHandler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public override string RunCommand(string commandText, object[] parameters, bool
142142
}
143143
}
144144

145+
public void SetIncludeSPN(bool includePortInSPN)
146+
{
147+
connectionInfo.IncludePortInSPN = includePortInSPN;
148+
}
149+
145150
private byte[] RunCommandBinary(string commandText)
146151
{
147152
_logger.MethodEntry(LogLevel.Debug);

0 commit comments

Comments
 (0)