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

Tests: Add FortiOS 7.6 (Beta) #248

Merged
merged 3 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions PowerFGT/Public/Connection.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ function Connect-FGT {
$url = "https://${Server}:${port}/"
}

$headers = @{}
$headers = @{ "content-type" = "application/json" }
if ($ApiToken) {
$headers = @{ "Authorization" = "Bearer $ApiToken" }
$headers += @{ "Authorization" = "Bearer $ApiToken" }
}
else {
#If there is a password (and a user), create a credentials
Expand Down Expand Up @@ -261,7 +261,7 @@ function Connect-FGT {
#Remove extra "quote"
$cookie_csrf = $cookie_csrf -replace '["]', ''
#Add csrf cookie to header (X-CSRFTOKEN)
$headers = @{"X-CSRFTOKEN" = $cookie_csrf }
$headers += @{"X-CSRFTOKEN" = $cookie_csrf }

$uri = $url + "logindisclaimer"
if ($iwrResponse.Content -match '/logindisclaimer') {
Expand Down
2 changes: 1 addition & 1 deletion Tests/integration/FirewallProxyAddress.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Describe "Get Firewall Proxy Address" {
$address.q_static | Should -Not -BeNullOrEmpty
$address.q_no_rename | Should -Not -BeNullOrEmpty
$address.q_global_entry | Should -Not -BeNullOrEmpty
$address.q_type | Should -BeIn @('422', '459', '468', '484', '487', '497', '510')
$address.q_type | Should -BeIn @('422', '459', '468', '484', '487', '497', '510', '514')
$address.q_path | Should -Be "firewall"
$address.q_name | Should -Be "proxy-address"
$address.q_mkey_type | Should -Be "string"
Expand Down
2 changes: 1 addition & 1 deletion Tests/integration/FirewallProxyAddressGroup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Describe "Get Firewall Proxy Address Group" {
$addressgroup.q_static | Should -Not -BeNullOrEmpty
$addressgroup.q_no_rename | Should -Not -BeNullOrEmpty
$addressgroup.q_global_entry | Should -Not -BeNullOrEmpty
$addressgroup.q_type | Should -BeIn @('423', '460', '469', '485', '488', '498', '511')
$addressgroup.q_type | Should -BeIn @('423', '460', '469', '485', '488', '498', '511', '515')
$addressgroup.q_path | Should -Be "firewall"
$addressgroup.q_name | Should -Be "proxy-addrgrp"
$addressgroup.q_mkey_type | Should -Be "string"
Expand Down
2 changes: 1 addition & 1 deletion Tests/integration/FirewallProxyPolicy.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Describe "Get Firewall Proxy Policy" {
$policy.q_static | Should -Not -BeNullOrEmpty
$policy.q_no_rename | Should -Not -BeNullOrEmpty
$policy.q_global_entry | Should -Not -BeNullOrEmpty
$policy.q_type | Should -BeIn @('413', '450', '459', '475', '478', '487', '498')
$policy.q_type | Should -BeIn @('413', '450', '459', '475', '478', '487', '498', '502')
$policy.q_path | Should -Be "firewall"
$policy.q_name | Should -Be "proxy-policy"
$policy.q_mkey_type | Should -Be "integer"
Expand Down
16 changes: 13 additions & 3 deletions Tests/integration/VpnIPsecPhase1Interface.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ Describe "Add VPN Ipsec Phase 1 Interface" -ForEach $type {

It "Add VPN Ipsec Phase 1 Interface with auto-discovery-sender enabled" {
$p = $_.param
Add-FGTVpnIpsecPhase1Interface -name $pester_vpn1 -interface $pester_port1 -psksecret MySecret @p -autodiscoverysender
#FortiOS 7.6 need to force transport to udp for support auto discovery with IKEv2 Dynamic
$data = @{ "transport" = "udp" }
Add-FGTVpnIpsecPhase1Interface -name $pester_vpn1 -interface $pester_port1 -psksecret MySecret @p -autodiscoverysender -data $data
$vpn = Get-FGTVpnIpsecPhase1Interface -name $pester_vpn1
$vpn.name | Should -Be $pester_vpn1
$vpn.'ike-version' | Should -Be $_.param.ikeversion
Expand All @@ -296,7 +298,9 @@ Describe "Add VPN Ipsec Phase 1 Interface" -ForEach $type {

It "Add VPN Ipsec Phase 1 Interface with auto-discovery-receiver enabled" {
$p = $_.param
Add-FGTVpnIpsecPhase1Interface -name $pester_vpn1 -interface $pester_port1 -psksecret MySecret @p -autodiscoveryreceiver
#FortiOS 7.6 need to force transport to udp for support auto discovery with IKEv2 Dynamic
$data = @{ "transport" = "udp" }
Add-FGTVpnIpsecPhase1Interface -name $pester_vpn1 -interface $pester_port1 -psksecret MySecret @p -autodiscoveryreceiver -data $data
$vpn = Get-FGTVpnIpsecPhase1Interface -name $pester_vpn1
$vpn.name | Should -Be $pester_vpn1
$vpn.'ike-version' | Should -Be $_.param.ikeversion
Expand Down Expand Up @@ -725,7 +729,13 @@ Describe "Configure VPN Ipsec Phase 1 Interface" -ForEach $type {
}

It "Set VPN Ipsec Phase 1 Interface with auto-discovery-sender enabled" {
Get-FGTVpnIpsecPhase1Interface -name $pester_vpn1 | Set-FGTVpnIpsecPhase1Interface -autodiscoverysender
if ($_.param.type -eq "dynamic" -and $_.param.ikeversion -eq "2") {
#FortiOS 7.6 need to force transport to udp for support auto discovery with IKEv2 Dynamic
$data = @{ "transport" = "udp" }
} else {
$data = @{ }
}
Get-FGTVpnIpsecPhase1Interface -name $pester_vpn1 | Set-FGTVpnIpsecPhase1Interface -autodiscoverysender -data $data
$vpn = Get-FGTVpnIpsecPhase1Interface -name $pester_vpn1
$vpn.name | Should -Be $pester_vpn1
$vpn.'ike-version' | Should -Be $_.param.ikeversion
Expand Down