|
1 | 1 | --- |
| 2 | +# Global config |
| 3 | +iptables_supported_distributions: [ Debian ] |
| 4 | +iptables_packages: [ iptables-persistent ] |
| 5 | +iptables_template_header: |
| 6 | + - "WARNING: This file is generated automatically with Ansible, do not edit directly!!" |
| 7 | + - "---" |
| 8 | + |
| 9 | +# Network config |
| 10 | +iptables_v4_enabled: true |
| 11 | +iptables_v6_enabled: true |
| 12 | + |
| 13 | +# Begining of the firewall rules (top of the rules file) |
| 14 | +iptables_v4_rules_header: |
| 15 | + - name: "Create the BEFORE_DOCKER chain" |
| 16 | + rules: |
| 17 | + - "*filter" |
| 18 | + - ":INPUT ACCEPT [0:0]" |
| 19 | + - ":FORWARD ACCEPT [0:0]" |
| 20 | + - ":OUTPUT ACCEPT [0:0]" |
| 21 | + - ":BEFORE_DOCKER - [0:0]" |
| 22 | + - name: "Default action" |
| 23 | + rules: |
| 24 | + - "-A BEFORE_DOCKER -j DROP" |
| 25 | + - name: "Allow Docker internal" |
| 26 | + rules: |
| 27 | + - "-A BEFORE_DOCKER -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT" |
| 28 | + - "-A BEFORE_DOCKER -i docker0 -o docker0 -j ACCEPT" |
| 29 | + - name: "Allow local connections" |
| 30 | + rules: |
| 31 | + - "-A BEFORE_DOCKER -i lo -j ACCEPT" |
| 32 | + - "-A FORWARD -o docker0 -j BEFORE_DOCKER" |
| 33 | +iptables_v6_rules_header: |
| 34 | + - name: "Default policy" |
| 35 | + rules: |
| 36 | + - "*filter" |
| 37 | + - ":INPUT ACCEPT [0:0]" |
| 38 | + - ":FORWARD ACCEPT [0:0]" |
| 39 | + - ":OUTPUT ACCEPT [0:0]" |
| 40 | + |
| 41 | +# End of the firewall rules (bottom of the rules file) |
| 42 | +iptables_v4_rules_footer: |
| 43 | + - name: "Finally insert the BEFORE_DOCKER table before the DOCKER table in the FORWARD chain." |
| 44 | + rules: |
| 45 | + - "-I BEFORE_DOCKER -i lo -j ACCEPT" |
| 46 | + - "-I FORWARD -o docker0 -j BEFORE_DOCKER" |
| 47 | +iptables_v6_rules_footer: [] |
| 48 | + |
| 49 | + |
| 50 | +# Misc |
| 51 | +TEST_ENV: "{{ 'molecule_' in ansible_hostname }}" |
0 commit comments