roles/dch-gw: Configure the filter table
The *filter* table is responsible for deciding which packets will be accepted and which will be rejected. It has three chains, which classify packets according to whether they are destined for the local machine (input), passing through this machine (forward) or originating from the local machine (output). The *dch-gw* role now configures all three chains in this table. For now, it defines basic rules, mostly based on TCP/UDP destination port: * Traffic destined for a service hosted by the local machine (DNS, DHCP, SSH), is allowed if it does not come from the Internet * Traffic passing through the machine is allowed if: * It is passing between internal networks * It is destined for a host on the FireMon network (VPN) * It was NATed to in internal host (marked 323) * It is destined for the Internet * Only DHCP, HTTP, and DNS are allowed to originate from the local machine This configuration requires an `internet_iface` variable, which indicates the name of the network interface connected to the Internet directly.
This commit is contained in:
31
roles/dch-gw/templates/outgoing.nft.j2
Normal file
31
roles/dch-gw/templates/outgoing.nft.j2
Normal file
@@ -0,0 +1,31 @@
|
||||
{#- vim: set sw=4 ts=4 sts=4 et : #}
|
||||
table inet filter {
|
||||
set allow_tcp_out {
|
||||
type inet_service
|
||||
flags interval
|
||||
elements = {
|
||||
{% for item in allow_outgoing if item.protocol|d('tcp') == 'tcp' %}
|
||||
{{ item.port }},
|
||||
{% endfor %}
|
||||
}
|
||||
}
|
||||
|
||||
set allow_udp_out {
|
||||
type inet_service
|
||||
flags interval
|
||||
elements = {
|
||||
{% for item in allow_outgoing if item.protocol|d('tcp') == 'udp' %}
|
||||
{{ item.port }},
|
||||
{% endfor %}
|
||||
}
|
||||
}
|
||||
|
||||
chain output {
|
||||
ct state established,related accept
|
||||
oif lo accept
|
||||
ip6 nexthdr ipv6-icmp accept
|
||||
ip protocol icmp accept
|
||||
tcp dport @allow_tcp_out ct state new counter accept
|
||||
udp dport @allow_udp_out ct state new counter accept
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user