Skip to content

Instantly share code, notes, and snippets.

@chr33s
Created July 28, 2016 18:54
Show Gist options
  • Select an option

  • Save chr33s/fab7ce71d2bf4a9bf4daadb37dc13cc0 to your computer and use it in GitHub Desktop.

Select an option

Save chr33s/fab7ce71d2bf4a9bf4daadb37dc13cc0 to your computer and use it in GitHub Desktop.
firewall
#!/bin/bash
# /etc/network/if-pre-up.d/iptables
iptables-restore < /etc/iptables/rules.v4
ip6tables-restore < /etc/iptables/rules.v6
*filter
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m multiport --dports 80 -j ACCEPT
-A INPUT -j DROP
-A FORWARD -j DROP
-A OUTPUT -j ACCEPT
COMMIT
*filter
-A INPUT -j DROP
-A OUTPUT -j DROP
-A FORWARD -j DROP
COMMIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment