Aqui está minha configuração do ufw
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