Skip to content

Commit fca535d

Browse files
authored
Merge pull request #12 from Keyfactor/enabledconfigflg
enabled flag
2 parents 36ae054 + 86858e1 commit fca535d

8 files changed

Lines changed: 60 additions & 23 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
- 1.1.0
2+
- Enabled Flag For Gateway
3+
- Dual Build Support
14
- 1.0.0
25
- First production release of the Aruba Clearpass AnyCA Gateway REST plugin that implements:
36
- CA Sync
@@ -7,3 +10,6 @@
710
- Support certificate renewal/re-issuance (new public/private keys with the same or different domain names)
811
- Certificate revocation
912
- Request revocation of a previously issued certificate
13+
14+
15+

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ The Aruba Clearpass Gateway AnyCA Gateway REST plugin is supported by Keyfacto
5454
5555
## Requirements
5656

57-
---
58-
5957
### ClearPass Onboard: Setting Up an API Client
6058

6159
#### Step 1: Access ClearPass Admin Console
@@ -81,7 +79,9 @@ The Aruba Clearpass Gateway AnyCA Gateway REST plugin is supported by Keyfacto
8179
- Select **ClearPass REST API - Client will be used for API calls to ClearPass** from the **Operating Mode** dropdown.
8280

8381
- **Operator Profile**:
82+
8483
- Select **Super Administrator** from the **Operator Profile** dropdown.
84+
8585
- This profile will provide the API client with the necessary permissions to interact with ClearPass.
8686

8787
- **Grant Type**:
@@ -94,7 +94,6 @@ The Aruba Clearpass Gateway AnyCA Gateway REST plugin is supported by Keyfacto
9494
- **Note:** The client secret is used in the OAuth2 `client_secret` parameter and will be encrypted once stored, so be sure to copy it securely.
9595

9696
#### Step 4: Set Token Lifetimes
97-
9897
- **Access Token Lifetime**:
9998
- Enter `8` in the **Access Token Lifetime** field.
10099
- Select **hours** from the dropdown. This means the access token will be valid for 8 hours.
@@ -166,13 +165,16 @@ At the time of writing, there was no API call available to get a list of Certifi
166165

167166
2. On the server hosting the AnyCA Gateway REST, download and unzip the latest [Aruba Clearpass Gateway AnyCA Gateway REST plugin](https://github.com/Keyfactor/aruba-clearpass-caplugin/releases/latest) from GitHub.
168167

169-
3. Copy the unzipped directory (usually called `net6.0`) to the Extensions directory:
168+
3. Copy the unzipped directory (usually called `net6.0` or `net8.0`) to the Extensions directory:
169+
170170

171171
```shell
172+
Depending on your AnyCA Gateway REST version, copy the unzipped directory to one of the following locations:
172173
Program Files\Keyfactor\AnyCA Gateway\AnyGatewayREST\net6.0\Extensions
174+
Program Files\Keyfactor\AnyCA Gateway\AnyGatewayREST\net8.0\Extensions
173175
```
174176

175-
> The directory containing the Aruba Clearpass Gateway AnyCA Gateway REST plugin DLLs (`net6.0`) can be named anything, as long as it is unique within the `Extensions` directory.
177+
> The directory containing the Aruba Clearpass Gateway AnyCA Gateway REST plugin DLLs (`net6.0` or `net8.0`) can be named anything, as long as it is unique within the `Extensions` directory.
176178

177179
4. Restart the AnyCA Gateway REST service.
178180

@@ -184,7 +186,7 @@ At the time of writing, there was no API call available to get a list of Certifi
184186

185187
* **Gateway Registration**
186188

187-
TODO Gateway Registration is a required section
189+
Each defined Certificate Authority in the AnyCA Gateway REST can support one issuing certificate authority. Since Aruba ClearPass Onboard has multiple available Certificate Authorities, if you require certificate enrollment from multiple Aruba ClearPass Certificate Authorities, you must define multiple Certificate Authorities in the AnyCA Gateway REST. This will manifest in Command as one Aruba ClearPass CA per defined Certificate Authority.
188190

189191
* **CA Connection**
190192

@@ -194,6 +196,7 @@ At the time of writing, there was no API call available to get a list of Certifi
194196
* **BaseUrl** - Base Url for ClearPass API such as https://url:8443
195197
* **ClearPassApiClient** - ClearPass API Client Name
196198
* **ClearPassCaId** - ClearPass Ca Id. Example would be 2. In ClearPass Onboard UI, click edit on the Ca and look at the id in the Url.
199+
* **Enabled** - Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available.
197200

198201
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 Aruba Clearpass Gateway plugin supports the following product IDs:
199202
@@ -205,12 +208,6 @@ At the time of writing, there was no API call available to get a list of Certifi
205208
206209
3. Follow the [official Keyfactor documentation](https://software.keyfactor.com/Guides/AnyCAGatewayREST/Content/AnyCAGatewayREST/AddCA-Keyfactor.htm) to add each defined Certificate Authority to Keyfactor Command and import the newly defined Certificate Templates.
207210
208-
4. In Keyfactor Command (v12.3+), for each imported Certificate Template, follow the [official documentation](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/Configuring%20Template%20Options.htm) to define enrollment fields for each of the following parameters:
209-
210-
* **NumberOfDaysValid** - OPTIONAL: The number of days of validity to use when requesting certs. If not provided, default is 365.
211-
212-
213-
214211
215212
216213
## License

aruba-clearpass-caplugin.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.31729.503
4+
VisualStudioVersion = 17.10.35027.167
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aruba-clearpass-caplugin", "aruba-clearpass-caplugin/aruba-clearpass-caplugin.csproj", "{9D2D6ED9-4626-430C-879D-0FE0FEBED146}"
77
EndProject

aruba-clearpass-caplugin/ArubaClearPassCAPlugin.cs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Keyfactor.AnyGateway.Extensions;
1+
using Keyfactor.AnyGateway.Extensions;
22
using Keyfactor.Extensions.CAPlugin.ArubaClearPass.Client;
33
using Keyfactor.Logging;
44
using Keyfactor.PKI.Enums.EJBCA;
@@ -128,6 +128,13 @@ public async Task<EnrollmentResult> Enroll(string csr, string subject, Dictionar
128128
public async Task Ping()
129129
{
130130
_logger.MethodEntry(LogLevel.Trace);
131+
if (!_config.Enabled)
132+
{
133+
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping connectivity test...");
134+
_logger.MethodExit(LogLevel.Trace);
135+
return;
136+
}
137+
131138
try
132139
{
133140
_logger.LogInformation($"Attempting to authenticate");
@@ -159,7 +166,21 @@ public async Task Ping()
159166

160167
public async Task ValidateCAConnectionInfo(Dictionary<string, object> connectionInfo)
161168
{
162-
_logger.LogInformation("Validation successful");
169+
try
170+
{
171+
if (!(bool)connectionInfo[ArubaClearPassConstants.Config.Enabled])
172+
{
173+
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation...");
174+
_logger.MethodExit(LogLevel.Trace);
175+
return;
176+
}
177+
}
178+
catch (Exception ex)
179+
{
180+
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
181+
}
182+
183+
_logger.LogInformation("Validating CA Connection Info");
163184

164185
List<string> errors = new List<string>();
165186

@@ -181,7 +202,7 @@ public async Task ValidateCAConnectionInfo(Dictionary<string, object> connection
181202
errors.Add("The Base URL needs http:// or https://");
182203
}
183204

184-
_logger.LogTrace("Checking the API Secret.");
205+
_logger.LogTrace("Checking the API Client.");
185206
string apiClient = connectionInfo.ContainsKey(ArubaClearPassConstants.Config.ClearPassApiClient) ? (string)connectionInfo[ArubaClearPassConstants.Config.ClearPassApiClient] : string.Empty;
186207
if (string.IsNullOrWhiteSpace(apiClient))
187208
{
@@ -245,6 +266,13 @@ public Dictionary<string, PropertyConfigInfo> GetCAConnectorAnnotations()
245266
Hidden = false,
246267
DefaultValue = "",
247268
Type = "String"
269+
},
270+
[ArubaClearPassConstants.Config.Enabled] = new PropertyConfigInfo() //No Call Available to get a list of the CAs with Ids in API so...
271+
{
272+
Comments = "Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available.",
273+
Hidden = false,
274+
DefaultValue = true,
275+
Type = "Boolean"
248276
}
249277
};
250278
}
@@ -280,5 +308,4 @@ Task<AnyCAPluginCertificate> IAnyCAPlugin.GetSingleRecord(string caRequestID)
280308
}
281309

282310
}
283-
}
284-
311+
}

aruba-clearpass-caplugin/ArubaClearPassConfig.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ public ArubaClearPassConfig()
1111
public string BaseUrl { get; set; }
1212
public string ClearPassApiClient { get; set; }
1313
public string ClearPassCaId { get; set; }
14+
public bool Enabled { get; set; } = true;
1415
}
15-
}
16+
}

aruba-clearpass-caplugin/Constants.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class Config
88
public const string ClearPassApiClient = "ClearPassApiClient";
99
public const string ClientSecret = "ClientSecret";
1010
public const string ClearPassCaId = "ClearPassCaId";
11+
public const string Enabled = "Enabled";
1112
}
1213

1314
public class Products
@@ -24,4 +25,4 @@ public class ProductParams
2425
public const string NumberOfDaysValid = "NumberOfDaysValid";
2526
}
2627
}
27-
}
28+
}

aruba-clearpass-caplugin/aruba-clearpass-caplugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
55
<RootNamespace>Keyfactor.Extensions.CAPlugin.ArubaClearPass</RootNamespace>
66
<ImplicitUsings>disable</ImplicitUsings>
77
<Nullable>disable</Nullable>

integration-manifest.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://keyfactor.github.io/integration-manifest-schema.json",
2+
"$schema": "https://keyfactor.github.io/v2/integration-manifest-schema.json",
33
"integration_type": "anyca-plugin",
44
"name": "Aruba Clearpass AnyCA REST Gateway Plugin",
55
"status": "pilot",
@@ -8,7 +8,8 @@
88
"update_catalog": true,
99
"description": "Aruba Clearpass plugin for the AnyCA REST Gateway framework",
1010
"gateway_framework": "24.2.0",
11-
"release_dir": "aruba-clearpass-caplugin/bin/Release/net6.0",
11+
"release_dir": "aruba-clearpass-caplugin/bin/Release",
12+
"release_project": "aruba-clearpass-caplugin/aruba-clearpass-caplugin.csproj",
1213
"about": {
1314
"carest": {
1415
"ca_plugin_config": [
@@ -27,6 +28,10 @@
2728
{
2829
"name": "ClearPassCaId",
2930
"description": "ClearPass Ca Id. Example would be 2. In ClearPass Onboard UI, click edit on the Ca and look at the id in the Url."
31+
},
32+
{
33+
"name": "Enabled",
34+
"description": "Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available."
3035
}
3136
],
3237
"enrollment_config": [

0 commit comments

Comments
 (0)