Skip to content

Instantly share code, notes, and snippets.

/iptables.sls Secret

Created September 22, 2016 21:28
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 anonymous/0c958cdc17c8359f69b9b9069b532bf4 to your computer and use it in GitHub Desktop.
Save anonymous/0c958cdc17c8359f69b9b9069b532bf4 to your computer and use it in GitHub Desktop.
iptables:
pkg.latest:
- pkgs:
- iptables
- iptables-persistent
- refresh: True
- reload_modules: True
# IPv4
iptables-ipv4-allow-loopback-traffic:
iptables.append:
- table: filter
- family: ipv4
- chain: INPUT
- i: lo
- jump: ACCEPT
- save: True
- require:
- pkg: iptables
iptables-ipv4-drop-loopback-traffic-not-using-lo0:
iptables.append:
- table: filter
- family: ipv4
- chain: INPUT
- i: '! lo'
- source: 127.0.0.1/8
- jump: REJECT
- save: True
- require:
- pkg: iptables
iptables-ipv4-allow-icmp:
iptables.append:
- table: filter
- family: ipv4
- chain: INPUT
- proto: icmp
- jump: ACCEPT
- save: True
- require:
- pkg: iptables
iptables-ipv4-allow-ssh:
iptables.append:
- table: filter
- family: ipv4
- chain: INPUT
- proto: tcp
- dport: 22
- match: state
- connstate: NEW
- jump: ACCEPT
- save: True
- require:
- pkg: iptables
iptables-ipv4-allow-established-inbound:
iptables.append:
- table: filter
- family: ipv4
- chain: INPUT
- match: state
- connstate: ESTABLISHED,RELATED
- jump: ACCEPT
- save: True
- require:
- pkg: iptables
iptables-ipv4-reject-inbound-traffic:
iptables.append:
- table: filter
- family: ipv4
- chain: INPUT
- jump: REJECT
- require:
- iptables: iptables-ipv4-allow-loopback-traffic
- iptables: iptables-ipv4-drop-loopback-traffic-not-using-lo0
- iptables: iptables-ipv4-allow-established-inbound
iptables-ipv4-reject-forward-traffic:
iptables.append:
- table: filter
- family: ipv4
- chain: FORWARD
- jump: REJECT
- require:
- iptables: iptables-ipv4-allow-loopback-traffic
- iptables: iptables-ipv4-drop-loopback-traffic-not-using-lo0
- iptables: iptables-ipv4-allow-established-inbound
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment