Ubuntu Security · 4.4

🔥 Ubuntu Firewall (ufw)

Simple, powerful, and not enabled by default⏱ ~2 min

⚠ WarningUbuntu's built-in firewall (ufw) is NOT enabled by default. Enabling it and setting default-deny inbound is one of the most common competition points and takes about 30 seconds.

Basic ufw Commands

bash
# Check firewall status
sudo ufw status
sudo ufw status verbose
# Enable the firewall
sudo ufw enable
# Disable the firewall
sudo ufw disable
# Default rules (set these first!)
sudo ufw default deny incoming # Block all inbound by default
sudo ufw default allow outgoing # Allow all outbound by default
# Allow specific services/ports
sudo ufw allow ssh # Allow SSH (port 22)
sudo ufw allow 80/tcp # Allow HTTP
sudo ufw allow 443/tcp # Allow HTTPS
# Block a specific port
sudo ufw deny 23/tcp # Block Telnet
sudo ufw deny 3389/tcp # Block RDP
# Delete a rule
sudo ufw delete allow 80/tcp

GUFW — Graphical Interface for ufw

  • Install: sudo apt install gufw
  • Run: sudo gufw (or search 'Firewall Configuration' in Ubuntu)
  • Set Status to ON, incoming to Deny, outgoing to Allow
  • Add specific rules for services the scenario requires

Deny vs. Reject — What's the Difference?

DENY
  • Silently drops the packet
  • Attacker gets no response — doesn't know if port is filtered or just closed
  • Slightly better for security (less information given to attacker)
REJECT
  • Sends back a 'connection refused' message
  • Faster for legitimate clients to detect the port is closed
  • Slightly more informative for attackers
💡 TipFor competition, use 'deny' as your default and only 'allow' what the scenario explicitly requires. Every unnecessary open port is a potential vulnerability.
🧠Quick Checkfirst try = +5 XP

What's the first ufw command to run in competition?

0 XP🔥 0 days