-
Notifications
You must be signed in to change notification settings - Fork 0
Merge 1.4.1 to main #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -37,6 +37,7 @@ public class FortigateStore | |||||||||||||||||||
| { | ||||||||||||||||||||
| private ILogger logger { get; set; } | ||||||||||||||||||||
| private string FortigateHost { get; set; } | ||||||||||||||||||||
| private string VDOM { get; set; } | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| private static readonly string available_certificates = "/api/v2/monitor/system/available-certificates"; | ||||||||||||||||||||
|
|
@@ -47,8 +48,7 @@ public class FortigateStore | |||||||||||||||||||
| private static readonly string import_certificate_api = "/api/v2/monitor/vpn-certificate/local/import"; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| private static readonly string get_certificate_api = "/api/v2/cmdb/certificate/local/"; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| private static readonly string update_certificate_api = "/api/v2/cmdb/certificate/local/"; | ||||||||||||||||||||
| private static readonly string get_vdom_api = "/api/v2/cmdb/system/vdom/"; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| //api/v2/cmdb/vpn.certificate/local/test?vdom=root | ||||||||||||||||||||
| private static readonly string delete_certificate_api = "/api/v2/cmdb/vpn.certificate/local/"; | ||||||||||||||||||||
|
|
@@ -63,7 +63,7 @@ public class FortigateStore | |||||||||||||||||||
| }; | ||||||||||||||||||||
| private readonly HttpClient client; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| public FortigateStore(string fortigateHost, string accessToken) | ||||||||||||||||||||
| public FortigateStore(string fortigateHost, string accessToken, string vdom) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| logger = LogHandler.GetClassLogger(this.GetType()); | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -72,6 +72,9 @@ public FortigateStore(string fortigateHost, string accessToken) | |||||||||||||||||||
| client = new HttpClient(handler); | ||||||||||||||||||||
| FortigateHost = fortigateHost; | ||||||||||||||||||||
| client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}"); | ||||||||||||||||||||
| VDOM = string.IsNullOrEmpty(vdom) ? "root" : vdom; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ValidateVDOM(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| logger.MethodExit(LogLevel.Debug); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
@@ -80,9 +83,11 @@ public void Delete(string alias) | |||||||||||||||||||
| { | ||||||||||||||||||||
| logger.MethodEntry(LogLevel.Debug); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||||||||||||||||||||
| parameters.Add("vdom", VDOM); | ||||||||||||||||||||
| try | ||||||||||||||||||||
| { | ||||||||||||||||||||
| DeleteResource(delete_certificate_api + alias); | ||||||||||||||||||||
| DeleteResource(delete_certificate_api + alias, parameters); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| catch (Exception ex) | ||||||||||||||||||||
| { | ||||||||||||||||||||
|
|
@@ -106,8 +111,7 @@ public void UpdateUsage(string alias, string path, string name, string attribute | |||||||||||||||||||
|
|
||||||||||||||||||||
| var endpoint = "/api/v2/cmdb/" + path + "/" + name; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var parameters = new Dictionary<String, String>(); | ||||||||||||||||||||
| parameters.Add("vdom", "root"); | ||||||||||||||||||||
| var parameters = new Dictionary<String, String> { { "vdom", VDOM } }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| try | ||||||||||||||||||||
| { | ||||||||||||||||||||
|
|
@@ -129,8 +133,7 @@ public Usage Usage(string alias, int qtype) | |||||||||||||||||||
| logger.MethodEntry(LogLevel.Debug); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var parameters = new Dictionary<String, String>(); | ||||||||||||||||||||
| parameters.Add("vdom", "root"); | ||||||||||||||||||||
| parameters.Add("scope", "global"); | ||||||||||||||||||||
| parameters.Add("vdom", VDOM); | ||||||||||||||||||||
| parameters.Add("mkey", alias); | ||||||||||||||||||||
| parameters.Add("qtypes", $"[{qtype.ToString()}]"); | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -289,16 +292,14 @@ private void Insert(string alias, string cert, string privateKey, string passwor | |||||||||||||||||||
| certname = alias, | ||||||||||||||||||||
| key_file_content = privateKey, | ||||||||||||||||||||
| file_content = cert, | ||||||||||||||||||||
| scope = "global", | ||||||||||||||||||||
| //password = password, | ||||||||||||||||||||
| scope = "vdom", | ||||||||||||||||||||
| vdom = VDOM, | ||||||||||||||||||||
| type = "regular" | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var parameters = new Dictionary<String, String>(); | ||||||||||||||||||||
| parameters.Add("vdom", "root"); | ||||||||||||||||||||
| try | ||||||||||||||||||||
| { | ||||||||||||||||||||
| PostAsJson(import_certificate_api, cert_resource, parameters); | ||||||||||||||||||||
| PostAsJson(import_certificate_api, cert_resource); | ||||||||||||||||||||
|
||||||||||||||||||||
| PostAsJson(import_certificate_api, cert_resource); | |
| var importCertificateUrl = import_certificate_api; | |
| var separator = importCertificateUrl.Contains("?") ? "&" : "?"; | |
| importCertificateUrl = $"{importCertificateUrl}{separator}vdom={HttpUtility.UrlEncode(VDOM)}"; | |
| PostAsJson(importCertificateUrl, cert_resource); |
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ValidateVDOM() builds an error message using response.Content, which is an HttpContent object and won’t contain the response body unless you read it. This makes troubleshooting much harder and may log only the type name. Read the content via ReadAsStringAsync() (or similar) and include that string in the exception message.
| if (response.StatusCode == System.Net.HttpStatusCode.NotFound) | |
| throw new FortigateException($"VDOM {VDOM} not found."); | |
| if (!response.IsSuccessStatusCode) | |
| throw new FortigateException($"Error retrieving VDOM {VDOM}. Status={response.StatusCode.ToString()}, Error={response.Content} {response.ReasonPhrase}"); | |
| var content = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); | |
| if (response.StatusCode == System.Net.HttpStatusCode.NotFound) | |
| throw new FortigateException($"VDOM {VDOM} not found."); | |
| if (!response.IsSuccessStatusCode) | |
| throw new FortigateException($"Error retrieving VDOM {VDOM}. Status={response.StatusCode.ToString()}, Error={content} {response.ReasonPhrase}"); |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |||
| using Keyfactor.Logging; | ||||
| using Microsoft.Extensions.Logging; | ||||
| using Keyfactor.Orchestrators.Extensions.Interfaces; | ||||
| using Org.BouncyCastle.Tls; | ||||
|
||||
| using Org.BouncyCastle.Tls; |
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FailureMessage text has a grammar/capitalization issue (comma splice and capital “Please” mid-sentence). Consider rephrasing to a single sentence and/or include actionable context (e.g., how many certificates failed, and that details are in logs).
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,17 +31,18 @@ | |||||||
|
|
||||||||
| ## Overview | ||||||||
|
|
||||||||
| The Fortigate Orchestrator Extension supports the following use cases: | ||||||||
| 1. Inventory of local user and factory cerificates | ||||||||
| 2. Ability to add new local certificates | ||||||||
| 3. Ability to replace bound* and unbound local user certificates (usually after renewal in Keyfactor Command) | ||||||||
| 4. Ability to delete **unbound** local user certificates | ||||||||
| The Fortigate Orchestrator Extension supports the following use cases against a specified VDOM: | ||||||||
| 1. Inventory of local user and factory VDOM and globally scoped cerificates | ||||||||
|
||||||||
| 1. Inventory of local user and factory VDOM and globally scoped cerificates | |
| 1. Inventory of local user and factory VDOM and globally scoped certificates |
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Markdown table row contains || and appears to have two rows merged into one line, which breaks table rendering. Split this into two separate table rows so the compatibility matrix renders correctly.
| | Between `11.0.0` and `11.5.1` (inclusive) | `net8.0` | `Disable` | `net6.0` || Between `11.0.0` and `11.5.1` (inclusive) | `net8.0` | `LatestMajor` | `net8.0` | | |
| | Between `11.0.0` and `11.5.1` (inclusive) | `net8.0` | `Disable` | `net6.0` | | |
| | Between `11.0.0` and `11.5.1` (inclusive) | `net8.0` | `LatestMajor` | `net8.0` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR title indicates a 1.4.1 merge, but the changelog entry added here is
v1.4.0. If this PR is meant to merge 1.4.1, consider adding/updating thev1.4.1section (or confirm the PR title/version is correct).