aboutsummaryrefslogtreecommitdiff
path: root/modules/profile
diff options
context:
space:
mode:
Diffstat (limited to 'modules/profile')
-rw-r--r--modules/profile/files/kerberos/krb5_client.conf12
-rw-r--r--modules/profile/manifests/kerberos/client.pp7
-rw-r--r--modules/profile/manifests/wireguard.pp40
-rw-r--r--modules/profile/templates/wireguard/network.conf.erb19
4 files changed, 78 insertions, 0 deletions
diff --git a/modules/profile/files/kerberos/krb5_client.conf b/modules/profile/files/kerberos/krb5_client.conf
new file mode 100644
index 0000000..3fce983
--- /dev/null
+++ b/modules/profile/files/kerberos/krb5_client.conf
@@ -0,0 +1,12 @@
1[libdefaults]
2 default_realm = IMMAE.EU
3
4[realms]
5 IMMAE.EU = {
6 kdc = kerberos.immae.eu
7 admin_server = kerberos.immae.eu
8 }
9
10[domain_realm]
11 immae.eu = IMMAE.EU
12 .immae.eu = IMMAE.EU
diff --git a/modules/profile/manifests/kerberos/client.pp b/modules/profile/manifests/kerberos/client.pp
new file mode 100644
index 0000000..1f1f2cd
--- /dev/null
+++ b/modules/profile/manifests/kerberos/client.pp
@@ -0,0 +1,7 @@
1class profile::kerberos::client {
2 ensure_packages(["krb5", "cyrus-sasl-gssapi"])
3
4 file { "/etc/krb5.conf":
5 source => "puppet:///modules/profile/kerberos/krb5_client.conf"
6 }
7}
diff --git a/modules/profile/manifests/wireguard.pp b/modules/profile/manifests/wireguard.pp
new file mode 100644
index 0000000..829f82d
--- /dev/null
+++ b/modules/profile/manifests/wireguard.pp
@@ -0,0 +1,40 @@
1class profile::wireguard (
2) {
3 $password_seed = lookup("base_installation::puppet_pass_seed")
4
5 ensure_packages(["linux-headers"], { before => Package["wireguard-dkms"] })
6 ensure_packages(["wireguard-tools", "wireguard-dkms"])
7
8 $host = $facts["ldapvar"]["self"]
9 if has_key($host["vars"], "wireguard_ip") {
10 $ips = $host["vars"]["wireguard_ip"]
11 } else {
12 $ips = []
13 }
14
15 $private_key = generate_password(32, $password_seed, "wireguard", "curve25519", true)
16
17 if file("/usr/bin/wg", "/dev/null") != "" {
18 $puppet_notifies_path = lookup("base_installation::puppet_notifies_path")
19 $public_key = generate("/usr/bin/bash", "-c", "echo $private_key | /usr/bin/wg pubkey")
20 concat::fragment { "host_ldap add wireguard":
21 target => "$puppet_notifies_path/host_ldap.info",
22 content => "puppetVar: wireguard_public=$public_key",
23 order => "00-80"
24 }
25 }
26
27 file { "/etc/wireguard/network.conf":
28 ensure => "file",
29 mode => "0600",
30 content => template("profile/wireguard/network.conf.erb"),
31 require => [Package["wireguard-tools"], Package["wireguard-dkms"]],
32 notify => Service["wg-quick@network"],
33 }
34 ->
35 service { "wg-quick@network":
36 ensure => "running",
37 enable => true,
38 }
39
40}
diff --git a/modules/profile/templates/wireguard/network.conf.erb b/modules/profile/templates/wireguard/network.conf.erb
new file mode 100644
index 0000000..5327dfd
--- /dev/null
+++ b/modules/profile/templates/wireguard/network.conf.erb
@@ -0,0 +1,19 @@
1[Interface]
2<%- @ips.each do |ip| -%>
3Address = <%= ip %>
4<%- end -%>
5PrivateKey = <%= @private_key %>
6ListenPort = 51820
7
8<%- @facts["ldapvar"]["other"].each do |host| -%>
9<%- if (host["vars"]["wireguard_public"] || []).count > 0 %>
10[Peer]
11# <%= host["vars"]["real_hostname"][0] %>
12PublicKey = <%= host["vars"]["wireguard_public"][0] %>
13<%- if (host["vars"]["wireguard_ip"] || []).count > 0 -%>
14AllowedIps = <%= host["vars"]["wireguard_ip"].join(", ").gsub /\/\d+/, "/32" %>
15<%- end -%>
16Endpoint = <%= host["vars"]["real_hostname"][0] %>:51820
17
18<% end -%>
19<%- end -%>