P01-T09 - AD Firewall Hardening
Objective
Replace the transitional lab DC-access allowances from P01-T07 with a more professional and future-proof CHR policy for Active Directory traffic, while preserving successful domain join, logon, DNS, DHCP relay, and SMB access.
Why this runbook exists
The P01-T07 rules intentionally open the minimum workstation-to-DC ports needed to bring the lab online quickly. That is acceptable for bring-up, but it remains a transitional profile tied to one workstation VLAN and one recovery sequence.
This runbook moves the design toward:
- explicit allowed source networks
- explicit denied source networks
- explicit DC and file server role targets
- preparation for future multinational site growth
Inputs
| Key | Value |
|---|---|
| Domain controller list | HQ-DOMAIN-CONTROLLERS |
| File server list | HQ-FILE-SERVERS |
| Managed workstation subnet | 172.20.30.0/24 |
| Managed hypervisor subnet | 172.20.100.0/24 |
| Guest subnet | 172.20.70.0/24 |
| DMZ subnet | 172.20.80.0/24 |
Design stance
For this guide, the enterprise-ready posture is:
- allow managed subnets to reach DCs
- deny guest and DMZ to DCs explicitly
- keep DC access broad enough to tolerate AD dependencies in a routed environment
- tighten by source subnet first, not by pretending AD is easy to reduce to a tiny fixed-port list
This is deliberate. Active Directory uses RPC and other service patterns that make naive per-port hardening brittle. The first professional step is source-network restriction, not overconfident port minimization.
Target State
| Property | Value |
|---|---|
| Managed-to-DC policy | Explicitly allowed |
| Guest-to-DC policy | Explicitly denied |
| DMZ-to-DC policy | Explicitly denied |
| SMB policy | Still explicit to file servers |
| Default posture | Final drop remains in effect |
Prechecks
- Complete
P03-T01. - Confirm
HQ-DC01is operational and validated. - Confirm
P01-T07rules are currently in place and working. - Confirm the
DHCP relayand its relatedinputrules are already functional if Windows DHCP is serving another VLAN. - Confirm no duplicate transitional SMB rules exist from emergency recovery work:
If duplicate FWD - Workstations to HQ-FS01 SMB TCP or FWD - Workstations to HQ-FS01 SMB UDP rules exist, remove the duplicate copies before hardening. Do not leave duplicate accept rules in the final CHR policy because they make counter-based validation ambiguous.
- Export the current filter table before changing rule ordering:
Execution
- Create source-network address lists:
/ip firewall address-list
add list=AD-MANAGED-WORKSTATIONS address=172.20.30.0/24 comment="VLAN30 managed workstations"
add list=AD-MANAGED-HYPERVISORS address=172.20.100.0/24 comment="VLAN100 hypervisors"
add list=AD-BLOCKED-GUEST address=172.20.70.0/24 comment="VLAN70 guest"
add list=AD-BLOCKED-DMZ address=172.20.80.0/24 comment="VLAN80 dmz"
- Add explicit deny rules for domain controller access from untrusted subnets before the generic final drop:
/ip firewall filter
add chain=forward action=drop src-address-list=AD-BLOCKED-GUEST dst-address-list=HQ-DOMAIN-CONTROLLERS comment="FWD - Guest to DC Drop"
add chain=forward action=drop src-address-list=AD-BLOCKED-DMZ dst-address-list=HQ-DOMAIN-CONTROLLERS comment="FWD - DMZ to DC Drop"
- Add the managed-subnet rules that supersede the transitional workstation-to-DC rules from
P01-T07:
/ip firewall filter
add chain=forward action=accept src-address-list=AD-MANAGED-WORKSTATIONS dst-address-list=HQ-DOMAIN-CONTROLLERS comment="FWD - Managed Workstations to DC"
add chain=forward action=accept src-address-list=AD-MANAGED-HYPERVISORS dst-address-list=HQ-DOMAIN-CONTROLLERS comment="FWD - Hypervisors to DC"
- Keep or remove the older transitional port-specific rules from
P01-T07only after confirming the new rules are aboveFWD - Default Dropand traffic counters increment correctly.
Do not remove the INPUT - DHCP Relay Client Requests or INPUT - DHCP Relay Server Replies rules during this step. They are part of the router-facing relay path, not the forward-path transition.
- Preserve explicit SMB allowances to file servers:
/ip firewall filter
:foreach RuleComment in={
"FWD - Managed Workstations to SMB TCP";
"FWD - Managed Workstations to SMB UDP"
} do={
:local Seen false
:foreach RuleId in=[find where chain=forward comment=$RuleComment] do={
:if ($Seen = false) do={
:set Seen true
} else={
remove $RuleId
}
}
}
:if ([:len [find where chain=forward comment="FWD - Managed Workstations to SMB TCP"]] = 0) do={
add chain=forward action=accept src-address-list=AD-MANAGED-WORKSTATIONS dst-address-list=HQ-FILE-SERVERS protocol=tcp dst-port=445,139 comment="FWD - Managed Workstations to SMB TCP"
}
:if ([:len [find where chain=forward comment="FWD - Managed Workstations to SMB UDP"]] = 0) do={
add chain=forward action=accept src-address-list=AD-MANAGED-WORKSTATIONS dst-address-list=HQ-FILE-SERVERS protocol=udp dst-port=137,138 comment="FWD - Managed Workstations to SMB UDP"
}
-
Reorder rules so the effective sequence is:
-
established/related
- invalid drop
- LAN to internet
- backup to servers
- explicit guest/dmz to DC drops
- explicit managed-subnet to DC allows
- explicit SMB allows
- guest isolation
- DMZ isolation
- final drop
Use an anchor-based reorder that always moves each rule immediately before FWD - Default Drop. Do not use absolute rule numbers. That approach is what was validated successfully on HQ-CHR01.
{
:local DesiredOrder {
"FWD - Guest to DC Drop";
"FWD - DMZ to DC Drop";
"FWD - Managed Workstations to DC";
"FWD - Hypervisors to DC";
"FWD - Managed Workstations to SMB TCP";
"FWD - Managed Workstations to SMB UDP";
"FWD - Guest Isolation";
"FWD - DMZ Isolation"
}
:foreach RuleComment in=$DesiredOrder do={
:foreach RuleId in=[/ip firewall filter find where comment=$RuleComment] do={
:local DefaultDrop [/ip firewall filter find where comment="FWD - Default Drop"]
/ip firewall filter move $RuleId $DefaultDrop
}
}
}
The validated forward chain on HQ-CHR01 after this operation was:
FWD - EstablishedFWD - InvalidFWD - LAN to InternetFWD - BackupFWD - Guest to DC DropFWD - DMZ to DC DropFWD - Managed Workstations to DCFWD - Hypervisors to DCFWD - Managed Workstations to SMB TCPFWD - Managed Workstations to SMB UDPFWD - Guest IsolationFWD - DMZ IsolationFWD - Default Drop
After this sequence is validated, remove the transitional P01-T07 workstation-to-DC rules with these comments if they still exist:
FWD - Workstations to DC DNS UDPFWD - Workstations to DC DNS TCPFWD - Workstations to DC Kerberos TCPFWD - Workstations to DC Core UDPFWD - Workstations to DC Core TCPFWD - Workstations to DC RPC Dynamic
Do not remove the SMB rules unless they are being replaced by their managed-subnet equivalents in the same maintenance window.
Validation
HQ-CL01andHQ-CL02still log on to the domain.- DNS queries against
HQ-DC01still succeed from managed workstation subnets. - Workstations still obtain DHCP leases through the configured relay path.
- Group Policy still applies.
- SMB access to
HQ-FS01still succeeds. - Guest cannot reach the DC.
- DMZ cannot reach the DC.
- Filter counters increase on the new allow and deny rules.
- Rule order matches the intended sequence exactly.
- The rule-ordering script completes without
invalid value for argument numbersorcan not move object before itself.
Evidence
- Output of
/ip firewall filter print stats - Output of
/ip firewall address-list print - Successful domain logon from
HQ-CL01 - Failed reachability test from a guest validation host to
HQ-DC01
Rollback
- Re-enable the older
P01-T07transitional workstation-to-DC rules temporarily if the new hardened rules break core AD functionality unexpectedly. - Do not remove the base firewall or NAT rules during rollback.