This runbook explains how to set up a firewall on a Linux server using UFW.
Prerequisites
- Access to the server
- Root or sudo privileges
Steps
- Install UFW
sudo apt install -y ufw
- Allow SSH Connections
sudo ufw allow OpenSSH
- Enable the Firewall
sudo ufw enable
- Allow Other Essential Services
sudo ufw allow http
sudo ufw allow https
- Check Firewall Status
sudo ufw status verbose
Verification
- Ensure SSH connection remains intact.
- Verify that the web server and other allowed services are accessible.