add iptables role and define firewall rules for mirror group
This commit is contained in:
parent
713d2d1c89
commit
bfa5e5807c
7 changed files with 105 additions and 0 deletions
22
roles/iptables/templates/ip6tables.j2
Normal file
22
roles/iptables/templates/ip6tables.j2
Normal file
|
@ -0,0 +1,22 @@
|
|||
*filter
|
||||
:INPUT ACCEPT [0:0]
|
||||
:FORWARD DROP [0:0]
|
||||
:OUTPUT ACCEPT [0:0]
|
||||
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
-A INPUT -p ipv6-icmp -j ACCEPT
|
||||
-A INPUT -i lo -j ACCEPT
|
||||
{% for rule in firewall_raw %}
|
||||
{{ rule }}
|
||||
{% endfor %}
|
||||
{% for rule in firewall_in %}
|
||||
{% if rule.from is defined %}
|
||||
{% for from in rule.from | ipv6 %}
|
||||
-A INPUT -m state --state NEW -m {{ rule.proto }} -p {{ rule.proto }} -s {{ from }} --dport {{ rule.port }} -j ACCEPT
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
-A INPUT -m state --state NEW -m {{ rule.proto }} -p {{ rule.proto }} --dport {{ rule.port }} -j ACCEPT
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
-A INPUT -j REJECT --reject-with icmp6-adm-prohibited
|
||||
-A FORWARD -j REJECT --reject-with icmp6-adm-prohibited
|
||||
COMMIT
|
22
roles/iptables/templates/iptables.j2
Normal file
22
roles/iptables/templates/iptables.j2
Normal file
|
@ -0,0 +1,22 @@
|
|||
*filter
|
||||
:INPUT ACCEPT [0:0]
|
||||
:FORWARD DROP [0:0]
|
||||
:OUTPUT ACCEPT [0:0]
|
||||
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
-A INPUT -p icmp -j ACCEPT
|
||||
-A INPUT -i lo -j ACCEPT
|
||||
{% for rule in firewall_raw %}
|
||||
{{ rule }}
|
||||
{% endfor %}
|
||||
{% for rule in firewall_in %}
|
||||
{% if rule.from is defined %}
|
||||
{% for from in rule.from | ipv4 %}
|
||||
-A INPUT -m state --state NEW -m {{ rule.proto }} -p {{ rule.proto }} -s {{ from }} --dport {{ rule.port }} -j ACCEPT
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
-A INPUT -m state --state NEW -m {{ rule.proto }} -p {{ rule.proto }} --dport {{ rule.port }} -j ACCEPT
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
-A INPUT -j REJECT --reject-with icmp-host-prohibited
|
||||
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
|
||||
COMMIT
|
Loading…
Add table
Add a link
Reference in a new issue