12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- {% 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.networks is defined %} saddr ({{ fwconf.networks | join(' ') }}){% 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;
- {% if firewall_private is defined %}
- {% for fwconf in firewall_private %}
- {% if fwconf.users is defined %}
- # Private networks configuration
- mod owner uid-owner ({{ fwconf.users | join(' ') }}) outerface {{ fwconf.interface }} ACCEPT;
- outerface {{ fwconf.interface }} DROP;
- {% endif %}
- {% endfor %}
- {% endif %}
- }
- 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 local packet
- interface lo 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;
- }
- }
|