Skip to content

Commit 255fb47

Browse files
authored
Reconcile 1.0.1 to main (#14)
* Update generated README * Fix inventory issue where a 404 on an individual managed web site would cause inventory to end returning no certificates. * Update bootstrap and manifest
1 parent e40df86 commit 255fb47

File tree

8 files changed

+92
-50
lines changed

8 files changed

+92
-50
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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@v2
15+
secrets:
16+
token: ${{ secrets.V2BUILDTOKEN}}
17+
APPROVE_README_PUSH: ${{ secrets.APPROVE_README_PUSH}}
18+
gpg_key: ${{ secrets.KF_GPG_PRIVATE_KEY }}
19+
gpg_pass: ${{ secrets.KF_GPG_PASSPHRASE }}

.github/workflows/keyfactor-starter-workflow.yml

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

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
v1.0.1
2+
- Bug fix: Individual site timeouts will no longer end inventory but will instead skip that site and move on. Inventory in those cases will produce a warning that certificates could not be retrieved for one or more sites, but it will still return all retrieved certificates.
3+
14
v1.0
25
- Initial Version

Imperva/APIProcessor.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,14 @@ public List<Site> GetSites()
107107
return sites;
108108
}
109109

110-
public X509Certificate2 GetServerCertificateAsync(string url)
110+
public X509Certificate2 GetServerCertificateAsync(string url, out bool hadError)
111111
{
112+
ILogger logger = LogHandler.GetClassLogger<APIProcessor>();
113+
logger.MethodEntry(LogLevel.Debug);
114+
logger.LogTrace($"Calling URL {url}");
115+
116+
hadError = false;
117+
112118
if (!url.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
113119
url = "https://" + url;
114120

@@ -117,7 +123,9 @@ public X509Certificate2 GetServerCertificateAsync(string url)
117123
{
118124
ServerCertificateCustomValidationCallback = (_, cert, __, ___) =>
119125
{
126+
logger.LogTrace("Hit handler");
120127
certificate = new X509Certificate2(cert.GetRawCertData());
128+
logger.LogTrace($"Cert returned: {cert.GetRawCertData()}");
121129
return true;
122130
}
123131
};
@@ -128,8 +136,13 @@ public X509Certificate2 GetServerCertificateAsync(string url)
128136
{
129137
httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, url)).GetAwaiter().GetResult();
130138
}
131-
catch (HttpRequestException) { }
139+
catch (Exception ex)
140+
{
141+
logger.LogError(ImpervaException.FlattenExceptionMessages(ex, $"Error retrieving certificate for {url}: "));
142+
hadError = true;
143+
}
132144

145+
logger.MethodExit(LogLevel.Debug);
133146
return certificate;
134147
}
135148
#endregion

Imperva/Inventory.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public JobResult ProcessJob(InventoryJobConfiguration config, SubmitInventoryUpd
3838
logger.LogDebug($"Store Path: {config.CertificateStoreDetails.StorePath}");
3939

4040
List<CurrentInventoryItem> inventoryItems = new List<CurrentInventoryItem>();
41+
bool oneOrMoreErrors = false;
4142

4243
try
4344
{
@@ -50,7 +51,10 @@ public JobResult ProcessJob(InventoryJobConfiguration config, SubmitInventoryUpd
5051

5152
foreach(Site site in sites)
5253
{
53-
X509Certificate2 certificate = api.GetServerCertificateAsync(site.Domain);
54+
bool hadError = false;
55+
X509Certificate2 certificate = api.GetServerCertificateAsync(site.Domain, out hadError);
56+
if (hadError)
57+
oneOrMoreErrors = true;
5458
if (certificate == null)
5559
continue;
5660
inventoryItems.Add(new CurrentInventoryItem()
@@ -74,7 +78,10 @@ public JobResult ProcessJob(InventoryJobConfiguration config, SubmitInventoryUpd
7478
try
7579
{
7680
submitInventory.Invoke(inventoryItems);
77-
return new JobResult() { Result = Keyfactor.Orchestrators.Common.Enums.OrchestratorJobStatusJobResult.Success, JobHistoryId = config.JobHistoryId };
81+
if (oneOrMoreErrors)
82+
return new JobResult() { Result = Keyfactor.Orchestrators.Common.Enums.OrchestratorJobStatusJobResult.Warning, JobHistoryId = config.JobHistoryId, FailureMessage = "One or more certificates could not be returned. Please see the log for more details." };
83+
else
84+
return new JobResult() { Result = Keyfactor.Orchestrators.Common.Enums.OrchestratorJobStatusJobResult.Success, JobHistoryId = config.JobHistoryId };
7885
}
7986
catch (Exception ex)
8087
{

Imperva/Management.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
6060
{
6161
case CertStoreOperationType.Add:
6262

63-
if (!config.Overwrite && api.GetServerCertificateAsync(site.Domain) != null)
63+
bool hadError = false;
64+
if (!config.Overwrite && api.GetServerCertificateAsync(site.Domain, out hadError) != null)
6465
return new JobResult() { Result = Keyfactor.Orchestrators.Common.Enums.OrchestratorJobStatusJobResult.Warning, JobHistoryId = config.JobHistoryId, FailureMessage = $"Overwrite is set to false but there is a certificate that already is bound to {config.JobCertificate.Alias}. Please set overwrite to true and reschedule the job to replace this certificate." };
6566

6667
api.AddCertificate(site.SiteID, config.JobCertificate.Contents, config.JobCertificate.PrivateKeyPassword);

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# Imperva
23

34
The Imperva Orchestrator Extension allows for the management of SSL certificates bound to web sites managed by the Imperva cloud-based firewall.
@@ -12,18 +13,22 @@ The Universal Orchestrator is part of the Keyfactor software distribution and is
1213

1314
The Universal Orchestrator is the successor to the Windows Orchestrator. This Orchestrator Extension plugin only works with the Universal Orchestrator and does not work with the Windows Orchestrator.
1415

16+
## Support for Imperva
1517

18+
Imperva is supported by Keyfactor for Keyfactor customers. If you have a support issue, please open a support ticket via the Keyfactor Support Portal at https://support.keyfactor.com
1619

20+
###### To report a problem or suggest a new feature, use the **[Issues](../../issues)** tab. If you want to contribute actual bug fixes or proposed enhancements, use the **[Pull requests](../../pulls)** tab.
1721

1822
---
1923

2024

25+
---
26+
2127

2228

2329
## Keyfactor Version Supported
2430

2531
The minimum version of the Keyfactor Universal Orchestrator Framework needed to run this version of the extension is 10.1
26-
2732
## Platform Specific Notes
2833

2934
The Keyfactor Universal Orchestrator may be installed on either Windows or Linux based platforms. The certificate operations supported by a capability may vary based what platform the capability is installed on. The table below indicates what capabilities are supported based on which platform the encompassing Universal Orchestrator is running.
@@ -51,6 +56,11 @@ It is not necessary to use a PAM Provider for all of the secrets available above
5156

5257
If a PAM Provider will be used for one of the fields above, start by referencing the [Keyfactor Integration Catalog](https://keyfactor.github.io/integrations-catalog/content/pam). The GitHub repo for the PAM Provider to be used contains important information such as the format of the `json` needed. What follows is an example but does not reflect the `json` values for all PAM Providers as they have different "instance" and "initialization" parameter names and values.
5358

59+
<details><summary>General PAM Provider Configuration</summary>
60+
<p>
61+
62+
63+
5464
### Example PAM Provider Setup
5565

5666
To use a PAM Provider to resolve a field, in this example the __Server Password__ will be resolved by the `Hashicorp-Vault` provider, first install the PAM Provider extension from the [Keyfactor Integration Catalog](https://keyfactor.github.io/integrations-catalog/content/pam) on the Universal Orchestrator.
@@ -77,6 +87,8 @@ To have the __Server Password__ field resolved by the `Hashicorp-Vault` provider
7787
~~~
7888

7989
This text would be entered in as the value for the __Server Password__, instead of entering in the actual password. The Orchestrator will attempt to use the PAM Provider to retrieve the __Server Password__. If PAM should not be used, just directly enter in the value for the field.
90+
</p>
91+
</details>
8092

8193

8294

integration-manifest.json

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
"name": "Imperva",
55
"status": "production",
66
"description": "The Imperva Orchestrator Extension allows for the management of SSL certificates bound to web sites managed by the Imperva cloud-based firewall.",
7-
"link_github": true,
7+
"release_dir": "Imperva/bin/Release",
8+
"support_level": "kf-supported",
89
"update_catalog": true,
10+
"link_github": true,
911
"about": {
1012
"orchestrator": {
1113
"UOFramework": "10.1",
1214
"pam_support": true,
15+
"keyfactor_platform_version": "9.10",
1316
"win": {
1417
"supportsCreateStore": false,
1518
"supportsDiscovery": false,
@@ -25,7 +28,33 @@
2528
"supportsManagementRemove": true,
2629
"supportsReenrollment": false,
2730
"supportsInventory": true
31+
},
32+
"store_types": {
33+
"Imperva": {
34+
"Name": "Imperva",
35+
"ShortName": "Imperva",
36+
"Capability": "Imperva",
37+
"ServerRequired": false,
38+
"BlueprintAllowed": false,
39+
"CustomAliasAllowed": "Required",
40+
"PowerShell": false,
41+
"PrivateKeyAllowed": "Required",
42+
"SupportedOperations": {
43+
"Add": true,
44+
"Create": false,
45+
"Discovery": false,
46+
"Enrollment": false,
47+
"Remove": true
48+
},
49+
"PasswordOptions": {
50+
"Style": "Default",
51+
"EntrySupported": false,
52+
"StoreRequired": true
53+
},
54+
"Properties": [],
55+
"EntryParameters": []
56+
}
2857
}
2958
}
3059
}
31-
}
60+
}

0 commit comments

Comments
 (0)