Skip to content

Commit b0f2d43

Browse files
authored
Merge pull request #131 from Keyfactor/ssh-rebase
ab#48867 Add SSH Delivery Request: 89305
2 parents 2407107 + ebeef18 commit b0f2d43

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3381
-3178
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2.6.0
2+
* Added the ability to run the extension in a Linux environment. To utilize this change, for each Cert Store Types (WinCert/WinIIS/WinSQL), add ssh to the Custom Field <b>WinRM Protocol</b>. When using ssh as a protocol, make sure to enter the appropriate ssh port number under WinRM Port.
3+
* NOTE: For legacy purposes the Display names WinRM Protocol and WinRM Port are maintained although the type of protocols now includes ssh.
4+
* Moved all inventory and management jobs to external PowerShell script file .\PowerShellScripts\WinCertScripts.ps1
5+
16
2.5.1
27
* Fixed WinSQL service name when InstanceID differs from InstanceName
38

IISU/Certificate.cs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// 021225 rcp 2.6.0 Cleaned up and verified code
16+
17+
using Newtonsoft.Json;
1518
using System;
16-
using System.Linq;
17-
using System.Text.RegularExpressions;
19+
using System.Collections.Generic;
1820

1921
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore
2022
{
@@ -29,30 +31,27 @@ public class Certificate
2931

3032
public class Utilities
3133
{
32-
public static string FormatSAN(string san)
34+
public static List<T> DeserializeCertificates<T>(string jsonResults)
3335
{
34-
// Use regular expression to extract key-value pairs
35-
var regex = new Regex(@"(?<key>DNS Name|Email|IP Address)=(?<value>[^=,\s]+)");
36-
var matches = regex.Matches(san);
37-
38-
// Format matches into the desired format
39-
string result = string.Join("&", matches.Cast<Match>()
40-
.Select(m => $"{NormalizeKey(m.Groups["key"].Value)}={m.Groups["value"].Value}"));
41-
42-
return result;
43-
}
36+
if (string.IsNullOrEmpty(jsonResults))
37+
{
38+
// Handle no objects returned
39+
return new List<T>();
40+
}
4441

45-
private static string NormalizeKey(string key)
46-
{
47-
return key.ToLower() switch
42+
// Determine if the JSON is an array or a single object
43+
if (jsonResults.TrimStart().StartsWith("["))
4844
{
49-
"dns name" => "dns",
50-
"email" => "email",
51-
"ip address" => "ip",
52-
_ => key.ToLower() // For other types, keep them as-is
53-
};
45+
// It's an array, deserialize as list
46+
return JsonConvert.DeserializeObject<List<T>>(jsonResults);
47+
}
48+
else
49+
{
50+
// It's a single object, wrap it in a list
51+
var singleObject = JsonConvert.DeserializeObject<T>(jsonResults);
52+
return new List<T> { singleObject };
53+
}
5454
}
55-
5655
}
5756
}
5857
}

IISU/CertificateStore.cs

Lines changed: 0 additions & 211 deletions
This file was deleted.

IISU/ClientPSCertStoreInventory.cs

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)