Standardize iptables comments

This commit is contained in:
2019-08-27 06:08:19 +00:00
parent 39b526a6a4
commit dfeed33f2b
3 changed files with 51 additions and 45 deletions

View File

@@ -17,24 +17,24 @@
-N LIMIT_SSH
-A LIMIT_SSH -m recent --set --name SSH --rsource
-A LIMIT_SSH -m recent --update --seconds {{ firewall_limit_ssh_seconds }} --hitcount {{ firewall_limit_ssh_hitcount }} --name SSH --rsource -m limit --limit {{ firewall_log_limit }} --limit-burst {{ firewall_log_limit_burst }} -j LOG --log-prefix "[iptables SSH BRUTE] " --log-level info
-A LIMIT_SSH -p tcp -m tcp -m recent --update --seconds {{ firewall_limit_ssh_seconds }} --hitcount {{ firewall_limit_ssh_hitcount }} --name SSH --rsource -m comment --comment "rate limit ssh v4" -j REJECT --reject-with tcp-reset
-A LIMIT_SSH -p tcp -m tcp -m recent --update --seconds {{ firewall_limit_ssh_seconds }} --hitcount {{ firewall_limit_ssh_hitcount }} --name SSH --rsource -m comment --comment "rate limit ssh 22/tcp" -j REJECT --reject-with tcp-reset
-A LIMIT_SSH -j ACCEPT
{% endif %}
{% if firewall_drop_icmp_flood %}
-N ICMP_FLOOD
-A ICMP_FLOOD -m recent --set --name ICMP --rsource
-A ICMP_FLOOD -m recent --update --seconds 1 --hitcount 6 --name ICMP --rsource --rttl -m limit --limit {{ firewall_log_limit }} --limit-burst {{ firewall_log_limit_burst }} -j LOG --log-prefix "[iptables ICMP FLOOD] " --log-level info
-A ICMP_FLOOD -m recent --update --seconds 1 --hitcount 6 --name ICMP --rsource --rttl -m comment --comment "drop icmp flood v4" -j REJECT --reject-with icmp-admin-prohibited
-A ICMP_FLOOD -m recent --update --seconds {{ firewall_limit_icmp_flood_seconds }} --hitcount {{ firewall_limit_icmp_flood_hitcount }} --name ICMP --rsource --rttl -m limit --limit {{ firewall_log_limit }} --limit-burst {{ firewall_log_limit_burst }} -j LOG --log-prefix "[iptables ICMP FLOOD] " --log-level info
-A ICMP_FLOOD -m recent --update --seconds {{ firewall_limit_icmp_flood_seconds }} --hitcount {{ firewall_limit_icmp_flood_hitcount }} --name ICMP --rsource --rttl -m comment --comment "drop icmp flood" -j REJECT --reject-with icmp-admin-prohibited
-A ICMP_FLOOD -j ACCEPT
{% endif %}
-A INPUT -i lo -m comment --comment "lo accept all" -j ACCEPT
-A INPUT -m state --state INVALID -m comment --comment "drop invalid IPv4" -j DROP
-A INPUT -m state --state INVALID -m comment --comment "drop invalid" -j DROP
{% 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" -j ACCEPT
-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 %}
{% if firewall_ipset_blacklist.v4 is defined %}
@@ -60,9 +60,9 @@
{% endfor %}
{% if firewall_limit_ssh %}
-A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m comment --comment "accept ssh" -j LIMIT_SSH
-A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m comment --comment "accept ssh 22/tcp" -j LIMIT_SSH
{% else %}
-A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m comment --comment "accept ssh" -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m comment --comment "accept ssh 22/tcp" -j ACCEPT
{% endif %}
{% for port in firewall_allowed_tcp_ports.v4 | default([]) %}
@@ -75,6 +75,8 @@
-A INPUT -m state --state RELATED,ESTABLISHED -m comment --comment "accept related/established" -j ACCEPT
-A INPUT -m comment --comment "log drop" -j LOG_DROP
-A INPUT -m comment --comment "default drop" -j LOG_DROP
COMMIT
# vim: tw=0