Post

Create Windows Firewall Rule with Powershell for Fortigate FSSO Collector Agent

Aşağıdaki Script ile ilgili kurallar oluşturulabilir.

Script’i daha rahat kopyala yapıştır yapabilmek adına Powershell ISE kullanabilirsiniz

Aynı Zamanda Powershell Prompt/Powershell ISE Yönetici olarak çalıştırmayı unutmayınız.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Inbound Port
$inboundPorts = @(
    "8002 - UDP - Fortigate DC Agent keepalive and push logon info to Collector Agent",
    "8001 - TCP - Fortigate FortiGate to FSSO Collector Agent connection (SSL)",
    "8000 - TCP - Fortigate FortiGate to FSSO Collector Agent connection",
    "8000 - TCP - Fortigate NTLM"
)

# Outbound Port
$outboundPorts = @(
    "135 - TCP - Fortigate Workstation check, polling mode (fallback method)",
    "139 - TCP - Fortigate Required Port",
    "137 - UDP - Fortigate Required Port",
    "445 - TCP - Fortigate Remote access to logon events, Workstation check (remote registry)",
    "389 - TCP - Fortigate Group lookup using LDAP",
    "636 - TCP - Fortigate Group lookup using LDAPS",
    "3268 - TCP - Fortigate Group lookup using LDAP with global catalog",
    "3269 - TCP - Fortigate Group lookup using LDAPS with global catalog",
    "53 - UDP - Fortigate DNS for resolving hostnames of the logon events"
)

# Open Inbound Ports
Write-Host "Opened Inbound Ports:"
foreach ($portDesc in $inboundPorts) {
    $portInfo = $portDesc -split " - "
    $port = $portInfo[0]
    $protocol = $portInfo[1]
    $description = $portInfo[2]
    Write-Host "Opening: $port $protocol - $description"

    New-NetFirewallRule -DisplayName "$description (Inbound)" -Direction Inbound -LocalPort $port -Protocol $protocol -Action Allow -Enabled True
}

# Open Outbound Ports
Write-Host "Opened Outbound Ports:"
foreach ($portDesc in $outboundPorts) {
    $portInfo = $portDesc -split " - "
    $port = $portInfo[0]
    $protocol = $portInfo[1]
    $description = $portInfo[2]
    Write-Host "Opening: $port $protocol - $description"

    New-NetFirewallRule -DisplayName "$description (Outbound)" -Direction Outbound -LocalPort $port -Protocol $protocol -Action Allow -Enabled True
    
}

This post is licensed under CC BY 4.0 by the author.