Skip to content

Instantly share code, notes, and snippets.

@mjmunger
Created August 11, 2017 01:19
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 mjmunger/0ee176b88ce403d743bfad6129878f37 to your computer and use it in GitHub Desktop.
Save mjmunger/0ee176b88ce403d743bfad6129878f37 to your computer and use it in GitHub Desktop.
iptables settings for eCommerce (Only)
#!/bin/bash
#Default deny
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
#Allow established sessions
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
#Allow localhost
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
#Allow tcp/80 (HTTP)
iptables -A INPUT -p tcp --dport 80 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
#Allow tcp/443 (HTTPS)
iptables -A INPUT -p tcp --dport 443 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
#Allow SSH on our random port
iptables -A INPUT -p tcp --dport 32637 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment