Tools
Log in
English

Learn to codeSecurity check

Firewall is off

HighL03Linux servers

Turn on ufw or firewalld so only the ports you need are open.

What is the risk

Without a firewall, ports meant for inside use only (databases, admin panels, dev servers) are visible on the internet.

If one service is set up wrong, the firewall still blocks it.

How to check

Debian / Ubuntu

sudo ufw status verbose

RHEL / Rocky / Alma

sudo firewall-cmd --state
sudo firewall-cmd --list-all

Linux

sudo nft list ruleset | head -50
sudo iptables -S | head -50

For servers that write rules directly without ufw or firewalld.

How to fix

Debian / Ubuntu

sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable

Allow SSH first so you are not cut off. Use your SSH port if you changed it.

RHEL / Rocky / Alma

sudo systemctl enable --now firewalld
sudo firewall-cmd --permanent --add-service=ssh --add-service=http --add-service=https
sudo firewall-cmd --reload

On cloud servers also check the provider security group (firewall).

How to prevent it

  • Open admin ports (SSH, databases) only to your office or home IP, e.g. sudo ufw allow from 203.0.113.10 to any port 22 proto tcp (203.0.113.10 is an example).
  • Review open ports from time to time (L08).

Check again after fixing

Debian / Ubuntu

sudo ufw status verbose

It should say Status: active.

RHEL / Rocky / Alma

sudo firewall-cmd --state

It should say running.

Run the downloaded check again and make sure this item passes.

Security check home