Configure UFW on Debian 12
UFW (Uncomplicated Firewall) is the default firewall front-end on Debian 12.
Step 1 – Install UFW (if not present)
apt install -y ufw
Step 2 – Default policies
ufw default deny incoming
ufw default allow outgoing
Step 3 – Allow services
ufw allow ssh
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 8080/tcp
Step 4 – Enable UFW
ufw enable
# Answer 'y' to confirm
Step 5 – Status
ufw status verbose
Step 6 – Allow from specific IP
ufw allow from 192.168.1.100 to any port 3306
Step 7 – Delete a rule
ufw delete allow 8080/tcp
Step 8 – Rate limiting (SSH brute force protection)
ufw limit ssh