Intune: Windows Firewall Public - Block Local IPsec Policy Merge

πŸ’Ό Management Samenvatting

Block local IPsec policy merge on Public profile - prevents local admins from weakening firewall (centralized control ONLY).

Aanbeveling
IMPLEMENT
Risico zonder
Medium
Risk Score
6/10
Implementatie
2u (tech: 1u)
Van toepassing op:
βœ“ Windows 10
βœ“ Windows 11

Policy merge = local override risk: IPsec policies: VPN, connection security rules (encryption, authentication), Local merge: Local admin can add IPsec rules β†’ bypasses centralized GPO/Intune policy, Attack: Compromised admin account β†’ adds IPsec rule β†’ weakens security (allows traffic), malware with admin rights β†’ modifies firewall. Public profile: STRICTEST control (public WiFi = untrusted), Block merge: ONLY centralized policies apply (no local overrides). Defense: Centralized enforcement (Intune/GPO ONLY).

PowerShell Modules Vereist
Primary API: Microsoft Graph API
Connection: Connect-MgGraph
Required Modules: Microsoft.Graph.DeviceManagement

Implementatie

Block IPsec merge: Policy: Allow local IPsec policy merge: False, Effect: Local IPsec policies IGNORED (centralized policies ONLY), Centralized control: Intune firewall rules = only source of truth, Public WiFi: Maximum security (no local weakening).

Vereisten

  1. Intune subscription
  2. Windows 10/11
  3. Centralized firewall management (Intune)

Implementatie

Intune Settings Catalog: Windows Firewall β†’ Public Profile β†’ Allow local IPsec policy merge: False (block local overrides).

Compliance

CIS Windows Benchmark L1, BIO 13.01, ISO 27001 A.13.1.1.

Monitoring

Gebruik PowerShell-script enable-public-network-firewall-allow-local-ipsec-policy-merge-is-set-to-false.ps1 (functie Invoke-Monitoring) – Controleren.

Remediatie

Gebruik PowerShell-script enable-public-network-firewall-allow-local-ipsec-policy-merge-is-set-to-false.ps1 (functie Invoke-Remediation) – Herstellen.

Compliance & Frameworks

Automation

Gebruik het onderstaande PowerShell script om deze security control te monitoren en te implementeren. Het script bevat functies voor zowel monitoring (-Monitoring) als remediation (-Remediation).

PowerShell
<# .SYNOPSIS Intune Windows Firewall: Public Block Local IPsec Policy Merge .DESCRIPTION CIS - Public profile moet local IPsec policy merge BLOKKEREN. .NOTES Filename: firewall-public-ipsec-merge.ps1|Author: Nederlandse Baseline voor Veilige Cloud|NetSH: Public AllowLocalIPsecPolicyMerge|Expected: False #> #Requires -Version 5.1 #Requires -RunAsAdministrator [CmdletBinding()]param([switch]$WhatIf, [switch]$Monitoring, [switch]$Remediation, [switch]$Revert) $ErrorActionPreference = 'Stop'; $Profile = "Public"; $ExpectedValue = $false function Connect-RequiredServices { $p = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()); return $p.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) } function Test-Compliance { $r = [PSCustomObject]@{ScriptName = "firewall-public-ipsec.ps1"; PolicyName = "Firewall Public IPsec Merge"; IsCompliant = $false; CurrentValue = $null; ExpectedValue = "False"; Details = @() }; function Invoke-Revert { Set-NetFirewallProfile -Name $Profile -AllowLocalIPsecPolicyMerge True } try { $fw = Get-NetFirewallProfile -Name $Profile -ErrorAction SilentlyContinue; if ($fw) { $r.CurrentValue = $fw.AllowLocalIPsecPolicyMerge; if ($fw.AllowLocalIPsecPolicyMerge -eq $ExpectedValue) { $r.IsCompliant = $true; $r.Details += "IPsec merge blocked" }else { $r.Details += "IPsec merge: $($fw.AllowLocalIPsecPolicyMerge)" } }else { $r.Details += "Profile niet gevonden" } }catch { $r.Details += "Error: $($_.Exception.Message)" }; return $r } function Invoke-Remediation { Set-NetFirewallProfile -Name $Profile -AllowLocalIPsecPolicyMerge False; Write-Host "Public IPsec merge blocked" -ForegroundColor Green } function Invoke-Monitoring { $r = Test-Compliance; Write-Host "`n$($r.PolicyName): $(if($r.IsCompliant){'COMPLIANT'}else{'NON-COMPLIANT'})" -ForegroundColor $(if ($r.IsCompliant) { 'Green' }else { 'Red' }); return $r } function Invoke-Revert { Set-NetFirewallProfile -Name $Profile -AllowLocalIPsecPolicyMerge True } try { if (-not(Connect-RequiredServices)) { exit 1 }; if ($Monitoring) { $r = Invoke-Monitoring; exit $(if ($r.IsCompliant) { 0 }else { 1 }) }elseif ($Remediation) { if (-not $WhatIf) { Invoke-Remediation } }elseif ($Revert) { Invoke-Revert }else { $r = Test-Compliance; exit $(if ($r.IsCompliant) { 0 }else { 1 }) } }catch { Write-Error $_; exit 1 }

Risico zonder implementatie

Risico zonder implementatie
Medium: Medium: Local IPsec merge = admins can weaken public firewall (bypass controls).

Management Samenvatting

Block local IPsec policy merge (Public profile). Centralized control only. No local overrides. Implementatie: 1-2 uur.