Skip to content

Commit

Permalink
Firewall: Add FQDN information
Browse files Browse the repository at this point in the history
  • Loading branch information
alagoutte committed Jul 25, 2024
1 parent a84d48d commit e4bc94a
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Src/Private/Get-AbrFgtFirewall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function Get-AbrFgtFirewall {
$IPPool = Get-FGTFirewallIPPool -meta
$VIP = Get-FGTFirewallVip -meta
$Policy = Get-FGTFirewallPolicy -meta
$fqdn = (invoke-FGTRestMethod -uri "api/v2/monitor/firewall/address-fqdns").results.psobject.properties.value

if ($InfoLevel.Firewall -ge 1) {
Section -Style Heading3 'Summary' {
Expand Down Expand Up @@ -78,12 +79,20 @@ function Get-AbrFgtFirewall {
$policy_text += " (Disabled: $policy_disable)"
}

$fqdn_count = @($fqdn).count
$fqdn_text = "$fqdn_count"
if ($fqdn_count) {
$fqdn_unresolved = ($fqdn | Where-Object { $_.addrs.count -eq 0 }).count
$fqdn_text += " (Unresolved: $fqdn_unresolved)"
}

$OutObj = [pscustomobject]@{
"Address" = $address_text
"Group" = $group_text
"IP Pool" = $ippool_text
"Virtual IP" = $vip_text
"Policy" = $policy_text
"FQDN" = $fqdn_text
}

$TableParams = @{
Expand Down Expand Up @@ -240,6 +249,39 @@ function Get-AbrFgtFirewall {
}
}

if ($fqdn -and $InfoLevel.Firewall -ge 1) {
Section -Style Heading3 'FQDN' {
$OutObj = @()

foreach ($f in $fqdn) {

if ($f.addrs.count -eq 0) {
$addr = "Unresolved"
}
else {
$addr = $f.addrs -join ", "
}
$OutObj += [pscustomobject]@{
"Name" = $f.fqdn
"Addresses" = $addr
"wildcard" = $f.wildcard
}
}

$TableParams = @{
Name = "FQDN"
List = $false
ColumnWidths = 10, 80, 10
}

if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}

$OutObj | Table @TableParams
}
}

if ($Policy -and $InfoLevel.Firewall -ge 1) {
Section -Style Heading3 'Policy Summary' {
Paragraph "The following section provides a policy summary of firewall settings."
Expand Down

0 comments on commit e4bc94a

Please sign in to comment.