Skip to content

Commit 1a5ddfc

Browse files
committed
Update to provide "Enabled" flag support for SAAS deployment.
1 parent e30f109 commit 1a5ddfc

7 files changed

Lines changed: 83 additions & 7 deletions

File tree

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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<p align="center">
66
<!-- Badges -->
77
<img src="https://img.shields.io/badge/integration_status-production-3D1973?style=flat-square" alt="Integration Status: production" />
8-
<a href="https://github.com/Keyfactor/globalsign-mssl-caplugin/releases"><img src="https://img.shields.io/github/v/release/Keyfactor/globalsign-mssl-caplugin?style=flat-square" alt="Release" /></a>
9-
<img src="https://img.shields.io/github/issues/Keyfactor/globalsign-mssl-caplugin?style=flat-square" alt="Issues" />
10-
<img src="https://img.shields.io/github/downloads/Keyfactor/globalsign-mssl-caplugin/total?style=flat-square&label=downloads&color=28B905" alt="GitHub Downloads (all assets, all releases)" />
8+
<a href="https://github.com/Keyfactor/globalsign-mssl-caplugin-dev/releases"><img src="https://img.shields.io/github/v/release/Keyfactor/globalsign-mssl-caplugin-dev?style=flat-square" alt="Release" /></a>
9+
<img src="https://img.shields.io/github/issues/Keyfactor/globalsign-mssl-caplugin-dev?style=flat-square" alt="Issues" />
10+
<img src="https://img.shields.io/github/downloads/Keyfactor/globalsign-mssl-caplugin-dev/total?style=flat-square&label=downloads&color=28B905" alt="GitHub Downloads (all assets, all releases)" />
1111
</p>
1212

1313
<p align="center">
@@ -60,7 +60,7 @@ This extension uses the contact information of the GCC Domain point of contact f
6060

6161
1. Install the AnyCA Gateway REST per the [official Keyfactor documentation](https://software.keyfactor.com/Guides/AnyCAGatewayREST/Content/AnyCAGatewayREST/InstallIntroduction.htm).
6262

63-
2. On the server hosting the AnyCA Gateway REST, download and unzip the latest [GlobalSign MSSL Gateway AnyCA Gateway REST plugin](https://github.com/Keyfactor/globalsign-mssl-caplugin/releases/latest) from GitHub.
63+
2. On the server hosting the AnyCA Gateway REST, download and unzip the latest [GlobalSign MSSL Gateway AnyCA Gateway REST plugin](https://github.com/Keyfactor/globalsign-mssl-caplugin-dev/releases/latest) from GitHub.
6464

6565
3. Copy the unzipped directory (usually called `net6.0` or `net8.0`) to the Extensions directory:
6666

@@ -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: 36 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,19 @@ public async Task ValidateCAConnectionInfo(Dictionary<string, object> connection
443457
{
444458
Logger = LogHandler.GetClassLogger(GetType());
445459
Logger.MethodEntry();
460+
try
461+
{
462+
if (!(bool)connectionInfo["Enabled"])
463+
{
464+
Logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation...");
465+
Logger.MethodExit(LogLevel.Trace);
466+
return;
467+
}
468+
}
469+
catch (Exception ex)
470+
{
471+
Logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
472+
}
446473
Config = new GlobalSignCAConfig
447474
{
448475
IsTest = bool.Parse((string)connectionInfo["TestAPI"]),
@@ -592,6 +619,13 @@ public Dictionary<string, PropertyConfigInfo> GetCAConnectorAnnotations()
592619
Hidden = false,
593620
DefaultValue = "2000-01-01",
594621
Type = "Integer"
622+
},
623+
[Constants.Enabled] = new()
624+
{
625+
Comments = "Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available.",
626+
Hidden = false,
627+
DefaultValue = true,
628+
Type = "Boolean"
595629
}
596630
};
597631
}

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)