123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- {% if ansible_prolog -%}
- {% from 'templates/ansible/prolog.j2' import prolog with context %}
- {{ prolog() }}
- {% endif -%}
- #
- # Configuration file for ferm(1).
- #
- @def $PORTS = ({{ firewall_public | join(' ') }}); # Services running worldwide
- table filter {
- chain INPUT {
- policy DROP;
- # connection tracking
- mod state state INVALID DROP;
- mod state state (ESTABLISHED RELATED) ACCEPT;
- # allow local packet
- interface lo ACCEPT;
- # respond to ping
- proto icmp icmp-type echo-request ACCEPT;
- # standard ports we allow from the outside
- proto (udp tcp) dport $PORTS ACCEPT;
- {% if firewall_private is defined %}
- # Private networks configuration
- {% for fwconf in firewall_private %}
- interface {{ fwconf.interface }}{% if fwconf.network is defined %} saddr {{ fwconf.network }}{% endif %} {
- proto (udp tcp) dport ({{ fwconf.ports | join(' ') }}) ACCEPT;
- }
- {% endfor %}
- {% endif %}
- }
- chain OUTPUT {
- policy ACCEPT;
- # connection tracking
- #mod state state INVALID DROP;
- mod state state (ESTABLISHED RELATED) ACCEPT;
- }
- chain FORWARD {
- policy DROP;
- # connection tracking
- mod state state INVALID DROP;
- mod state state (ESTABLISHED RELATED) ACCEPT;
- }
- }
- domain ip6 table filter {
- chain INPUT {
- policy DROP;
- # connection tracking
- mod state state INVALID DROP;
- mod state state (ESTABLISHED RELATED) ACCEPT;
- # allow ICMP (for neighbor solicitation, like ARP for IPv4)
- proto ipv6-icmp ACCEPT;
- # standard ports we allow from the outside
- proto tcp dport $PORTS ACCEPT;
- }
- chain OUTPUT {
- policy ACCEPT;
- # connection tracking
- #mod state state INVALID DROP;
- mod state state (ESTABLISHED RELATED) ACCEPT;
- }
- chain FORWARD {
- policy DROP;
- # connection tracking
- mod state state INVALID DROP;
- mod state state (ESTABLISHED RELATED) ACCEPT;
- }
- }
|