Lion Cipher Lab

Set up a host firewall with UFW

Why it matters

Every service listening on a machine is a door someone can try to open. A host-based firewall decides, per machine, which doors are allowed and slams the rest shut — so a forgotten database port or a misconfigured service isn't quietly reachable from the network. The professional default is deny-by-default: block all incoming connections, then open only the few you actually need. UFW (the Uncomplicated Firewall) is the standard, beginner-friendly way to do exactly that on Ubuntu and Debian, and the discipline transfers straight to servers you'll defend on the job.

What you'll learn

Steps in this lab

  1. What a host firewall is, and why default-deny
  2. Confirm UFW is present and check its state
  3. Allow SSH FIRST — so you don't lock yourself out
  4. Set the default policy: deny incoming, allow outgoing
  5. Enable the firewall
  6. Check the status and read what it tells you
  7. Test that the wall actually holds

Open the full interactive lab →