Commissioning SCADA Firewall Rules: Test the Application, Not the Port
Testing the deny-by-default IEC 62443-3-3 SR 5.2 RE 1 actually asks for: registered port numbers, the 49152-65535 DCOM range, and a measurement where nc says open while Modbus times out after 5 s.
The screen worked all through FAT. On the production network the operator logs in, the graphic opens, and half the tags go stale after ninety seconds. Nobody touched the SCADA config. What changed is that the historian query now crosses a firewall the FAT bench didn't have, and the return path for that one collector port was never in the rule set.
That is the shape of most firewall problems at commissioning. Not "the firewall is blocking everything" — it's one missing supporting path behind an application that mostly works. So the rule set is worth treating like part of the control system, not a generic network chore. Each rule maps a conversation: who talks to whom, on which port, and why the process needs it. IEC 62443 calls these zones and conduits. The partitioning itself belongs to the ZCR (zone and conduit requirements) in 62443-3-2; what the rules have to satisfy is two lines under FR 5, Restricted Data Flow, in 62443-3-3. SR 5.1 network segmentation, and SR 5.2 zone boundary protection — whose RE 1 spells out deny all, permit by exception. So an any-any permit still in place at turnover is not loose practice, it is a straight SR 5.2 RE 1 violation. A firewall rule is a conduit with an owner and a purpose, or it's tech debt waiting to be blamed.
Write the data flows before you write ports
A port list on its own is unreadable six months later. Allow 502 tells you nothing about which of eleven PLCs it's for. Start from the flow and let the port fall out of it:
| Flow | Direction | What actually has to be open |
|---|---|---|
| HMI → SCADA server | Workstation → server | Web/thick-client port, plus the auth dependency (AD, local, or the SCADA's own service). |
| SCADA driver → PLC | Server → controller | Modbus TCP 502/TCP (IANA-registered), DNP3 20000 TCP and UDP (assigned by IEEE 1815-2012), EtherNet/IP needs explicit messaging on 44818/TCP and implicit I/O on 2222/UDP separately (ODVA CIP Vol. 2), or the vendor's driver port. |
| SCADA → historian | Server → historian | DB or API port and the store-and-forward callback the collector uses. |
| OPC UA client → server | Client → server | The opc.tcp endpoint port (4840 by default per IEC 62541, often reassigned). Add mDNS 5353/UDP if you use Part 12 discovery. Plus DNS, NTP, and the certificate paths below. |
| MQTT publisher → broker | Edge → broker | 8883 for TLS (IANA secure-mqtt), not plaintext 1883, plus DNS and any bridge to a second broker. |
| Engineering PC → PLC | Workstation → controller | Time-boxed and role-restricted, not standing. |
For every row, record source zone, destination zone, protocol, port, the system that owns it, and the process reason. A rule with no owner is the one nobody dares delete, so it lives forever.
Client-initiated is a default, not a guarantee
Most industrial protocols are client-initiated over TCP, and a stateful firewall handles the return traffic for you. Then a driver opens a callback, a license check phones home, or a discovery packet goes out UDP, and the tidy one-direction rule isn't enough.
OPC Classic (DA/DCOM) is the classic trap. The client first asks the RPC endpoint mapper on 135/TCP, then moves to the dynamic port it is handed to carry the actual data, so a rule that only permits 135 lets the connection start and then hang. That dynamic range defaults to 49152-65535 on Windows Vista / Server 2008 and later, and 1025-5000 before that — nobody signs off a rule opening sixteen thousand ports, so narrow and pin it yourself with DefaultPortRange and permit only that. Unpinned, it does not work through a firewall. So before you sign off a rule, confirm on the wire:
- Which side actually opens the TCP connection — verify it, don't assume the datasheet.
- Whether the firewall is stateful for this rule, or whether you need the return direction explicitly.
- Whether the UDP discovery (OPC UA LDS, EtherNet/IP ListIdentity) is a setup-only thing or runs during operation.
- Whether a redundant pair originates traffic from both physical IPs, not just the active one.
- Which address lands in the firewall log — the node IP, the virtual IP, or a NAT translation.
And don't approve a rule because a ping got through. ICMP and your application port are unrelated: ping can be blocked while Modbus reads fine, or ping can answer while 502 is still denied.
The supporting services are where cutover dies
The application port is rarely the whole story. When something worked at FAT and fails in the isolated production zone, it's usually one of these — check them before you touch the SCADA driver:
- DNS (53). Hostname-based OPC UA endpoints and MQTT brokers resolve on the office bench and fail in a zone with no resolver path. Symptom: connect times out at name resolution, not at the port.
- NTP (123/UDP). The validator compares the certificate's
notBeforeandnotAfter(RFC 5280 4.1.2.5) against its own clock. A clock set back rejects a perfectly good certificate as not-yet-valid, event ordering scrambles, and historian timestamps lie. The failure looks like a certificate problem; it's a clock problem, and comparing the clock on both hosts before cutover takes ten seconds. - AD authentication. Kerberos 88 TCP and UDP, LDAP 389, LDAPS 636, global catalog 3268/3269, plus 135/TCP and the dynamic RPC range above. The HMI page loads because the SCADA server is reachable; the operator can't log in because the domain controller isn't. Two different conduits.
- Revocation lookups (usually 80/TCP). Where they go is written inside the certificate: the CRL address in the CRL Distribution Points extension (RFC 5280 4.2.1.13), the OCSP responder in the Authority Information Access extension under
id-ad-ocsp(RFC 5280 4.2.2.1, protocol in RFC 6960). Read those URLs withopenssl x509 -noout -textfirst and permit only those hosts. Blocked, the TLS connection stalls or drops — intermittently, which is worse. - License server. Runtime licenses that validate at FAT quietly fail in the segmented production network. This one always surfaces at 2am on cutover night.
If policy says a dependency stays blocked, design the replacement deliberately — local accounts, a local NTP source, offline/stapled cert validation. Choosing that up front is engineering. Discovering it at startup and punching a hole to get past it is not.
NAT hides the address you're troubleshooting
NAT between plant zones, vendor gear, and the enterprise is sometimes unavoidable, and it makes every packet capture ambiguous. The addresses that break things:
- An OPC UA server writes its own internal address into
EndpointDescription.endpointUrlin its GetEndpoints response (Part 4, Services). The client reached the discovery endpoint on the NAT address, and the URL it gets back is unreachable — so discovery succeeds and the next step, creating the session, dies. Check whether the server lets you override the advertised hostname with the NAT address; most stacks do, and without it you are putting a reverse proxy in the path. - The PLC rule is written for the real address, but the log shows the translated one, so it looks like no rule matched.
- The historian collector records the NAT address as the device identity, and now your point provenance is wrong.
- A failover moves the active node to an IP with no matching rule, so redundancy "works" until the day it's tested.
When NAT is in the path, put both the real and translated address in the commissioning sheet. That one column turns a two-hour capture-both-sides session into a glance.
Prove it with the protocol, not with telnet
telnet host 502 or an nmap open port proves the TCP three-way handshake completes. It does not prove the protocol works — a stateful firewall can permit the SYN and still mangle the session.
Measured, the difference is stark. I put two listeners on loopback. Port 15502 accepts TCP and then says nothing, which is the shape of a path that passes the SYN and drops the payload. Port 15503 is a real Modbus TCP server holding 1234 in holding register 0. A port scanner cannot tell them apart.
$ nc -zv -w 2 127.0.0.1 15502
Connection to 127.0.0.1 15502 port [tcp/*] succeeded!
# Send a real read-holding-registers (FC 03, addr 0, qty 1) down the same socket:
# request MBAP+PDU, 12 B: 00 01 00 00 00 06 01 03 00 00 00 01
silent port 15502 : TCP connect OK in 0.3 ms | NO Modbus reply, timed out after 5.0 s
modbus port 15503 : TCP connect OK in 0.3 ms | reply 11 B in 0 ms -> 00 01 00 00 00 05 01 03 02 04 d2
Both ports complete the TCP connect in 0.3 ms. nc reports both as succeeded. Only the application answer diverges — eleven bytes back immediately on one (the trailing 04 d2 is 1234, the register value), zero bytes after five seconds on the other. A turnover document that says "port 502 open — verified" cannot tell you which of these two you have.
So test at the application layer and keep the evidence:
- Modbus TCP: read a known register with FC 03 and check the byte count and value in the response PDU. Remember that an exception response (the function code with 0x80 added, plus an exception code) is still a successful conversation — the path is open and the address was wrong.
- OPC UA: browse, subscribe to a live tag, and do one allowed write if writes are in scope.
- MQTT: publish and subscribe through the real broker listener with TLS on — not a plaintext shortcut you'll forget to close.
- Historian: store a test value and read it back through the reporting path, which often crosses a different conduit than the collector. The ninety-second stale at the top of this article was exactly that.
- HMI: log in as an operator role and open a graphic backed by live data.
- Engineering access: go online or download only inside the approved maintenance window.
Grab the firewall log for the same timestamp as each test. That log line is what proves the intended rule carried the traffic — not an any-any startup rule someone left open.
The seven patterns you'll actually hit
Field troubleshooting collapses to a handful of causes. When a "working" path misbehaves, it's almost always one of:
- Right rule, wrong source — the test laptop is permitted, the production server isn't.
- Right rule, wrong direction — return traffic allowed, client initiation blocked (or the reverse for a callback).
- Primary only — secondary IP, virtual IP, or failover path never got its own rule.
- Name resolution missing — direct IP works, hostname endpoint doesn't.
- Clock blocked — NTP denied, so TLS/OPC UA certs read as invalid.
- Temporary rule masking — the any-any commissioning permit stays open and hides every missing detailed rule beneath it.
- Logging off — nobody can prove which rule accepted or denied anything, so every dispute is a guess.
Number 6 is the dangerous one, because everything appears to work right up until the day the broad rule gets cleaned up — and for as long as it is in place, SR 5.2 RE 1 has never once been satisfied. Which is why the last two jobs before turnover are: retest every path after you remove the startup permit, and confirm logging is on.
What the turnover package needs
Before handover, the firewall package should carry — for every rule — the approved source, destination, protocol, port, purpose, and approver; application-level test evidence for each critical flow; separate entries for redundant nodes, virtual IPs, gateways, and NAT addresses; the supporting-service conduits (DNS, NTP, auth, certs, license); expiration dates on temporary vendor and engineering rules; a rollback plan for changes made during production cutover; and log samples showing both accepted traffic and the deny you expect to see. Last of all, name who may request, approve, and remove rules after startup — because the rule set decays the moment that's ambiguous.