Add iptable SSH whitelist
This commit is contained in:
parent
4ddd1ed439
commit
13d12faa86
@ -64,6 +64,8 @@ firewall_limit_ssh_hitcount: 10
|
||||
|
||||
firewall_bogon_interface: "{{ ansible_default_ipv4.interface }}"
|
||||
|
||||
firewall_ssh_whitelist: {}
|
||||
|
||||
# ipset's
|
||||
firewall_ipset_cooloff_timeout: 600
|
||||
|
||||
|
@ -50,12 +50,18 @@
|
||||
|
||||
-A INPUT -i lo -m comment --comment "lo accept all inet6" -j ACCEPT
|
||||
|
||||
-A INPUT -m state --state INVALID -m comment --comment "drop invalid inet6" -j DROP
|
||||
{% if firewall_ssh_whitelist.v6 %}
|
||||
{% for ip in firewall_ssh_whitelist.v6 %}
|
||||
-A INPUT -p tcp -m tcp --dport 22 --source {{ ip }} -m comment --comment "accept {{ ip }} ssh 22/tcp6" -j ACCEPT
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if firewall_ipset_mgmt.v6 is defined %}
|
||||
-A INPUT -p tcp -m tcp --dport 22 -m set --match-set mgmt_v6 src -m comment --comment "accept mgmt ssh 22/tcp6" -j ACCEPT
|
||||
{% endif %}
|
||||
|
||||
-A INPUT -m state --state INVALID -m comment --comment "drop invalid inet6" -j DROP
|
||||
|
||||
{% if firewall_ipset_blacklist.v6 is defined %}
|
||||
-A INPUT -m set --match-set mgmt_v6 src -m comment --comment "drop blacklist inet6" -j LOG_DROP
|
||||
{% endif %}
|
||||
|
@ -50,12 +50,18 @@
|
||||
|
||||
-A INPUT -i lo -m comment --comment "lo accept all" -j ACCEPT
|
||||
|
||||
-A INPUT -m state --state INVALID -m comment --comment "drop invalid" -j DROP
|
||||
{% if firewall_ssh_whitelist.v4 %}
|
||||
{% for ip in firewall_ssh_whitelist.v4 %}
|
||||
-A INPUT -p tcp -m tcp --dport 22 --source {{ ip }} -m comment --comment "accept {{ ip }} ssh 22/tcp" -j ACCEPT
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if firewall_ipset_mgmt.v4 is defined %}
|
||||
-A INPUT -p tcp -m tcp --dport 22 -m set --match-set mgmt_v4 src -m comment --comment "accept mgmt ssh 22/tcp" -j ACCEPT
|
||||
{% endif %}
|
||||
|
||||
-A INPUT -m state --state INVALID -m comment --comment "drop invalid" -j DROP
|
||||
|
||||
{% if firewall_ipset_blacklist.v4 is defined %}
|
||||
-A INPUT -m set --match-set mgmt_v4 src -m comment --comment "drop blacklist" -j LOG_DROP
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user