From 00291f7e9f0415bf9fb53955eb83e5567a13bf77 Mon Sep 17 00:00:00 2001 From: halcyon <55317573+hxlcyxn@users.noreply.github.com> Date: Fri, 2 Dec 2022 14:25:55 +0100 Subject: [PATCH] basic ldap/portunus config - config im moment nur auf meiner infra funktionstauglich, login auf website funktioniert - keine integrations getestet --- modules/ldap.nix | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 modules/ldap.nix diff --git a/modules/ldap.nix b/modules/ldap.nix new file mode 100644 index 0000000..fe4c3b0 --- /dev/null +++ b/modules/ldap.nix @@ -0,0 +1,53 @@ +{config, ...}: let + # temporary url, zum testen auf laptop zuhause + tld = "moe"; + hostname = "eisvogel"; + domain = "portunus.${hostname}.${tld}"; +in { + # TODO: acme/letsencrypt oder andere lösung? + # + services.nginx = { + enable = true; + virtualHosts."${domain}" = { + forceSSL = true; + enableACME = true; + locations = { + "/".proxyPass = "http://localhost:${toString config.services.portunus.port}"; + "/dex".proxyPass = "http://localhost:${toString config.services.portunus.dex.port}"; + }; + }; + }; + + services.portunus = { + enable = true; + domain = "${domain}"; + ldap = { + suffix = "dc=${hostname},dc=${tld}"; + tls = true; + }; + + # TODO: siehe unten sops, statische config + # seedPath = ""; + + # falls wir das brauchen + # dex = { + # enable = true; + # ... + # }; + # searchUserName = "xxx"; + }; + + users.ldap = { + enable = true; + server = "ldaps://${domain}"; + base = "dc=${hostname},dc=${tld}"; + # useTLS = true; # nicht noetig weil ldaps domain festgelegt. wuerde sonst starttls auf port 389 versuchen + }; + + networking.firewall.allowedTCPPorts = [ + 80 # http + 443 # https + 636 # ldaps + ]; + # TODO: sops zeug, keine ahnung wie das (ordentlich) gemacht wird/gemacht werden soll +}