# Poke Holes in a New Firewall Rulebase Before Live Traffic Does

> **FrameAssembly v3.3.0** · Operational Playbook (SecOps, Firewalls & IDS) · Canonical URL: https://frameassembly-lang.dev/use-cases/firewall-acl-testing

Bundle an allowed TLS 1.3 handshake, a rejected port 3306 probe, a sneaky out-of-state SSH ACK, and VLAN 40 ICMP into 1 repeatable .pcap.

- **Category:** SecOps, Firewalls & IDS
- **Capture Filename:** `firewall_acl_test.frasm` (9 Ethernet frames)
- **Protocols Exercised:** `vlan`, `tcp`, `tls`, `icmp`

## Operational Problem

You just rewrote 40 firewall rules and want to know if they actually work before flipping DNS. Sadly, curl and ping obey your OS kernel, while single-packet hping3 SYN blasts get laughed out of the room by any stateful NGFW.

Normal tools like ping, curl, and netcat go through your laptop’s polite OS TCP/IP stack: they refuse to spit out an unsolicited mid-stream TCP ACK on port 22, they can’t bundle client probes and firewall rejections into a single baseline file, and Windows/macOS NIC drivers happily eat your 802.1Q VLAN tags for breakfast.

Meanwhile, stateless one-packet injectors (hping3 or quick Scapy one-liners) bounce straight off Palo Alto, FortiGate, Check Point, and nftables—because stateful engines ignore a bare TLS ClientHello SNI unless it rides in behind a real 3-way TCP handshake with matching 4-tuple SEQ/ACK math.

## Scenario & Topology: DMZ Reverse-Proxy Cutover on VLAN 40 (Without Waking Up the Whole Floor)

- **Topology:** `Outside Tester (203.0.113.45) -> Perimeter Firewall (VLAN 40) <-> DMZ Proxy (198.51.100.80)`

You are swapping a crusty router ACL for a stateful zone firewall in front of a DMZ proxy (198.51.100.80) on VLAN 40. Instead of crossing your fingers at 2 AM, one 9-frame .frasm script checks all four cases at once: (1) TCP 443 finishes syn -> syn ack -> ack and carries a TLS 1.3 ClientHello SNI for "portal.corp.example"; (2) MySQL TCP 3306 gets slapped back with tcp rst ack; (3) a stray out-of-state TCP ACK on SSH port 22 gets dropped cold; and (4) ICMP ping into VLAN 40 gets icmp destunreach code 13 (Administratively Prohibited).

## FrameAssembly Workflow

Compiles 9 VLAN-40 frames covering a full TCP 443 handshake + TLS 1.3 SNI, a rejected MySQL 3306 probe, an out-of-state SSH ACK test, and an ICMP Code 13 admin block.

### Adapt It for Your Network

1. Change outside_tester and dmz_proxy to your own source zone and DMZ IPs/MACs.
2. Tweak vlan 40, the permitted TLS sni string, and whichever dstport numbers your policy is supposed to block.
3. Run frameassembly firewall_acl_test.frasm, then replay the .pcap across your test interface with tcpreplay.

## Runnable Capture Specification (`firewall_acl_test.frasm`)

```frameassembly
host outside_tester { ip 203.0.113.45  mac 00:0c:29:45:11:22 }
host dmz_proxy      { ip 198.51.100.80 mac 00:1b:21:80:aa:bb }

flow allow_https_sni(ext, dmz) {
    // 1. Permitted TCP 443 handshake + TLS 1.3 ClientHello SNI on VLAN 40
    ext -> dmz vlan 40 tcp syn srcport 52100 dstport 443 win 64240 mss 1460 wscale 7 sackperm wait 1ms
    ext <- dmz vlan 40 tcp syn ack win 65535 mss 1460 wscale 7 sackperm wait 1ms
    ext -> dmz vlan 40 tcp ack wait 1ms
    ext -> dmz vlan 40 tls clienthello sni "portal.corp.example" ciphersuite 4865 alpn "h2" wait 2ms
}

flow verify_firewall_blocks(ext, dmz) {
    // 2. Blocked MySQL port 3306 rejected immediately with TCP RST+ACK
    ext -> dmz vlan 40 tcp syn srcport 52101 dstport 3306 win 64240 mss 1460 wait 1ms
    ext <- dmz vlan 40 tcp rst ack wait 5ms

    // 3. Out-of-state TCP ACK probe on SSH port 22 (audits stateful session drop)
    ext -> dmz vlan 40 tcp ack srcport 52102 dstport 22 seq 85000 acknum 42000 win 1024 wait 5ms

    // 4. Blocked ICMP Echo answered with Code 13 (Administratively Prohibited)
    ext -> dmz vlan 40 ttl 64 icmp echorequest id 900 seq 1 payload "DMZ_ACL_AUDIT" wait 1ms
    ext <- dmz vlan 40 ttl 64 icmp destunreach code 13 wait 1ms
}

compile {
    allow_https_sni(outside_tester, dmz_proxy)
    verify_firewall_blocks(outside_tester, dmz_proxy)
}
```

## Equivalent CLI Commands

```bash
# 1. Preview the 9-packet stateful firewall audit ladder in your terminal
frameassembly show firewall_acl_test.frasm

# 2. Compile to .pcap and verify TCP SEQ/ACK, VLAN 40, TLS SNI, and ICMP Code 13 in tshark
frameassembly firewall_acl_test.frasm firewall_acl_test.pcap
tshark -r firewall_acl_test.pcap

# 3. Replay into your firewall ingress test port or SPAN sensor
sudo tcpreplay -i eth0 firewall_acl_test.pcap
```

## Protocol Reference Links

- [`vlan` — IEEE 802.1Q Virtual LAN Tagging & 802.1p QoS](https://frameassembly-lang.dev/docs/protocols/vlan) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/vlan.md))
- [`tcp` — Transmission Control Protocol & RFC 7323 Options](https://frameassembly-lang.dev/docs/protocols/tcp) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/tcp.md))
- [`tls` — Transport Layer Security Record & Handshake Layer](https://frameassembly-lang.dev/docs/protocols/tls) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/tls.md))
- [`icmp` — Internet Control Message Protocol v4 & Dual-Stack ICMPv6](https://frameassembly-lang.dev/docs/protocols/icmp) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/icmp.md))
