Skip to content

Instantly share code, notes, and snippets.

@fabiofdsantos
Created November 4, 2018 21:35
Show Gist options
  • Save fabiofdsantos/a86fb7bfda41d530a560ff60f6321e0b to your computer and use it in GitHub Desktop.
Save fabiofdsantos/a86fb7bfda41d530a560ff60f6321e0b to your computer and use it in GitHub Desktop.
Basic iptables to allow http, https and ssh
# Generated by iptables-save v1.4.21 on Mon Apr 25 12:53:52 2016
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp -s hostname.com --dport 22 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -j DROP
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -j ACCEPT
COMMIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment