2015-05-28 11:32:57 +02:00
|
|
|
#
|
2016-06-11 15:24:48 +02:00
|
|
|
# {{ ansible_managed }} don't manually modify this file
|
2015-05-28 11:32:57 +02:00
|
|
|
#
|
|
|
|
*filter
|
|
|
|
:INPUT ACCEPT [0:0]
|
|
|
|
:FORWARD ACCEPT [0:0]
|
|
|
|
:OUTPUT ACCEPT [0:0]
|
2015-10-23 16:01:53 +02:00
|
|
|
# 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 %}
|
2016-06-11 15:24:48 +02:00
|
|
|
# Return traffic and localhost
|
2015-10-23 19:45:07 +02:00
|
|
|
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
|
|
|
-A INPUT -p icmp -j ACCEPT
|
|
|
|
-A INPUT -i lo -j ACCEPT
|
|
|
|
#
|
2015-05-28 11:32:57 +02:00
|
|
|
{% if iptables_managed_ssh is defined and iptables_managed_ssh %}
|
|
|
|
{% if iptables_ssh_allowed_hosts is defined %}
|
|
|
|
# ssh is not open to all, even if we use denyhosts to prevent unauthorized accesses
|
2015-07-15 13:59:23 +02:00
|
|
|
{% for ip in iptables_ssh_allowed_hosts %}
|
2015-05-28 11:32:57 +02:00
|
|
|
-A INPUT -m state --state NEW -m tcp -p tcp -s {{ ip }} --dport 22 -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
2016-08-04 16:56:59 +02:00
|
|
|
# ssh is always open. We use denyhosts or fail2ban to prevent unauthorized accesses
|
2015-05-28 11:32:57 +02:00
|
|
|
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
|
|
|
|
{% endif %}
|
2015-06-14 23:39:13 +02:00
|
|
|
{% if iptables_open_all_to_isti_nets is defined and iptables_open_all_to_isti_nets %}
|
2015-05-28 11:32:57 +02:00
|
|
|
# Permit all traffic from our networks
|
|
|
|
-A INPUT -s {{ network.isti }} -j ACCEPT
|
|
|
|
-A INPUT -s {{ network.nmis }} -j ACCEPT
|
|
|
|
-A INPUT -s {{ network.eduroam }} -j ACCEPT
|
|
|
|
{% endif %}
|
2016-08-04 16:56:59 +02:00
|
|
|
{% if http_port is not defined %}
|
2016-07-12 15:33:46 +02:00
|
|
|
{% if letsencrypt_acme_install is defined and letsencrypt_acme_install %}
|
|
|
|
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
|
|
|
|
{% endif %}
|
2016-08-04 16:56:59 +02:00
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% if http_port is defined %}
|
|
|
|
# http
|
|
|
|
{% if http_allowed_hosts is defined %}
|
|
|
|
{% for ip in http_allowed_hosts %}
|
|
|
|
-A INPUT -m state --state NEW -s {{ ip }} -p tcp -m tcp --dport {{ http_port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
-A INPUT -m state --state NEW -m tcp -p tcp --dport {{ http_port }} -j ACCEPT
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% if https_port is defined %}
|
|
|
|
# https
|
|
|
|
{% if https_allowed_hosts is defined %}
|
|
|
|
{% for ip in https_allowed_hosts %}
|
|
|
|
-A INPUT -m state --state NEW -s {{ ip }} -p tcp -m tcp --dport {{ https_port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
-A INPUT -m state --state NEW -m tcp -p tcp --dport {{ https_port }} -j ACCEPT
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2016-06-22 18:02:28 +02:00
|
|
|
{% if psql_firewall_enabled %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% if psql_db_port is defined %}
|
2018-01-16 17:03:54 +01:00
|
|
|
{% if psql_listen_on_ext_int is defined and psql_listen_on_ext_int %}
|
2017-03-07 13:12:01 +01:00
|
|
|
{% if psql_db_data is defined %}
|
2015-05-28 11:32:57 +02:00
|
|
|
# postgresql clients
|
|
|
|
{% for db in psql_db_data %}
|
|
|
|
{% for ip in db.allowed_hosts %}
|
|
|
|
-A INPUT -m state --state NEW -s {{ ip }} -p tcp -m tcp --dport {{ psql_db_port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2017-03-07 13:12:01 +01:00
|
|
|
{% endif %}
|
2015-06-22 14:49:59 +02:00
|
|
|
-A INPUT -m state --state NEW -s {{ ansible_default_ipv4.address }} -p tcp -m tcp --dport {{ psql_db_port }} -j ACCEPT
|
2015-05-28 11:32:57 +02:00
|
|
|
-A INPUT -p tcp -m tcp --dport {{ psql_db_port }} -j DROP
|
|
|
|
{% endif %}
|
2016-06-22 18:02:28 +02:00
|
|
|
{% endif %}
|
|
|
|
{% if mysql_firewall_enabled %}
|
2015-07-13 14:17:42 +02:00
|
|
|
{% if mysql_db_port is defined %}
|
|
|
|
{% if mysql_listen_on_ext_int %}
|
|
|
|
# mysql clients
|
|
|
|
{% for db in mysql_db_data %}
|
|
|
|
{% for ip in db.allowed_hosts %}
|
|
|
|
-A INPUT -m state --state NEW -s {{ ip }} -p tcp -m tcp --dport {{ mysql_db_port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
-A INPUT -m state --state NEW -s {{ ansible_default_ipv4.address }} -p tcp -m tcp --dport {{ mysql_db_port }} -j ACCEPT
|
|
|
|
-A INPUT -p tcp -m tcp --dport {{ mysql_db_port }} -j DROP
|
|
|
|
{% endif %}
|
2016-06-22 18:02:28 +02:00
|
|
|
{% endif %}
|
2015-07-14 00:30:49 +02:00
|
|
|
{% if openldap_slapd_tcp_port is defined %}
|
|
|
|
{% if openldap_allowed_clients is defined %}
|
2016-06-11 15:24:48 +02:00
|
|
|
# LDAP
|
2015-07-14 00:30:49 +02:00
|
|
|
{% for addr in openldap_allowed_clients %}
|
|
|
|
{% if not openldap_slapd_ssl_only %}
|
|
|
|
-A INPUT -m state --state NEW -s {{ addr }} -p tcp -m tcp --dport {{ openldap_slapd_tcp_port }} -j ACCEPT
|
|
|
|
{% endif %}
|
|
|
|
-A INPUT -m state --state NEW -s {{ addr }} -p tcp -m tcp --dport {{ openldap_slapd_ssl_port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
{% if not openldap_slapd_ssl_only %}
|
|
|
|
-A INPUT -m state --state NEW -p tcp -m tcp --dport {{ openldap_slapd_tcp_port }} -j ACCEPT
|
|
|
|
{% endif %}
|
|
|
|
-A INPUT -m state --state NEW -p tcp -m tcp --dport {{ openldap_slapd_ssl_port }} -j ACCEPT
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% if mongodb_allowed_hosts is defined %}
|
|
|
|
# mongodb clients
|
|
|
|
{% for ip in mongodb_allowed_hosts %}
|
2015-06-11 16:29:58 +02:00
|
|
|
{% if mongodb_tcp_port is defined %}
|
2015-05-28 11:32:57 +02:00
|
|
|
-A INPUT -m state --state NEW -s {{ ip }} -p tcp -m tcp --dport {{ mongodb_tcp_port }} -j ACCEPT
|
2015-06-11 16:29:58 +02:00
|
|
|
{% else %}
|
|
|
|
-A INPUT -m state --state NEW -s {{ ip }} -p tcp -m tcp --dport 27017 -j ACCEPT
|
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% endfor %}
|
2015-06-11 16:29:58 +02:00
|
|
|
{% if mongodb_tcp_port is defined %}
|
2015-05-28 11:32:57 +02:00
|
|
|
-A INPUT -p tcp -m tcp --dport {{ mongodb_tcp_port }} -j DROP
|
2015-06-11 16:29:58 +02:00
|
|
|
{% else %}
|
|
|
|
-A INPUT -p tcp -m tcp --dport 27017 -j DROP
|
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% endif %}
|
|
|
|
{% if dnet_ports is defined %}
|
|
|
|
# dnet services
|
|
|
|
{% for tcp_port in dnet_ports %}
|
|
|
|
-A INPUT -m state --state NEW -p tcp -m tcp --dport {{ tcp_port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
{% if dnet_jmx_ports is defined %}
|
|
|
|
# dnet jmx ports. Open to the isti networks only
|
|
|
|
{% for tcp_port in dnet_jmx_ports %}
|
|
|
|
-A INPUT -m state --state NEW -p tcp -m tcp -s {{ network.isti }} --dport {{ tcp_port }} -j ACCEPT
|
|
|
|
-A INPUT -m state --state NEW -p tcp -m tcp -s {{ network.nmis }} --dport {{ tcp_port }} -j ACCEPT
|
|
|
|
-A INPUT -m state --state NEW -p tcp -m tcp -s {{ network.eduroam }} --dport {{ tcp_port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
{% if vsftpd_iptables_rules is defined and vsftpd_iptables_rules %}
|
|
|
|
# Someone still uses ftp
|
|
|
|
{% if vsftpd_iptables_allowed_hosts is defined and vsftpd_iptables_allowed_hosts %}
|
|
|
|
{% for ip in vsftpd_iptables_allowed_hosts %}
|
|
|
|
-A INPUT -m state --state NEW -m tcp -p tcp -s {{ ip }} --dport ftp -j ACCEPT
|
|
|
|
-A INPUT -m state --state NEW,RELATED -m tcp -p tcp -s {{ ip }} --dport {{ vsftpd_pasv_min_port }}:{{ vsftpd_pasv_max_port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
-A INPUT -m helper --helper ftp -j ACCEPT
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2015-10-15 18:42:08 +02:00
|
|
|
{% if nagios_enabled is defined %}
|
2015-10-07 14:48:22 +02:00
|
|
|
{% if nagios_enabled %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% if nagios_monitoring_server_ip is defined %}
|
|
|
|
# Nagios NRPE
|
2016-06-11 15:24:48 +02:00
|
|
|
{% for ip in nagios_monitoring_server_ip %}
|
2015-07-15 13:59:23 +02:00
|
|
|
-A INPUT -m state --state NEW -s {{ ip }} -p tcp -m tcp --dport 5666 -j ACCEPT
|
|
|
|
# Check ntp from the nagios server
|
|
|
|
-A INPUT -s {{ ip }} -p udp -m udp --dport 123 -j ACCEPT
|
|
|
|
{% endfor %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% endif %}
|
2015-10-07 14:48:22 +02:00
|
|
|
{% endif %}
|
2015-10-15 18:42:08 +02:00
|
|
|
{% endif %}
|
|
|
|
{% if configure_munin is defined %}
|
2015-10-14 14:47:23 +02:00
|
|
|
{% if configure_munin %}
|
|
|
|
{% if munin_server %}
|
2015-05-28 11:32:57 +02:00
|
|
|
# Munin
|
2016-06-11 15:24:48 +02:00
|
|
|
{% for ip in munin_server %}
|
2015-05-28 11:32:57 +02:00
|
|
|
-A INPUT -m state --state NEW -s {{ ip }} -p tcp -m tcp --dport 4949 -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2015-10-14 14:47:23 +02:00
|
|
|
{% endif %}
|
2015-10-15 18:42:08 +02:00
|
|
|
{% endif %}
|
2016-05-25 15:55:51 +02:00
|
|
|
{% if tomcat_cluster_enabled %}
|
|
|
|
# tomcat cluster
|
|
|
|
-A INPUT -m pkttype --pkt-type multicast -d {{ tomcat_cluster_multicast_addr }} -j ACCEPT
|
|
|
|
-A INPUT -m state --state NEW -p tcp -m tcp --dport {{ tomcat_cluster_multicast_port }} -j ACCEPT
|
2016-09-12 11:56:19 +02:00
|
|
|
{% if tomcat_cluster_multicast_net is defined %}
|
|
|
|
-A INPUT -d {{ tomcat_cluster_multicast_net }} -j ACCEPT
|
|
|
|
{% endif %}
|
2016-05-25 15:55:51 +02:00
|
|
|
{% endif %}
|
2016-09-28 19:19:03 +02:00
|
|
|
{% if orientdb_hazelcast_multicast_enabled is defined and orientdb_hazelcast_multicast_enabled %}
|
|
|
|
# orientdb hazelcast multicast rules
|
|
|
|
-A INPUT -m pkttype --pkt-type multicast -d {{ orientdb_hazelcast_multicast_group }} -j ACCEPT
|
|
|
|
-A INPUT -m state --state NEW -p tcp -m tcp --dport {{ orientdb_hazelcast_multicast_port }} -j ACCEPT
|
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
# Ganglia
|
2018-01-25 20:17:58 +01:00
|
|
|
{% if ganglia_enabled is defined and ganglia_enabled %}
|
|
|
|
{% if ganglia_gmond_cluster_port is defined %}
|
|
|
|
{% if ganglia_unicast_mode is defined %}
|
|
|
|
{% if ganglia_unicast_mode %}
|
|
|
|
{% for net in ganglia_unicast_networks %}
|
|
|
|
-A INPUT -p udp -m udp -s {{ net }} --dport {{ ganglia_gmond_cluster_port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% if ganglia_gmond_use_jmxtrans is not defined or not ganglia_gmond_use_jmxtrans %}
|
|
|
|
-A INPUT -m pkttype --pkt-type multicast -d {{ ganglia_gmond_mcast_addr }} -j ACCEPT
|
|
|
|
{% else %}
|
|
|
|
-A INPUT -m pkttype --pkt-type multicast -j ACCEPT
|
|
|
|
-A INPUT -p udp -m udp -d {{ ganglia_gmond_mcast_addr }} --dport {{ ganglia_gmond_cluster_port }} -j ACCEPT
|
|
|
|
{% endif %}
|
2018-01-25 20:17:58 +01:00
|
|
|
{% endif %}
|
2016-07-12 19:15:00 +02:00
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
-A INPUT -m state --state NEW -s {{ ganglia_gmetad_host }} -p tcp -m tcp --dport {{ ganglia_gmond_cluster_port }} -j ACCEPT
|
|
|
|
-A INPUT -s {{ ganglia_gmetad_host }} -p udp -m udp --dport {{ ganglia_gmond_cluster_port }} -j ACCEPT
|
|
|
|
{% endif %}
|
2015-10-07 14:48:22 +02:00
|
|
|
{% endif %}
|
2018-01-25 20:17:58 +01:00
|
|
|
# Postfix
|
2015-10-15 18:42:08 +02:00
|
|
|
{% if postfix_relay_server is defined %}
|
2015-10-10 09:03:24 +02:00
|
|
|
{% if postfix_relay_server %}
|
2015-05-28 11:32:57 +02:00
|
|
|
#
|
|
|
|
# These are only needed on the machines that act as relay servers
|
|
|
|
#
|
|
|
|
-A INPUT -p tcp -m multiport --dports 25,587,465 -s {{ network.nmis }} -j ACCEPT
|
|
|
|
-A OUTPUT -p tcp -m multiport --dports 25,587,465 -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
|
|
|
|
{% if postfix_use_relay_host is defined and postfix_use_relay_host %}
|
|
|
|
-A OUTPUT -p tcp -m multiport --dports 25,587,465 -m owner --gid-owner postfix -d {{ postfix_relay_host }} -j ACCEPT
|
|
|
|
{% else %}
|
|
|
|
-A OUTPUT -p tcp -m multiport --dports 25,587,465 -m owner --gid-owner postfix -j ACCEPT
|
|
|
|
{% endif %}
|
|
|
|
-A OUTPUT -p tcp -m multiport --dports 25,587,465 -m state --state NEW -j LOG --log-prefix "LOCAL_DROPPED_SPAM " --log-uid
|
|
|
|
-A OUTPUT -p tcp -m multiport --dports 25,587,465 -j DROP
|
|
|
|
{% endif %}
|
2015-10-15 18:42:08 +02:00
|
|
|
{% endif %}
|
|
|
|
{% if postfix_relay_server is defined and not postfix_relay_server %}
|
|
|
|
{% if postfix_relay_client is defined%}
|
2015-10-12 11:13:53 +02:00
|
|
|
{% if postfix_relay_client %}
|
2015-05-28 11:32:57 +02:00
|
|
|
#
|
|
|
|
# When we are not a relay server but we want send email using our relay
|
|
|
|
-A OUTPUT -p tcp -m multiport --dports 25,587,465 -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
|
|
|
|
-A OUTPUT -p tcp -m multiport --dports 25,587,465 -m owner --gid-owner postfix -d {{ postfix_relay_host }} -j ACCEPT
|
|
|
|
-A OUTPUT -p tcp -m multiport --dports 25,587,465 -m state --state NEW -j LOG --log-prefix "LOCAL_DROPPED_SPAM " --log-uid
|
|
|
|
-A OUTPUT -p tcp -m multiport --dports 25,587,465 -j DROP
|
|
|
|
{% endif %}
|
2015-10-12 11:13:53 +02:00
|
|
|
{% endif %}
|
2015-10-15 18:42:08 +02:00
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% if iptables is defined %}
|
|
|
|
{% if iptables.tcp_rules is defined and iptables.tcp_rules %}
|
2016-06-11 15:24:48 +02:00
|
|
|
# TCP rules
|
2015-05-28 11:32:57 +02:00
|
|
|
{% for tcp_rule in iptables.tcp %}
|
|
|
|
{% if tcp_rule.allowed_hosts is defined %}
|
|
|
|
{% for ip in tcp_rule.allowed_hosts %}
|
2017-10-20 17:46:21 +02:00
|
|
|
{% if ip is string %}
|
2015-05-28 11:32:57 +02:00
|
|
|
-A INPUT -m state --state NEW -s {{ ip }} -p tcp -m tcp --dport {{ tcp_rule.port }} -j ACCEPT
|
2017-10-20 17:46:21 +02:00
|
|
|
{% else %}
|
|
|
|
{% for ip_really in ip %}
|
|
|
|
-A INPUT -m state --state NEW -s {{ ip_really }} -p tcp -m tcp --dport {{ tcp_rule.port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
-A INPUT -m state --state NEW -m tcp -p tcp --dport {{ tcp_rule.port }} -j ACCEPT
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
{% if iptables.udp_rules is defined and iptables.udp_rules %}
|
2016-06-11 15:24:48 +02:00
|
|
|
# UDP rules
|
2015-05-28 11:32:57 +02:00
|
|
|
{% for udp_rule in iptables.udp %}
|
|
|
|
{% if udp_rule.allowed_hosts is defined %}
|
|
|
|
{% for ip in udp_rule.allowed_hosts %}
|
2017-10-20 17:46:21 +02:00
|
|
|
{% if ip is string %}
|
2015-05-28 11:32:57 +02:00
|
|
|
-A INPUT -s {{ ip }} -p udp -m udp --dport {{ udp_rule.port }} -j ACCEPT
|
2017-10-20 17:46:21 +02:00
|
|
|
{% else %}
|
|
|
|
{% for ip_really in ip %}
|
|
|
|
-A INPUT -s {{ ip_really }} -p udp -m udp --dport {{ udp_rule.port }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
-A INPUT -p udp -m udp --dport {{ udp_rule.port }} -j ACCEPT
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2016-12-14 16:09:39 +01:00
|
|
|
{% if iptables.any_rules is defined and iptables.any_rules %}
|
|
|
|
# ANY rules
|
|
|
|
{% for any_rule in iptables.any %}
|
|
|
|
{% for ip in any_rule.allowed_hosts %}
|
|
|
|
-A INPUT -s {{ ip }} -j ACCEPT
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2016-12-14 18:32:05 +01:00
|
|
|
# End of the custom rules
|
|
|
|
{% endif %}
|
2016-07-05 18:29:03 +02:00
|
|
|
{% if keepalived_enabled is defined and keepalived_enabled %}
|
|
|
|
-A INPUT -p vrrp -d {{ keepalived_mcast_addr }} -j ACCEPT
|
|
|
|
-A OUTPUT -p vrrp -d {{ keepalived_mcast_addr }} -j ACCEPT
|
|
|
|
{% endif %}
|
2015-05-28 11:32:57 +02:00
|
|
|
#
|
2016-06-11 15:24:48 +02:00
|
|
|
{% if iptables_input_default_policy == 'REJECT' %}
|
2015-05-28 11:32:57 +02:00
|
|
|
-A INPUT -j REJECT --reject-with icmp-host-prohibited
|
2016-06-11 15:24:48 +02:00
|
|
|
{% else %}
|
|
|
|
-A INPUT -j {{ iptables_input_default_policy }}
|
|
|
|
{% endif %}
|
|
|
|
{% if not iptables_nat_enabled %}
|
|
|
|
{% if iptables_forward_default_policy == 'REJECT' %}
|
2015-05-28 11:32:57 +02:00
|
|
|
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
|
|
|
|
{% else %}
|
2016-06-11 15:24:48 +02:00
|
|
|
-A FORWARD -j {{ iptables_forward_default_policy }}
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
# NAT is enabled, we need to accept traffic that is forwarded
|
|
|
|
-A FORWARD -j ACCEPT
|
2016-06-11 16:56:12 +02:00
|
|
|
{% endif %}
|
|
|
|
COMMIT
|
|
|
|
{% if iptables_nat_enabled %}
|
2016-06-11 15:24:48 +02:00
|
|
|
# NAT rules
|
|
|
|
*nat
|
2016-06-11 16:56:12 +02:00
|
|
|
:PREROUTING ACCEPT [0:0]
|
|
|
|
:INPUT ACCEPT [0:0]
|
|
|
|
:OUTPUT ACCEPT [0:0]
|
|
|
|
:POSTROUTING ACCEPT [0:0]
|
2016-06-11 15:24:48 +02:00
|
|
|
{% if iptables_nat_specify_interfaces %}
|
2016-06-11 16:56:12 +02:00
|
|
|
{% for int in iptables_nat_interfaces %}
|
2016-06-11 15:24:48 +02:00
|
|
|
-A POSTROUTING -o {{ int }} -j MASQUERADE
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
-A POSTROUTING -j MASQUERADE
|
2015-05-28 11:32:57 +02:00
|
|
|
{% endif %}
|
|
|
|
COMMIT
|
2016-06-11 16:56:12 +02:00
|
|
|
{% endif %}
|