Skip to content

Instantly share code, notes, and snippets.

@Fleshgrinder
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fleshgrinder/54c631c22f52a7f7bbb8 to your computer and use it in GitHub Desktop.
Save Fleshgrinder/54c631c22f52a7f7bbb8 to your computer and use it in GitHub Desktop.
Install and configure UFW firewall on Debian for easy firewall management.
#!/bin/sh
# Install ufw and its dependencies.
export DEBIAN_FRONTEND=noninteractive
aptitude install -q -y ufw
# SEE: https://serverfault.com/questions/416727
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Configure ufw to allow SSH, HTTP and HTTPS and enable it.
ufw default deny
ufw limit 22
ufw allow 80
ufw allow 443
ufw enable
# Use numbered output for deleting!
ufw status numbered
# ufw delete X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment