]> git.openstreetmap.org Git - chef.git/commitdiff
Add routes to wireguard peers
authorTom Hughes <tom@compton.nu>
Mon, 14 Sep 2020 16:32:15 +0000 (17:32 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 14 Sep 2020 16:32:15 +0000 (17:32 +0100)
cookbooks/networking/templates/default/wireguard.network.erb

index 636f2867affb650d163a3d04015ea6a5e2794165..b8114382ca95519844db9ce3c6c3fb624acdf0bb 100644 (file)
@@ -6,3 +6,12 @@ Address=<%= node[:networking][:wireguard][:address] %>/128
 
 [Route]
 Destination=fd43:e709:ea6d:1::/64
+<% node[:networking][:wireguard][:peers].each do |peer| -%>
+<% Array(peer[:allowed_ips]).sort.each do |ip| -%>
+<% unless ip =~ /^fd43:e709:ea6d:1::/ -%>
+
+[Route]
+Destination=<%= ip %>
+<% end -%>
+<% end -%>
+<% end -%>