default[:networking][:firewall][:outgoing] = []
default[:networking][:firewall][:http_rate_limit] = "-"
default[:networking][:firewall][:http_connection_limit] = "-"
-default[:networking][:firewall][:whitelist] = []
+default[:networking][:firewall][:allowlist] = []
default[:networking][:roles] = {}
default[:networking][:interfaces] = {}
default[:networking][:nameservers] = %w[8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844]
end
stop_commands = [
- "/usr/sbin/nft delete table inet filter"
+ "-/usr/sbin/nft delete table inet filter",
+ "-/usr/sbin/nft delete table inet chef-filter"
]
-stop_commands << "/usr/sbin/nft delete table ip nat" if node[:roles].include?("gateway")
+stop_commands << "-/usr/sbin/nft delete table ip nat" if node[:roles].include?("gateway")
+stop_commands << "-/usr/sbin/nft delete table ip chef-nat" if node[:roles].include?("gateway")
systemd_service "nftables-stop" do
service "nftables"
define ip-private-addresses = { 0.0.0.0, 10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.2.0/24, 192.168.0.0/16, 224.0.0.0/4 }
define ip6-private-addresses = { 2001:db8::/32, fc00::/7, ff00::/8 }
-table inet filter {
+table inet chef-filter {
set ip-osm-addresses {
type ipv4_addr
<%- unless Array(@hosts["inet"]).empty? %>
<%- end %>
}
- set ip-blacklist {
+ set ip-blocklist {
type ipv4_addr
flags dynamic
}
- set ip6-blacklist {
+ set ip6-blocklist {
type ipv6_addr
flags dynamic
}
}
chain incoming {
-<%- if node[:networking][:firewall][:whitelist].empty? %>
+<%- if node[:networking][:firewall][:allowlist].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
+ ip saddr { $ip-private-addresses } ip saddr != { <%= node[:networking][:firewall][:allowlist].sort.join(", ") %> } jump log-and-drop
<%- end %>
ip6 saddr { $ip6-private-addresses } jump log-and-drop
- ip saddr @ip-blacklist jump log-and-drop
- ip6 saddr @ip6-blacklist jump log-and-drop
+ ip saddr @ip-blocklist jump log-and-drop
+ ip6 saddr @ip6-blocklist jump log-and-drop
ct state { established, related } accept
}
chain outgoing {
-<%- if node[:networking][:firewall][:whitelist].empty? %>
+<%- if node[:networking][:firewall][:allowlist].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
+ ip daddr { $ip-private-addresses } ip daddr != { <%= node[:networking][:firewall][:allowlist].sort.join(", ") %> } jump log-and-drop
<%- end %>
ip6 daddr { $ip6-private-addresses } jump log-and-drop
}
<%- if node[:roles].include?("gateway") %>
-table ip nat {
+table ip chef-nat {
chain postrouting {
type nat hook postrouting priority srcnat;