Ubuntu – How to configure Firewall

firewallwebserver

How can I configure firewall for what I use as a web development server. I should be blocking all ports except 80 (HTTP), FTP, SSH? I tried configuring using ufw, gufw, firestarter but I ended up blocking myself from surfing the net … 🙂

Best Answer

Here is my ufw configuration

sudo ufw enable         #Enable ufw
sudo ufw default deny   #By default deny everything
sudo ufw allow 22       #Allow port 22 (ssh) I also use this for sftp
sudo ufw allow 80       #Allow port 80 (http)
sudo ufw allow 9418     #Allow port 9418 (git) You probably wont need this
sudo ufw limit ssh/tcp  #Limit connections to ssh/tcp to slowdown possible attacks
Related Question