`ufw status` shows nothing at all when UFW is inactive — firewall checks silently pass with zero actual protection
ufw status
Status: inactive
(even though `ufw allow 22` etc. were run earlier and appear to have succeeded)What's happening
`ufw allow <port>` stores the rule immediately whether or not UFW itself is enabled — but `ufw status` on an inactive UFW just prints `Status: inactive` and lists no rules at all, no matter how many were added. Any script or healthcheck that verifies firewall state by grepping for an expected ALLOW/DENY line (e.g. `ufw status | grep -q '22/tcp.*ALLOW'`) will fail that grep when UFW happens to be inactive — which is easy to misdiagnose as 'the firewall is blocking this,' when the real situation is the opposite: there is no filtering active at all, and every port is wide open.
Fix
1. Always run `ufw --force enable` as an explicit, verified step in provisioning — never assume a base image or earlier script already left it enabled. 2. If a service is unexpectedly unreachable, check `ufw status` BEFORE assuming a DENY rule is the cause — `inactive` means 'no filtering happening,' the opposite of blocking. 3. For scripted verification, check the enabled state separately from rule presence: confirm `ufw status` starts with `Status: active` before trusting any ALLOW/DENY lines that follow it. 4. If UFW keeps reverting to inactive after provisioning, look for a cloud-init or setup script failure earlier in the boot sequence — a crashed provisioning step is a common reason firewall enablement silently gets skipped.
Got a different error? Paste it here for a free diagnosis.