| Default deny inbound |
Resets UFW and applies deny incoming / deny forward / allow outgoing. |
Blocks unsolicited access by default. |
Unnecessary listening services become remotely reachable. |
| SSH rate-limiting (brute-force protection) |
ufw limit ssh — allows SSH but throttles repeated connection attempts (6 per 30 s).
|
Mitigates credential-stuffing and brute-force attacks against the SSH daemon. |
Attacker can attempt unlimited password guesses without penalty. |
| Anti-spoofing (RFC 1918 / bogon drops) |
Drops packets arriving on public interfaces claiming RFC 1918 source addresses; injected into
before.rules.
|
Prevents source-IP spoofing used in reflective amplification and session-hijack attacks. |
Spoofed internal-source packets accepted, bypassing access controls. |
| INVALID state packet drops |
Drops packets in INVALID conntrack state before other rules evaluate them. |
Rejects malformed, out-of-sequence or state-table-busting packets used in evasion. |
Malformed packets can bypass stateful inspection and confuse application-layer filters. |
| Scan protection (NULL, XMAS, FIN, non-SYN) |
Drops NULL-flag, XMAS-flag, FIN-flag and non-SYN-initiating TCP packets in before.rules.
|
Eliminates the most common OS-fingerprinting and port-scan probes. |
Attackers enumerate open ports and OS version silently, enabling targeted exploitation. |
| ICMP rate-limiting & type restriction |
Allows echo-request at 1/s (burst 5) via hashlimit; drops all other ICMP
types. |
Permits network reachability checks while blocking ICMP tunnels and flood amplification. |
Unrestricted ICMP enables covert data exfiltration via ICMP tunnels and ICMP flood DoS. |
Optional strict outbound (STRICT_OUTBOUND) |
When enabled, only allows outbound DNS (53), HTTP (80), HTTPS (443), NTP (123), SMTP (25/587), SSH
(22). |
Restricts post-compromise call-home, lateral movement and data exfiltration vectors. |
Compromised processes can freely beacon to attacker infrastructure on arbitrary ports. |
| UFW high-verbosity logging |
Sets UFW log level to high (all allowed and denied connections logged). |
Provides complete audit trail of firewall decisions for incident response. |
Denied traffic invisible to operators; attackers can probe undetected. |
| UFW/sysctl alignment |
Patches /etc/ufw/sysctl.conf to prevent UFW from re-enabling IP forwarding or
source-routing. |
Ensures kernel networking parameters remain consistent with the hardened policy across reboots. |
UFW restores permissive kernel settings on restart, silently undoing OS-level hardening. |
| Loopback policy |
Explicit loopback allow and loopback anti-spoof deny rules. |
Protects local-only trust assumptions from spoofed packets. |
Loopback spoofing and policy bypass scenarios. |
| TCP wrappers baseline |
Configures hosts.deny default-deny and allows sshd in hosts.allow. |
Adds a host-based service access-control layer on top of the kernel firewall. |
No additional host ACL gate where wrappers are applicable. |