Use FQCN for IP utils

This commit is contained in:
2022-08-30 22:30:13 -05:00
parent cd66cef7ad
commit 08441c5f5c
7 changed files with 9 additions and 9 deletions

View File

@ -66,7 +66,7 @@
-A INPUT -i lo -m comment --comment "lo accept all inet6" -j ACCEPT
{% if firewall_ssh_whitelist | length %}
{% for ip in firewall_ssh_whitelist | ipv6 %}
{% for ip in firewall_ssh_whitelist | ansible.utils.ipv6 %}
-A INPUT -p tcp -m tcp --dport 22 --source {{ ip }} -m comment --comment "accept {{ ip }} ssh 22/tcp6" -j ACCEPT
{% endfor %}
{% endif %}

View File

@ -9,8 +9,8 @@ add {{ name }} {{ ip_or_net }}
{% endmacro %}
{% macro render_dual_stack_ipset(ipset, name, type="hash:net", family="inet", timeout=None) %}
{{ render_ipset(ipset | ipv4, name + "4", type=type, family=family, timeout=timeout) }}
{{ render_ipset(ipset | ipv6, name + "6", type=type, family="inet6", timeout=timeout) }}
{{ render_ipset(ipset | ansible.utils.ipv4, name + "4", type=type, family=family, timeout=timeout) }}
{{ render_ipset(ipset | ansible.utils.ipv6, name + "6", type=type, family="inet6", timeout=timeout) }}
{% endmacro %}
{{ render_dual_stack_ipset([], 'block') }}

View File

@ -2,7 +2,7 @@
create {{ name }} {{ type | default('hash:net') }} family {{ family }} counters {% if timeout %}timeout {{ timeout }}{% endif %} -exist
flush {{ name }}
{% if ipset | length %}
{% for ip_or_net in ipset | ipv4 %}
{% for ip_or_net in ipset | ansible.utils.ipv4 %}
add {{ name }} {{ ip_or_net }}
{% endfor %}
{% endif %}

View File

@ -2,7 +2,7 @@
create {{ name }} {{ type | default('hash:net') }} family {{ family }} counters {% if timeout %}timeout {{ timeout }}{% endif %} -exist
flush {{ name }}
{% if ipset | length %}
{% for ip_or_net in ipset | ipv6 %}
{% for ip_or_net in ipset | ansible.utils.ipv6 %}
add {{ name }} {{ ip_or_net }}
{% endfor %}
{% endif %}

View File

@ -66,7 +66,7 @@
-A INPUT -i lo -m comment --comment "lo accept all" -j ACCEPT
{% if firewall_ssh_whitelist | length %}
{% for ip in firewall_ssh_whitelist | ipv4 %}
{% for ip in firewall_ssh_whitelist | ansible.utils.ipv4 %}
-A INPUT -p tcp -m tcp --dport 22 --source {{ ip }} -m comment --comment "accept {{ ip }} ssh 22/tcp" -j ACCEPT
{% endfor %}
{% endif %}
@ -94,7 +94,7 @@
-A INPUT -p icmp -m icmp --icmp-type echo-reply -m comment --comment "accept icmp echo-reply" -j ACCEPT
{% if firewall_allowed_icmp_types | length %}
{% for type in firewall_allowed_icmp_types | ipv4 %}
{% for type in firewall_allowed_icmp_types | ansible.utils.ipv4 %}
-A INPUT -p icmp -m icmp --icmp-type {{ type }} -m comment --comment "accept icmp {{ type }}" -j ACCEPT
{% endfor %}
{% endif %}