Skip to content

Commit

Permalink
Merge pull request #48 from mgomersbach/fix-chain-creation-order
Browse files Browse the repository at this point in the history
fix(tables.sls): chain and rule creation order
  • Loading branch information
javierbertoli authored Jan 2, 2020
2 parents 0030d54 + 80f6d5d commit ce1728a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions iptables/tables.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
{%- from "iptables/map.jinja" import firewall with context %}
{%- for t in ['filter','nat','mangle'] %}
{%- for cn, cv in firewall.get(t)|dictsort %}
{%- set pol = cv.policy | default('ACCEPT') %}
{%- set rules = cv.rules | default({}) %}
{%- for cn, cv in firewall.get(t).items() %}
chain_present_{{ t }}_{{ cn }}:
iptables.chain_present:
- table: {{ t }}
- name: {{ cn }}
{%- endfor %}
{%- for cn, cv in firewall.get(t).items() %}
{%- set pol = cv.policy | default('ACCEPT') %}
{%- set rules = cv.rules | default({}) %}
{%- for rn, rv in rules|dictsort %}
rule_{{ t }}_{{ cn }}_{{ rn }}:
{%- if rv['position'] is defined %}
Expand All @@ -22,7 +23,7 @@ rule_{{ t }}_{{ cn }}_{{ rn }}:
{%- endif %}
- table: {{ t }}
- chain: {{ cn }}
{%- for k,v in rv|dictsort %}
{%- for k,v in rv.items() %}
- {{ k }}: '{{ v }}'
{%- endfor %}
- save: true
Expand Down

0 comments on commit ce1728a

Please sign in to comment.