flags dynamic
}
- set limit-icmp-echo-ip {
+ set ratelimit-icmp-echo-ip {
type ipv4_addr
flags dynamic
+ timeout 120s
}
- set limit-icmp-echo-ip6 {
+ set ratelimit-icmp-echo-ip6 {
type ipv6_addr
flags dynamic
+ timeout 120s
}
<%- node[:networking][:firewall][:sets].each do |set| %>
type ipv6_addr
<%- end %>
flags dynamic
+<%- unless set.start_with?("connlimit-") %>
+ timeout 120s
+<%- end %>
}
<%- end %>
}
chain incoming {
+<%- if node[:networking][:firewall][:whitelist].empty? %>
ip saddr { $ip-private-addresses } jump log-and-drop
+<%- else %>
+ ip saddr { $ip-private-addresses } ip saddr != { <%= node[:networking][:firewall][:whitelist].sort.join(", ") %> } jump log-and-drop
+<%- end %>
ip6 saddr { $ip6-private-addresses } jump log-and-drop
ip saddr @ip-blacklist jump log-and-drop
ct state { established, related } accept
icmp type { destination-unreachable } accept
- icmp type { echo-request } add @limit-icmp-echo-ip { ip saddr limit rate 1/second } accept
+ icmp type { echo-request } update @ratelimit-icmp-echo-ip { ip saddr limit rate 1/second } accept
icmp type { echo-request } drop
icmpv6 type { nd-neighbor-solicit, nd-neighbor-advert, nd-router-solicit, nd-router-advert } accept
- icmpv6 type { echo-request } add @limit-icmp-echo-ip6 { ip6 saddr limit rate 1/second } accept
+ icmpv6 type { echo-request } update @ratelimit-icmp-echo-ip6 { ip6 saddr limit rate 1/second } accept
icmpv6 type { echo-request } drop
meta l4proto { icmp, icmpv6 } jump log-and-drop
}
chain outgoing {
+<%- if node[:networking][:firewall][:whitelist].empty? %>
ip daddr { $ip-private-addresses } jump log-and-drop
+<%- else %>
+ ip daddr { $ip-private-addresses } ip daddr != { <%= node[:networking][:firewall][:whitelist].sort.join(", ") %> } jump log-and-drop
+<%- end %>
ip6 daddr { $ip6-private-addresses } jump log-and-drop
<%- node[:networking][:firewall][:outgoing].each do |rule| %>
type filter hook input priority filter;
<%- unless @interfaces.empty? %>
- iif { $external-interfaces } jump incoming
+ iifname { $external-interfaces } jump incoming
<%- end %>
accept
type filter hook forward priority filter;
<%- unless @interfaces.empty? %>
- iif { $external-interfaces } jump incoming
- oif { $external-interfaces } jump outgoing
+ iifname { $external-interfaces } jump incoming
+ oifname { $external-interfaces } jump outgoing
<%- end %>
accept
type filter hook output priority filter;
<%- unless @interfaces.empty? %>
- oif { $external-interfaces } jump outgoing
+ oifname { $external-interfaces } jump outgoing
<%- end %>
accept
<%- node.interfaces(:role => :external, :family => :inet).each do |external| %>
<%- node.interfaces(:role => :internal, :family => :inet).each do |internal| %>
- oif { <%= external[:interface] %> } ip saddr { <%= internal[:network] %>/<%= internal[:prefix] %> } snat <%= external[:address] %>
+ oifname { <%= external[:interface] %> } ip saddr { <%= internal[:network] %>/<%= internal[:prefix] %> } snat <%= external[:address] %>
<%- end %>
<%- end %>
}