Lockdown Lab #24 CRITICAL Linux (Ubuntu/RHEL)

Configure firewall (iptables/nftables)

Configure firewall (iptables/nftables)

You wouldn’t leave your front door wide open when you leave the house, so why are you doing it with your Linux servers? An open firewall means every listening service is directly attackable from the network. This isn’t theoretical; it’s how many initial breaches start.

The default posture for any server should be “deny all inbound traffic” and then explicitly permit only what’s absolutely necessary. SSH, HTTPS – that’s often it. Anything else is a potential attack surface. This is basic hygiene, yet I still see organizations missing it.

For Ubuntu/RHEL, use UFW. It simplifies iptables/nftables dramatically. Implement default deny inbound, allow outgoing, and then whitelist essential services. Log dropped packets; they’re gold for incident detection.

Here’s how to start: sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow 22/tcp

Defense-in-depth begins at the network perimeter of your host. If you’re not doing this, you’re leaving the door wide open.

The fix

# UFW example (Ubuntu)

sudo ufw default deny incoming

sudo ufw default allow outgoing

sudo ufw allow 22/tcp

sudo ufw allow 443/tcp

sudo ufw enable

sudo ufw status verbose

Reference: CIS Linux Benchmark 3.5

Mark this as done

Open the interactive hardening checklist and tick this off in your environment.

Open interactive checklist →

Related Posts

Lock inactive user accounts

That dormant account for a contractor who left six months ago? It's a gold mine for an attacker. I've seen too many breaches start with...

lockdown-labhardeninglinuxidentity
/Shimi Cohen

Restrict sudo access

How many times have we seen an attacker gain a foothold, then immediately escalate privileges because everyone has sudo access? It’s not a theoretical threat;...

lockdown-labhardeninglinuxidentity
/Shimi Cohen

Set password complexity and aging

Weak passwords are still the number one attack vector. Period. I've seen countless environments where a breach started with a simple brute-force or credential stuffing...

lockdown-labhardeninglinuxidentity
/Shimi Cohen