Skip to content

Instantly share code, notes, and snippets.

@Fleshgrinder
Last active Aug 29, 2015
Embed
What would you like to do?
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