X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/d1b835abf6c54e768ead54dd0056011554ba0b71..dda82d79b5db092e3b7d436efe42a2ab4e15077f:/cookbooks/exim/recipes/default.rb diff --git a/cookbooks/exim/recipes/default.rb b/cookbooks/exim/recipes/default.rb index 6234aa964..994e9454b 100644 --- a/cookbooks/exim/recipes/default.rb +++ b/cookbooks/exim/recipes/default.rb @@ -76,6 +76,18 @@ end relay_from_hosts = node[:exim][:relay_from_hosts] if node[:exim][:smarthost_name] + search(:node, "roles:gateway") do |gateway| + allowed_ips = gateway.interfaces(:role => :internal).map do |interface| + "#{interface[:network]}/#{interface[:prefix]}" + end + + node.default[:networking][:wireguard][:peers] << { + :public_key => gateway[:networking][:wireguard][:public_key], + :allowed_ips => allowed_ips, + :endpoint => "#{gateway.name}:51820" + } + end + search(:node, "exim_smarthost_via:#{node[:exim][:smarthost_name]}\\:*").each do |host| relay_from_hosts |= host.ipaddresses(:role => :external) end