From 7baad8ba974ff4022a888b93c75c9f114a83cecf Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Tue, 7 Jan 2025 18:35:28 +0100 Subject: [PATCH] policy: Add srcintf for Add-FGTFirewallPolicyMember --- PowerFGT/Public/cmdb/firewall/policy.ps1 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/PowerFGT/Public/cmdb/firewall/policy.ps1 b/PowerFGT/Public/cmdb/firewall/policy.ps1 index 2e155e287..e2c7f21af 100644 --- a/PowerFGT/Public/cmdb/firewall/policy.ps1 +++ b/PowerFGT/Public/cmdb/firewall/policy.ps1 @@ -350,6 +350,8 @@ function Add-FGTFirewallPolicyMember { [Parameter(Mandatory = $false)] [string[]]$srcaddr, [Parameter(Mandatory = $false)] + [string[]]$srcintf, + [Parameter(Mandatory = $false)] [string[]]$dstaddr, [Parameter(Mandatory = $false)] [String[]]$vdom, @@ -390,6 +392,25 @@ function Add-FGTFirewallPolicyMember { $_policy | add-member -name "srcaddr" -membertype NoteProperty -Value $members } + if ( $PsBoundParameters.ContainsKey('srcintf') ) { + + if ($policy.srcintf.name -eq "all") { + #all => create new empty array members + $members = @() + } + else { + #Add member to existing source interface + $members = $policy.srcintf + } + + foreach ( $member in $srcintf ) { + $member_name = @{ } + $member_name.add( 'name', $member) + $members += $member_name + } + $_policy | add-member -name "srcintf" -membertype NoteProperty -Value $members + } + if ( $PsBoundParameters.ContainsKey('dstaddr') ) { if ($policy.dstaddr.name -eq "all") {