From 6a13f77f2ac6c1dcde69e4e2d6459797baa1b37b Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Tue, 27 Aug 2024 21:28:44 +0200 Subject: [PATCH 1/4] session(firewall/monitor): Fix when use FortiOS 7.6.0 We need to use sessions and not session for uri (already available with fortiOS 7.4.x...) --- PowerFGT/Public/monitor/firewall/session.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PowerFGT/Public/monitor/firewall/session.ps1 b/PowerFGT/Public/monitor/firewall/session.ps1 index 4d10bcbba..e9eadcaf2 100644 --- a/PowerFGT/Public/monitor/firewall/session.ps1 +++ b/PowerFGT/Public/monitor/firewall/session.ps1 @@ -67,7 +67,13 @@ function Get-FGTMonitorFirewallSession { $count = 1000 } - $uri = "api/v2/monitor/firewall/session?count=${count}" + #before 7.6.x, it is session (and not sessions) (already available with 7.4.x) but session drop with 7.6.) + if ($connection.version -lt "7.6.0") { + $uri = "api/v2/monitor/firewall/session?count=${count}" + } + else { + $uri = "api/v2/monitor/firewall/sessions?count=${count}" + } if ( $PsBoundParameters.ContainsKey('summary') ) { $uri += "&summary=$true" From 5c089662c8274c11dc48a02892a55722fc36125c Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 28 Aug 2024 08:24:37 +0200 Subject: [PATCH 2/4] Backup(monitor/system/config): now need to use method POST with body payload --- .../Public/monitor/system/config/backup.ps1 | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/PowerFGT/Public/monitor/system/config/backup.ps1 b/PowerFGT/Public/monitor/system/config/backup.ps1 index 5e2566f15..2fc942982 100644 --- a/PowerFGT/Public/monitor/system/config/backup.ps1 +++ b/PowerFGT/Public/monitor/system/config/backup.ps1 @@ -50,8 +50,21 @@ function Get-FGTMonitorSystemConfigBackup { $invokeParams.add( 'vdom', $vdom ) } - $uri = 'api/v2/monitor/system/config/backup?scope=global' - $response = Invoke-FGTRestMethod -uri $uri -method 'GET' -connection $connection @invokeParams + #before 7.6.x, config/backup is available with get method and using paramater + if ($connection.version -lt "7.6.0") { + $method = "get" + $uri = 'api/v2/monitor/system/config/backup?scope=global' + $body = @{ } + } + else { + $method = "post" + $uri = 'api/v2/monitor/system/config/backup' + $body = @{ + "scope" = "global" + } + } + + $response = Invoke-FGTRestMethod -uri $uri -method $method -body $body -connection $connection @invokeParams $response } From e35acbd01421b305d7e2d62bdb22d0a398088272 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 28 Aug 2024 08:28:38 +0200 Subject: [PATCH 3/4] SystemSettings(Tests): Fix gui-proxy-inpsection with FortiOS 7.6.0 the option/parameter is not longer available... --- Tests/integration/SystemSettings.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/integration/SystemSettings.Tests.ps1 b/Tests/integration/SystemSettings.Tests.ps1 index 64ddf7480..dff3ecb9c 100644 --- a/Tests/integration/SystemSettings.Tests.ps1 +++ b/Tests/integration/SystemSettings.Tests.ps1 @@ -53,8 +53,8 @@ Describe "Set System Settings" { $script:settings = Get-FGTSystemSettings } - #Coming with FortiOS 7.2.x and need for some feature (like waf, ztna.. ) - It "Change gui-proxy-inspection to enable" -skip:($fgt_version -lt "7.2.0") { + #Coming with FortiOS 7.2.x and need for some feature (like waf, ztna.. ) and remove with 7.6.0... + It "Change gui-proxy-inspection to enable" -skip:($fgt_version -lt "7.2.0" -or $fgt_version -ge "7.6.0") { Set-FGTSystemSettings -gui_proxy_inspection $ss = Get-FGTSystemSettings $ss.'gui-proxy-inspection' | Should -Be "enable" @@ -351,7 +351,7 @@ Describe "Set System Settings" { $ss.'lldp-reception' | Should -Be "global" } - It "Change gui-proxy-inspection to disable" -skip:($fgt_version -lt "7.2.0") { + It "Change gui-proxy-inspection to disable" -skip:($fgt_version -lt "7.2.0" -or $fgt_version -ge "7.6.0") { Set-FGTSystemSettings -gui_proxy_inspection:$false $ss = Get-FGTSystemSettings $ss.'gui-proxy-inspection' | Should -Be "disable" From 04705e7d8c7bfb964a9c4677ee7ebb2a838c0888 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 28 Aug 2024 12:03:13 +0200 Subject: [PATCH 4/4] backup(system/config/backup): body need to be null when use PS5 --- PowerFGT/Public/monitor/system/config/backup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PowerFGT/Public/monitor/system/config/backup.ps1 b/PowerFGT/Public/monitor/system/config/backup.ps1 index 2fc942982..2ae22cd17 100644 --- a/PowerFGT/Public/monitor/system/config/backup.ps1 +++ b/PowerFGT/Public/monitor/system/config/backup.ps1 @@ -54,7 +54,7 @@ function Get-FGTMonitorSystemConfigBackup { if ($connection.version -lt "7.6.0") { $method = "get" $uri = 'api/v2/monitor/system/config/backup?scope=global' - $body = @{ } + $body = "" } else { $method = "post"