Placing a domain-joined Windows system behind a firewall can be challenging. I put my Web Application Proxy (WAP) servers in a DMZ with defined inbound and outbound ACLs.
The challenge was to restrict the domain controllers' RPC traffic to specific ports, so I only needed to allow a subset of TCP/UDP ports.
The following script needs to run on each domain controller that the DMZ servers can reach. I ran it on Windows Server 2012 R2.
Set TCP ports 55000–55303 for NTDS, Netlogon, NtFrs and RPC
PowerShell14 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#Set NTDS RPC port to static settingNew-ItemProperty"HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters"-Name"TCP/IP Port"-Value55000-PropertyType"DWord"#Set Netlogon RPC port to static settingNew-ItemProperty"HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters"-Name"DCTcpipPort Port"-Value55001-PropertyType"DWord"#Set NtFrs RPC port to static settingNew-ItemProperty"HKLM:\SYSTEM\CurrentControlSet\Services\NtFrs\Parameters"-Name"RPC TCP/IP Port Assignment"-Value55002-PropertyType"DWord"#Set RPC dynamic ports to static range settingNew-Item"HKLM:\Software\Microsoft\RPC\Internet"New-ItemProperty"HKLM:\Software\Microsoft\RPC\Internet"-Name"Ports"-Value'55003-55303'-PropertyTypeMultiString-ForceNew-ItemProperty"HKLM:\SOFTWARE\Microsoft\Rpc\Internet"-Name"PortsInternetAvailable"-ValueY-PropertyType"String"New-ItemProperty"HKLM:\SOFTWARE\Microsoft\Rpc\Internet"-Name"UseInternetPorts"-ValueY-PropertyType"String"
After rebooting the domain controllers, I ran gpupdate on my DMZ server to check that AD services were reachable. I then rebooted again and tested a domain logon to check for blocked ports.
Line (5) of the powershell script contains an error:
"DCTcpipPort Port"should read "DCTcpipPort"Took me forever to figure out that was wrong....