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 statussudo ufw statussudo ufw status verbose # Enable the firewallsudo ufw enable # Disable the firewallsudo ufw disable # Default rules (set these first!)sudo ufw default deny incoming # Block all inbound by defaultsudo ufw default allow outgoing # Allow all outbound by default # Allow specific services/portssudo ufw allow ssh # Allow SSH (port 22)sudo ufw allow 80/tcp # Allow HTTPsudo ufw allow 443/tcp # Allow HTTPS # Block a specific portsudo ufw deny 23/tcp # Block Telnetsudo ufw deny 3389/tcp # Block RDP # Delete a rulesudo ufw delete allow 80/tcpGUFW — 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?
🎮 Practice what you learned
⭐ 0 XP🔥 0 days