forked from ISTI-ansible-roles/ansible-roles
library/roles/iptables: Support for blacklists of ip/networks. Optionally with associated protocol, source port and destination port.
This commit is contained in:
parent
6991b1abc4
commit
aa1ad48c46
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
#iptables_default_policy: REJECT
|
#iptables_default_policy: REJECT
|
||||||
iptables_default_policy: ACCEPT
|
iptables_default_policy: ACCEPT
|
||||||
|
iptables_banned_default_policy: DROP
|
||||||
ganglia_enabled: False
|
ganglia_enabled: False
|
||||||
nagios_enabled: False
|
nagios_enabled: False
|
||||||
iptables_open_all_to_isti_nets: False
|
iptables_open_all_to_isti_nets: False
|
||||||
|
|
|
@ -9,6 +9,20 @@
|
||||||
-A INPUT -p icmp -j ACCEPT
|
-A INPUT -p icmp -j ACCEPT
|
||||||
-A INPUT -i lo -j ACCEPT
|
-A INPUT -i lo -j ACCEPT
|
||||||
#
|
#
|
||||||
|
# We manage the banned IP/networks list before anything else
|
||||||
|
{% if iptables_banlist is defined %}
|
||||||
|
{% for obj in iptables_banlist %}
|
||||||
|
{% if obj.proto is defined and obj.destport is defined and obj.sourceport is defined %}
|
||||||
|
-A INPUT -m {{ obj.proto }} -p {{ obj.proto }} -s {{ obj.source }} --sport {{ obj.sourceport }} --dport {{ obj.destport }} -j {{ iptables_banned_default_policy }}
|
||||||
|
{% elif obj.proto is defined and obj.destport is defined %}
|
||||||
|
-A INPUT -m {{ obj.proto }} -p {{ obj.proto }} -s {{ obj.source }} --dport {{ obj.destport }} -j {{ iptables_banned_default_policy }}
|
||||||
|
{% elif obj.proto is defined %}
|
||||||
|
-A INPUT -m {{ obj.proto }} -p {{ obj.proto }} -s {{ obj.source }} -j {{ iptables_banned_default_policy }}
|
||||||
|
{% else %}
|
||||||
|
-A INPUT -s {{ obj.source }} -j {{ iptables_banned_default_policy }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
{% if iptables_managed_ssh is defined and iptables_managed_ssh %}
|
{% if iptables_managed_ssh is defined and iptables_managed_ssh %}
|
||||||
{% if iptables_ssh_allowed_hosts is defined %}
|
{% if iptables_ssh_allowed_hosts is defined %}
|
||||||
# ssh is not open to all, even if we use denyhosts to prevent unauthorized accesses
|
# ssh is not open to all, even if we use denyhosts to prevent unauthorized accesses
|
||||||
|
|
Loading…
Reference in New Issue