Skip to content
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

Merge 1.0.0 to main #3

Merged
merged 81 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
1db5572
Update CHANGELOG.md
bhillkeyfactor Dec 3, 2024
b992191
Update integration-manifest.json
bhillkeyfactor Dec 3, 2024
8cf1b5e
doc updates
bhillkeyfactor Dec 3, 2024
73d69a6
Delete README.md
bhillkeyfactor Dec 3, 2024
1765166
Create README.md
bhillkeyfactor Dec 3, 2024
aa7aa5f
Update content.md
bhillkeyfactor Dec 3, 2024
76bf5ab
Create fortiweb
bhillkeyfactor Dec 3, 2024
856b66c
Update integration-manifest.json
bhillkeyfactor Dec 3, 2024
cf66d40
Rename fortiweb to fortiweb.md
bhillkeyfactor Dec 3, 2024
aed5b43
Update keyfactor-starter-workflow.yml
bhillkeyfactor Dec 3, 2024
1cef803
Update integration-manifest.json
bhillkeyfactor Dec 4, 2024
ee30fef
Update generated docs
Dec 4, 2024
74b2a32
Update integration-manifest.json
bhillkeyfactor Dec 4, 2024
b76d423
Update generated docs
Dec 4, 2024
e4c7639
Update fortiweb.md
bhillkeyfactor Dec 4, 2024
5ab4488
Update generated docs
Dec 4, 2024
0e793f2
Update fortiweb.md
bhillkeyfactor Dec 4, 2024
77c7f0b
Update generated docs
Dec 4, 2024
21ce595
Fixed Store Settings to Use ADom instead of API Key
bhillkeyfactor Dec 4, 2024
8499f6b
Merge branch 'dev_1.0' of https://github.com/Keyfactor/fortinet-forti…
bhillkeyfactor Dec 4, 2024
2c2e0be
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
64c2bbc
Update generated docs
Dec 5, 2024
e6b07c6
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
4c1942d
Update generated docs
Dec 5, 2024
f811d03
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
bb16b55
Update generated docs
Dec 5, 2024
556690a
Update integration-manifest.json
bhillkeyfactor Dec 5, 2024
50de26d
Update generated docs
Dec 5, 2024
b4165a2
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
93afd65
Update generated docs
Dec 5, 2024
af26e0d
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
f1eb89a
Update generated docs
Dec 5, 2024
a29d1f7
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
197ff90
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
58c87cc
Update generated docs
Dec 5, 2024
15ab7c0
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
295f292
Update generated docs
Dec 5, 2024
24dfd87
Create testcases.md
bhillkeyfactor Dec 5, 2024
a65eae1
Update content.md
bhillkeyfactor Dec 5, 2024
cbb1cc6
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
23c4cef
Update testcases.md
bhillkeyfactor Dec 5, 2024
ad9bfdd
Update testcases.md
bhillkeyfactor Dec 5, 2024
7945b48
Update content.md
bhillkeyfactor Dec 5, 2024
c958cc7
Update generated docs
Dec 5, 2024
650e365
Update content.md
bhillkeyfactor Dec 5, 2024
1c47f7c
Delete docsource/testcases.md
bhillkeyfactor Dec 5, 2024
ce5b984
Update generated docs
Dec 5, 2024
ac6eece
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
e55cd98
Update content.md
bhillkeyfactor Dec 5, 2024
ddbf3f1
Update generated docs
Dec 5, 2024
7d7114c
Update fortiweb.md
bhillkeyfactor Dec 5, 2024
1a80fcb
Update content.md
bhillkeyfactor Dec 5, 2024
7c9bda2
Update generated docs
Dec 5, 2024
c13523b
Update content.md
bhillkeyfactor Dec 5, 2024
4b36891
Update generated docs
Dec 5, 2024
6a2a32f
Update content.md
bhillkeyfactor Dec 5, 2024
6fa893a
Update generated docs
Dec 5, 2024
a35a66a
Update content.md
bhillkeyfactor Dec 5, 2024
4bb27f9
Update generated docs
Dec 5, 2024
2e16ee4
Update integration-manifest.json
bhillkeyfactor Dec 5, 2024
20ae6c9
Update integration-manifest.json
bhillkeyfactor Dec 5, 2024
3694a24
Update generated docs
Dec 5, 2024
f130735
Update content.md
bhillkeyfactor Dec 5, 2024
d6af975
Update generated docs
Dec 5, 2024
68908a8
Update integration-manifest.json
bhillkeyfactor Dec 5, 2024
ba19aa7
Update generated docs
Dec 5, 2024
90f35e3
added readme information
bhillkeyfactor Dec 5, 2024
bd1df2c
Update generated docs
Dec 5, 2024
e1cd4b6
doc updates
bhillkeyfactor Dec 5, 2024
80c3197
Merge branch 'dev_1.0' of https://github.com/Keyfactor/fortinet-forti…
bhillkeyfactor Dec 5, 2024
10a0056
doc updates
bhillkeyfactor Dec 5, 2024
faf5c0b
Update generated docs
Dec 5, 2024
af15941
Update content.md
bhillkeyfactor Dec 6, 2024
ba1d3a1
Update generated docs
Dec 6, 2024
90c9688
Update content.md
bhillkeyfactor Dec 6, 2024
856803a
Update generated docs
Dec 6, 2024
b550547
Update content.md
bhillkeyfactor Dec 6, 2024
532bbcb
Update generated docs
Dec 6, 2024
86f1ff4
Update content.md
bhillkeyfactor Dec 6, 2024
d79a122
Update generated docs
Dec 6, 2024
9240cfc
Merge pull request #2 from Keyfactor/dev_1.0
doebrowsk Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/keyfactor-starter-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
call-starter-workflow:
uses: keyfactor/actions/.github/workflows/starter.yml@3.1.1
uses: keyfactor/actions/.github/workflows/starter.yml@3.1.2
secrets:
token: ${{ secrets.V2BUILDTOKEN}}
APPROVE_README_PUSH: ${{ secrets.APPROVE_README_PUSH}}
Expand Down
31 changes: 2 additions & 29 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,2 @@
2.2.1
* Fixed URL Encoding on Palo Username and Pwd that caused invalid credentials error

2.2.0
* Removed support for binding cert to new binding location, can only update certs that are previously bound
* Support for replacing certs on all binding locations both Panorama and Firewalls as long as it was there before
* Support for Virtual Systems on Firewalls, tested with only Azure Virtual Version of Firewall
* Support for Virtual Systems on Panorama Templates

2.1.1
* Bug - Add Renew Failure Object Reference Error when Adding/Renewing a cert.

2.1.0
* Support for Pan Level Certficates
* Support for Pushing Entire Certificate Chain to Panorama
* Auto Detection of Trusted Root Certificates
* Fix Inventory Check For Private Key from Dummy to Anything

2.0.1
* Fix Epoch Time in Model from int to long to prevent inventory errors

2.0.0
* Support for Panorama or Firewall connectivity
* Commits changes to the Individual Firewall
* Support for Panorama push to firewalls

1.0.3
* Added PAM Support for Orchestrator

1.0.0
* Initial Release
26 changes: 26 additions & 0 deletions FortiWeb/Client/FortiWebClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ public class FortiWebClient
{
private readonly ILogger _logger;

public string GenerateApiKey(string username, string password, string vdom)
{
// Create the object
var data = new
{
username = username,
password = password,
vdom = vdom
};

// Convert the object to a JSON string
string jsonString = JsonConvert.SerializeObject(data);

// Convert the JSON string to a byte array
byte[] byteArray = Encoding.UTF8.GetBytes(jsonString);

// Base64 encode the byte array
return Convert.ToBase64String(byteArray);
}

public FortiWebClient(string url, string userName, string password, string apiKey)
{
_logger = LogHandler.GetClassLogger<FortiWebClient>();
Expand All @@ -50,6 +70,12 @@ public FortiWebClient(string url, string userName, string password, string apiKe
ApiKey=apiKey;
}


public FortiWebClient()
{
_logger = LogHandler.GetClassLogger<FortiWebClient>();
}

private string ApiKey { get; }

private HttpClient HttpClient { get; }
Expand Down
4 changes: 2 additions & 2 deletions FortiWeb/JobProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ namespace Keyfactor.Extensions.Orchestrator.FortiWeb
{
public class JobProperties
{
[JsonProperty("ApiKey")]
[JsonProperty("ADom")]
[DefaultValue("")]
public string ApiKey { get; set; }
public string ADom { get; set; }


}
Expand Down
5 changes: 4 additions & 1 deletion FortiWeb/Jobs/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ private JobResult PerformInventory(InventoryJobConfiguration config, SubmitInven
_logger.LogTrace(
$"Client Machine: {config.CertificateStoreDetails.ClientMachine}");

var apiClient = new FortiWebClient();
var apiKey = apiClient.GenerateApiKey(ServerUserName, ServerPassword, StoreProperties.ADom);

var client =
new FortiWebClient(config.CertificateStoreDetails.ClientMachine,
ServerUserName, ServerPassword, StoreProperties.ApiKey); //Api base URL Plus Key
ServerUserName, ServerPassword, apiKey); //Api base URL Plus Key
_logger.LogTrace("Inventory FotiWeb Client Created");

var cliCertResults = client.GetCertificateInventory(config.CertificateStoreDetails.ClientMachine, 22, ServerUserName, ServerPassword);
Expand Down
5 changes: 4 additions & 1 deletion FortiWeb/Jobs/Management.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ private JobResult PerformAddition(ManagementJobConfiguration config)
_logger.LogTrace(
$"Credentials JSON: Url: {config.CertificateStoreDetails.ClientMachine} Server UserName: {config.ServerUsername}");

var apiClient = new FortiWebClient();
var apiKey = apiClient.GenerateApiKey(ServerUserName, ServerPassword, StoreProperties.ADom);

var client =
new FortiWebClient(config.CertificateStoreDetails.ClientMachine,
ServerUserName, ServerPassword, StoreProperties.ApiKey); //Api base URL Plus Key
ServerUserName, ServerPassword, apiKey); //Api base URL Plus Key
_logger.LogTrace(
"FortiWeb Client Created");

Expand Down
4 changes: 2 additions & 2 deletions FortiWeb/Validators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public static (bool valid, JobResult result) ValidateStoreProperties(JobProperti
{
var errors = string.Empty;

if (string.IsNullOrEmpty(storeProperties?.ApiKey))
if (string.IsNullOrEmpty(storeProperties?.ADom))
{
errors += "You need to specify an ApiKey for FortiWeb.";
errors += "You need to specify an ADom for FortiWeb.";
}

var hasErrors = (errors.Length > 0);
Expand Down
2 changes: 1 addition & 1 deletion FortiWebTestConsole/FortiWebInventory.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
"ClientMachine": "ClientMachineGoesHere",
"StorePath": "TemplateNameGoesHere",
"StorePassword": "",
"Properties": "{\"ServerUsername\":\"UserNameGoesHere\",\"ServerPassword\":\"PasswordGoesHere\",\"ServerUseSsl\":\"true\",\"ApiKey\":\"ApiKeyGoesHere\"}",
"Properties": "{\"ServerUsername\":\"UserNameGoesHere\",\"ServerPassword\":\"PasswordGoesHere\",\"ServerUseSsl\":\"true\",\"ADom\":\"ADomGoesHere\"}",
"Type": 105
},
"JobCancelled": false,
Expand Down
2 changes: 1 addition & 1 deletion FortiWebTestConsole/FortiWebMgmt.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"ClientMachine": "ClientMachineGoesHere",
"StorePath": "TemplateNameGoesHere",
"StorePassword": null,
"Properties": "{\"ServerUsername\":\"UserNameGoesHere\",\"ServerPassword\":\"PasswordGoesHere\",\"ServerUseSsl\":\"true\",\"ApiKey\":\"ApiKeyGoesHere\"}",
"Properties": "{\"ServerUsername\":\"UserNameGoesHere\",\"ServerPassword\":\"PasswordGoesHere\",\"ServerUseSsl\":\"true\",\"ADom\":\"ADomGoesHere\"}",
"Type": 105
},
"OperationType": 2,
Expand Down
10 changes: 5 additions & 5 deletions FortiWebTestConsole/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
public static string CaseName { get; set; }
public static string CertAlias { get; set; }
public static string ClientMachine { get; set; }
public static string ApiKey { get; set; }
public static string ADom { get; set; }
public static string StorePath { get; set; }
public static string Overwrite { get; set; }
public static string ManagementType { get; set; }
public static string CertificateContent { get; set; }


private static async Task Main(string[] args)

Check warning on line 42 in FortiWebTestConsole/Program.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 42 in FortiWebTestConsole/Program.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 42 in FortiWebTestConsole/Program.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 42 in FortiWebTestConsole/Program.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 42 in FortiWebTestConsole/Program.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 42 in FortiWebTestConsole/Program.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{


Expand All @@ -57,7 +57,7 @@
UserName = arguments["-user"];
Password = arguments["-password"];
StorePath = arguments["-storepath"];
ApiKey = arguments["-apikey"];
ADom = arguments["-adom"];
ClientMachine = arguments["-clientmachine"];
}
else
Expand All @@ -71,7 +71,7 @@
Console.WriteLine("Enter Store Path");
StorePath = Console.ReadLine();
Console.WriteLine("Enter ApiKey");
ApiKey = Console.ReadLine();
ADom = Console.ReadLine();
Console.WriteLine("Enter ClientMachine");
ClientMachine = Console.ReadLine();
}
Expand Down Expand Up @@ -156,7 +156,7 @@
public static InventoryJobConfiguration GetInventoryJobConfiguration()
{
var fileContent = File.ReadAllText("FortiWebInventory.json").Replace("UserNameGoesHere", UserName)
.Replace("PasswordGoesHere", Password).Replace("ClientMachineGoesHere", ClientMachine).Replace("ApiKeyGoesHere", ApiKey);
.Replace("PasswordGoesHere", Password).Replace("ClientMachineGoesHere", ClientMachine).Replace("ADomGoesHere", ADom);
var result =
JsonConvert.DeserializeObject<InventoryJobConfiguration>(fileContent);
return result;
Expand All @@ -174,7 +174,7 @@

var fileContent = File.ReadAllText("FortiWebMgmt.json").Replace("UserNameGoesHere", UserName)
.Replace("PasswordGoesHere", Password).Replace("TemplateNameGoesHere", StorePath)
.Replace("ApiKeyGoesHere", ApiKey).Replace("AliasGoesHere", CertAlias)
.Replace("ADomGoesHere", ADom).Replace("AliasGoesHere", CertAlias)
.Replace("ClientMachineGoesHere", ClientMachine)
.Replace("\"Overwrite\": false",overWriteReplaceString)
.Replace("CertificateContentGoesHere", CertificateContent);
Expand Down
16 changes: 8 additions & 8 deletions FortiWebTestConsole/RunTest.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cd C:\Users\bhill\source\repos\fortinet-fortiweb-orchestrator\FortiWebTestConsol
set FortiWebMachine=11.22.38.208:8443
set FortiWebUser=dasklfa
set FortiWebPassword=asdfsa
set FortiWebApiKey=eyJ
set ADom=eyJ

set clientmachine=%FortiWebMachine%
set password=%FortiWebPassword%
Expand All @@ -28,7 +28,7 @@ echo ***************************************************************************
echo overwrite: %overwrite%
echo cert name: %cert%

FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -apikey=%FortiWebApiKey% -managementtype=%mgt% -certalias=%cert% -overwrite=%overwrite%
FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -adom=%ADom% -managementtype=%mgt% -certalias=%cert% -overwrite=%overwrite%


set overwrite=true
Expand All @@ -41,7 +41,7 @@ echo overwrite: %overwrite%
echo trusted: %trusted%
echo cert name: %cert%

FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -apikey=%FortiWebApiKey% -managementtype=%mgt% -certalias=%cert% -overwrite=%overwrite%
FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -adom=%ADom% -managementtype=%mgt% -certalias=%cert% -overwrite=%overwrite%

:TC3
set mgt=add
Expand All @@ -55,7 +55,7 @@ echo overwrite: %overwrite%
set /p cert=Please enter multi policy bound cert name:
echo cert name: %cert%

FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -apikey=%FortiWebApiKey% -managementtype=%mgt% -certalias=%cert% -overwrite=%overwrite%
FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -adom=%ADom% -managementtype=%mgt% -certalias=%cert% -overwrite=%overwrite%

:TC4
set mgt=add
Expand All @@ -69,7 +69,7 @@ echo overwrite: %overwrite%
set /p cert=Please enter single policy bound cert name:
echo cert name: %cert%

FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -apikey=%FortiWebApiKey% -managementtype=%mgt% -certalias=%cert% -overwrite=%overwrite%
FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -adom=%ADom% -managementtype=%mgt% -certalias=%cert% -overwrite=%overwrite%


:TC5
Expand All @@ -84,7 +84,7 @@ echo overwrite: %overwrite%
set /p cert=Please enter single policy bound cert name:
echo cert name: %cert%

FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -apikey=%FortiWebApiKey% -managementtype=%mgt% -certalias=%cert% -overwrite=%overwrite%
FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -adom=%ADom% -managementtype=%mgt% -certalias=%cert% -overwrite=%overwrite%

:TC6
echo:
Expand All @@ -102,7 +102,7 @@ echo ***************************************************************************
echo overwrite: %overwrite%
echo cert name: %cert%

FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -apikey=%FortiWebApiKey% -managementtype=%mgt% -inventorytrusted=%inventorytrusted% -templatestackname=%templatestackname%
FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -adom=%ADom% -managementtype=%mgt% -inventorytrusted=%inventorytrusted% -templatestackname=%templatestackname%

:TC7
echo:
Expand All @@ -121,6 +121,6 @@ echo ***************************************************************************
echo overwrite: %overwrite%
echo cert name: %cert%

FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -apikey=%FortiWebApiKey% -managementtype=%mgt% -inventorytrusted=%inventorytrusted% -templatestackname=%templatestackname%
FortiWebTestConsole.exe -clientmachine=%clientmachine% -casename=%casename% -user=%user% -password=%password% -storepath=%storepath% -adom=%ADom% -managementtype=%mgt% -inventorytrusted=%inventorytrusted% -templatestackname=%templatestackname%

@pause
Loading
Loading