From 7f8c632757246813c0a9fdbf0c26ef036ff396be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 14 Aug 2018 19:23:47 +0200 Subject: Add wireguard profile --- modules/profile/templates/wireguard/network.conf.erb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 modules/profile/templates/wireguard/network.conf.erb (limited to 'modules/profile/templates/wireguard/network.conf.erb') diff --git a/modules/profile/templates/wireguard/network.conf.erb b/modules/profile/templates/wireguard/network.conf.erb new file mode 100644 index 0000000..0528050 --- /dev/null +++ b/modules/profile/templates/wireguard/network.conf.erb @@ -0,0 +1,13 @@ +[Interface] +<%- @ips.each do |ip| %> +Address = <%= ip %> +<% end -%> +PrivateKey = <%= @private_key %> + +<%- @facts["ldapvar"]["other"].each do |host| -%> +<%- if (host["vars"]["wireguard_public"] || []).count > 0 %> +[Peer] +PublicKey = host["vars"]["wireguard_public"][0] + +<% end -%> +<%- end -%> -- cgit v1.2.3 From cfad76106ad85e170c08a196e7e365a78293aa7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 17 Aug 2018 12:51:55 +0200 Subject: Add wireguard to host_ldap --- modules/profile/templates/wireguard/network.conf.erb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'modules/profile/templates/wireguard/network.conf.erb') diff --git a/modules/profile/templates/wireguard/network.conf.erb b/modules/profile/templates/wireguard/network.conf.erb index 0528050..5327dfd 100644 --- a/modules/profile/templates/wireguard/network.conf.erb +++ b/modules/profile/templates/wireguard/network.conf.erb @@ -1,13 +1,19 @@ [Interface] -<%- @ips.each do |ip| %> +<%- @ips.each do |ip| -%> Address = <%= ip %> -<% end -%> +<%- end -%> PrivateKey = <%= @private_key %> +ListenPort = 51820 <%- @facts["ldapvar"]["other"].each do |host| -%> <%- if (host["vars"]["wireguard_public"] || []).count > 0 %> [Peer] -PublicKey = host["vars"]["wireguard_public"][0] +# <%= host["vars"]["real_hostname"][0] %> +PublicKey = <%= host["vars"]["wireguard_public"][0] %> +<%- if (host["vars"]["wireguard_ip"] || []).count > 0 -%> +AllowedIps = <%= host["vars"]["wireguard_ip"].join(", ").gsub /\/\d+/, "/32" %> +<%- end -%> +Endpoint = <%= host["vars"]["real_hostname"][0] %>:51820 <% end -%> <%- end -%> -- cgit v1.2.3