Skip to content

Commit a34f831

Browse files
authored
Merge 0ca63d8 into e30f109
2 parents e30f109 + 0ca63d8 commit a34f831

8 files changed

Lines changed: 91 additions & 23 deletions

File tree

.github/workflows/keyfactor-bootstrap-workflow-v3.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Keyfactor Bootstrap Workflow
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [opened, closed, synchronize, edited, reopened]
7+
push:
8+
create:
9+
branches:
10+
- 'release-*.*'
11+
12+
jobs:
13+
call-starter-workflow:
14+
uses: keyfactor/actions/.github/workflows/starter.yml@v4
15+
permissions:
16+
contents: write # Explicitly grant write permission
17+
with:
18+
command_token_url: ${{ vars.COMMAND_TOKEN_URL }}
19+
command_hostname: ${{ vars.COMMAND_HOSTNAME }}
20+
command_base_api_path: ${{ vars.COMMAND_API_PATH }}
21+
secrets:
22+
token: ${{ secrets.V2BUILDTOKEN}}
23+
gpg_key: ${{ secrets.KF_GPG_PRIVATE_KEY }}
24+
gpg_pass: ${{ secrets.KF_GPG_PASSPHRASE }}
25+
scan_token: ${{ secrets.SAST_TOKEN }}
26+
entra_username: ${{ secrets.DOCTOOL_ENTRA_USERNAME }}
27+
entra_password: ${{ secrets.DOCTOOL_ENTRA_PASSWD }}
28+
command_client_id: ${{ secrets.COMMAND_CLIENT_ID }}
29+
command_client_secret: ${{ secrets.COMMAND_CLIENT_SECRET }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ This extension uses the contact information of the GCC Domain point of contact f
103103
* **RetryCount** - This is the number of times the AnyGateway will attempt to pickup an new certificate before reporting an error. Default is 5.
104104
* **SyncIntervalDays** - OPTIONAL: Required if SyncStartDate is used. Specifies how to page the certificate sync. Should be a value such that no interval of that length contains > 500 certificate enrollments.
105105
* **SyncStartDate** - If provided, full syncs will start at the specified date.
106+
* **Enabled** - Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available.
106107

107108
2. Define [Certificate Profiles](https://software.keyfactor.com/Guides/AnyCAGatewayREST/Content/AnyCAGatewayREST/AddCP-Gateway.htm) and [Certificate Templates](https://software.keyfactor.com/Guides/AnyCAGatewayREST/Content/AnyCAGatewayREST/AddCA-Gateway.htm) for the Certificate Authority as required. One Certificate Profile must be defined per Certificate Template. It's recommended that each Certificate Profile be named after the Product ID. The GlobalSign MSSL Gateway plugin supports the following product IDs:
108109

globalsign-mssl-caplugin/Client/GlobalSignApiClient.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ public GlobalSignApiClient(GlobalSignCAConfig config, ILogger logger)
2626
Logger = logger;
2727
Config = config;
2828
// Logger = LogHandler.GetClassLogger(this.GetType());
29+
var enabled =config.Enabled;
30+
if (!enabled)
31+
{
32+
Logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping config validation and MSSL Client creation...");
33+
Logger.MethodExit();
34+
return;
35+
}
2936
QueryService = new GASV1Client
3037
{
3138
Endpoint = { Address = new EndpointAddress(config.GetUrl(GlobalSignServiceType.QUERY)), Name = "QUERY" }

globalsign-mssl-caplugin/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ internal class Constants
2121
public static string PICKUPDELAY = "DelayTime";
2222
public static string SYNCSTARTDATE = "SyncStartDate";
2323
public static string SYNCINTERNVALDAYS = "SyncIntervalDays";
24+
public static string Enabled = "Enabled";
2425
}
2526

2627
public static class EnrollmentConfigConstants

globalsign-mssl-caplugin/GlobalSignCAConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class GlobalSignCAConfig
3232

3333
public string SyncStartDate { get; set; } = "";
3434
public int SyncIntervalDays { get; set; } = 0;
35-
35+
public bool Enabled { get; set; } = true;
3636

3737
public string GetUrl(GlobalSignServiceType queryType)
3838
{

globalsign-mssl-caplugin/GlobalSignCAPlugin.cs

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,24 @@ public class GlobalSignCAPlugin : IAnyCAPlugin
2323
private ICertificateDataReader? _certificateDataReader;
2424
private ILogger Logger;
2525

26-
private GlobalSignCAConfig Config { get; set; } = new();
27-
26+
private GlobalSignCAConfig Config { get; set; } = new();
27+
private bool _enabled = false;
2828

2929
public void Initialize(IAnyCAPluginConfigProvider configProvider, ICertificateDataReader certificateDataReader)
3030
{
3131
Logger = LogHandler.GetClassLogger(GetType());
3232
Logger.MethodEntry();
33+
_enabled = (bool)configProvider.CAConnectionData["Enabled"];
34+
if (!_enabled)
35+
{
36+
Logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping config validation and MSSL Client creation...");
37+
Logger.MethodExit();
38+
return;
39+
}
3340
Config = new GlobalSignCAConfig
3441
{
3542
IsTest = bool.Parse((string)configProvider.CAConnectionData["TestAPI"]),
43+
Enabled = bool.Parse((string)configProvider.CAConnectionData["Enabled"]),
3644
Password = (string)configProvider.CAConnectionData["GlobalSignPassword"],
3745
Username = (string)configProvider.CAConnectionData["GlobalSignUsername"],
3846
PickupDelay = int.Parse((string)configProvider.CAConnectionData["DelayTime"]),
@@ -426,6 +434,12 @@ public async Task<EnrollmentResult> Enroll(string csr, string subject, Dictionar
426434
public async Task Ping()
427435
{
428436
Logger.MethodEntry();
437+
if (!_enabled)
438+
{
439+
Logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping config validation and MSSL Client creation...");
440+
Logger.MethodExit();
441+
return;
442+
}
429443
try
430444
{
431445
Logger.LogInformation("Ping reqeuest recieved");
@@ -443,6 +457,18 @@ public async Task ValidateCAConnectionInfo(Dictionary<string, object> connection
443457
{
444458
Logger = LogHandler.GetClassLogger(GetType());
445459
Logger.MethodEntry();
460+
461+
// Handle Enabled flag - could be bool or string
462+
var enabledValue = connectionInfo["Enabled"];
463+
bool isEnabled = enabledValue is bool ? (bool)enabledValue : bool.Parse((string)enabledValue);
464+
465+
if (!isEnabled)
466+
{
467+
Logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation...");
468+
Logger.MethodExit(LogLevel.Trace);
469+
return;
470+
}
471+
446472
Config = new GlobalSignCAConfig
447473
{
448474
IsTest = bool.Parse((string)connectionInfo["TestAPI"]),
@@ -455,6 +481,7 @@ public async Task ValidateCAConnectionInfo(Dictionary<string, object> connection
455481
ORDER_TEST_URL = (string)connectionInfo["OrderAPITestURL"],
456482
QUERY_TEST_URL = (string)connectionInfo["QueryAPITestURL"],
457483
QUERY_PROD_URL = (string)connectionInfo["QueryAPIProdURL"],
484+
Enabled = isEnabled,
458485
SyncStartDate = connectionInfo.TryGetValue("SyncStartDate", out object? value)
459486
? (string)value : string.Empty,
460487
SyncIntervalDays = connectionInfo.TryGetValue("SyncIntervalDays", out var val)
@@ -470,6 +497,17 @@ public async Task ValidateCAConnectionInfo(Dictionary<string, object> connection
470497

471498
public Task ValidateProductInfo(EnrollmentProductInfo productInfo, Dictionary<string, object> connectionInfo)
472499
{
500+
// Handle Enabled flag - could be bool or string
501+
var enabledValue = connectionInfo["Enabled"];
502+
bool isEnabled = enabledValue is bool ? (bool)enabledValue : bool.Parse((string)enabledValue);
503+
504+
if (!isEnabled)
505+
{
506+
Logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation...");
507+
Logger.MethodExit(LogLevel.Trace);
508+
return Task.CompletedTask;
509+
}
510+
473511
Config = new GlobalSignCAConfig
474512
{
475513
IsTest = bool.Parse((string)connectionInfo["TestAPI"]),
@@ -482,6 +520,7 @@ public Task ValidateProductInfo(EnrollmentProductInfo productInfo, Dictionary<st
482520
ORDER_TEST_URL = (string)connectionInfo["OrderAPITestURL"],
483521
QUERY_TEST_URL = (string)connectionInfo["QueryAPITestURL"],
484522
QUERY_PROD_URL = (string)connectionInfo["QueryAPIProdURL"],
523+
Enabled = isEnabled,
485524
SyncStartDate = connectionInfo.TryGetValue("SyncStartDate", out object? value)
486525
? (string)value : string.Empty,
487526
SyncIntervalDays = connectionInfo.TryGetValue("SyncIntervalDays", out var val)
@@ -592,6 +631,13 @@ public Dictionary<string, PropertyConfigInfo> GetCAConnectorAnnotations()
592631
Hidden = false,
593632
DefaultValue = "2000-01-01",
594633
Type = "Integer"
634+
},
635+
[Constants.Enabled] = new()
636+
{
637+
Comments = "Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available.",
638+
Hidden = false,
639+
DefaultValue = true,
640+
Type = "Boolean"
595641
}
596642
};
597643
}

integration-manifest.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
{
6161
"name": "SyncStartDate",
6262
"description": "If provided, full syncs will start at the specified date."
63+
},
64+
{
65+
"name": "Enabled",
66+
"description": "Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available."
6367
}
6468
],
6569
"enrollment_config": [

0 commit comments

Comments
 (0)