Skip to content

Instantly share code, notes, and snippets.

@unixpickle
Created April 22, 2014 19:59
Show Gist options
  • Save unixpickle/11192317 to your computer and use it in GitHub Desktop.
Save unixpickle/11192317 to your computer and use it in GitHub Desktop.
My iptables configuration script
#!/bin/bash
setupAccept () {
$1 -P INPUT ACCEPT
$1 -P OUTPUT ACCEPT
$1 --flush
$1 -A INPUT -i lo -j ACCEPT
$1 -A OUTPUT -o lo -j ACCEPT
$1 -A INPUT -p tcp --dport 80 -j ACCEPT
$1 -A INPUT -p tcp --dport 22 -j ACCEPT
$1 -A INPUT -p tcp --dport 443 -j ACCEPT
$1 -A INPUT -p udp --sport 53 -j ACCEPT
$1 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$1 -P INPUT DROP
}
setupAccept iptables
setupAccept ip6tables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment