X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/c30bf38a3bc31371fd5a9da3ebc383bd6236b4d3..7f5c025954a0868b7ac2aea8722089e75c39668e:/cookbooks/networking/recipes/default.rb?ds=sidebyside diff --git a/cookbooks/networking/recipes/default.rb b/cookbooks/networking/recipes/default.rb index 4fc08a61b..8eed59556 100644 --- a/cookbooks/networking/recipes/default.rb +++ b/cookbooks/networking/recipes/default.rb @@ -236,6 +236,22 @@ if node[:networking][:wireguard][:enabled] } end + search(:node, "roles:mail") do |server| + allowed_ips = server.interfaces(:role => :internal).map do |interface| + "#{interface[:network]}/#{interface[:prefix]}" + end + + if server[:networking][:private_address] + allowed_ips << "#{server[:networking][:private_address]}/32" + end + + node.default[:networking][:wireguard][:peers] << { + :public_key => server[:networking][:wireguard][:public_key], + :allowed_ips => allowed_ips, + :endpoint => "#{server.name}:51820" + } + end + node.default[:networking][:wireguard][:peers] << { :public_key => "7Oj9ufNlgidyH/xDc+aHQKMjJPqTmD/ab13agMh6AxA=", :allowed_ips => "10.0.16.1/32", @@ -327,9 +343,8 @@ template "/etc/systemd/resolved.conf.d/99-chef.conf" do end if node[:filesystem][:by_mountpoint][:"/etc/resolv.conf"] - mount "/etc/resolv.conf" do - action :umount - device node[:filesystem][:by_mountpoint][:"/etc/resolv.conf"][:devices].first + execute "umount-resolve-conf" do + command "umount -c /etc/resolv.conf" end end @@ -413,7 +428,6 @@ template "/etc/shorewall/policy" do end template "/etc/shorewall/rules" do - action :nothing source "shorewall-rules.erb" owner "root" group "root" @@ -422,22 +436,19 @@ template "/etc/shorewall/rules" do notifies :restart, "service[shorewall]" end -notify_group "shorewall-rules" do - action :run - notifies :create, "template[/etc/shorewall/rules]" -end - if node[:networking][:firewall][:enabled] service "shorewall" do action [:enable, :start] supports :restart => true status_command "shorewall status" + ignore_failure true end else service "shorewall" do action [:disable, :stop] supports :restart => true status_command "shorewall status" + ignore_failure true end end @@ -554,7 +565,6 @@ unless node.interfaces(:family => :inet6).empty? end template "/etc/shorewall6/rules" do - action :nothing source "shorewall-rules.erb" owner "root" group "root" @@ -563,22 +573,19 @@ unless node.interfaces(:family => :inet6).empty? notifies :restart, "service[shorewall6]" end - notify_group "shorewall6-rules" do - action :run - notifies :create, "template[/etc/shorewall6/rules]" - end - if node[:networking][:firewall][:enabled] service "shorewall6" do action [:enable, :start] supports :restart => true status_command "shorewall6 status" + ignore_failure true end else service "shorewall6" do action [:disable, :stop] supports :restart => true status_command "shorewall6 status" + ignore_failure true end end