From 794eb56bac4d0839e3e58467a964a54a5e4ea5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sun, 23 Feb 2025 23:13:32 +0100 Subject: [PATCH] module: add basic proxy outpost service --- module.nix | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/module.nix b/module.nix index 5d8a117..39f735c 100644 --- a/module.nix +++ b/module.nix @@ -128,6 +128,29 @@ in }; }; + # Proxy oupost + authentik-proxy = { + enable = mkEnableOption "authentik Proxy outpost"; + + environmentFile = mkOption { + type = types.nullOr pathToSecret; + default = null; + example = "/run/secrets/authentik-proxy/authentik-proxy-env"; + description = '' + Environment file as defined in {manpage}`systemd.exec(5)`. + + Secrets may be passed to the service without adding them to the world-readable + /nix/store, by specifying the desied secrets as environment variables according + to the authentic documentation. + + ``` + # example content + AUTHENTIK_TOKEN= + ``` + ''; + }; + }; + # RADIUS oupost authentik-radius = { enable = mkEnableOption "authentik RADIUS outpost"; @@ -356,6 +379,32 @@ in } )) + # Proxy outpost + (mkIf config.services.authentik-proxy.enable ( + let + cfg = config.services.authentik-proxy; + in + { + systemd.services.authentik-proxy = { + wantedBy = [ "multi-user.target" ]; + wants = [ "network-online.target" ]; + after = [ + "network-online.target" + "authentik.service" + ]; + serviceConfig = { + RuntimeDirectory = "authentik-proxy"; + UMask = "0027"; + WorkingDirectory = "%t/authentik-proxy"; + DynamicUser = true; + ExecStart = "${config.services.authentik.authentikComponents.gopkgs}/bin/proxy"; + EnvironmentFile = mkIf (cfg.environmentFile != null) [ cfg.environmentFile ]; + Restart = "on-failure"; + }; + }; + } + )) + # RADIUS outpost (mkIf config.services.authentik-radius.enable ( let