Skip to content

Commit 9bc67dc

Browse files
Victor NawothnigVictor Nawothnig
authored andcommitted
Add RAC outpost
1 parent 69fac05 commit 9bc67dc

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

components/gopkgs.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
buildGo124Module,
66
lib,
77
makeWrapper,
8+
guacamole-server,
89
}:
910

1011
buildGo124Module {
@@ -14,6 +15,9 @@ buildGo124Module {
1415
sed -i"" -e 's,./web/dist/,${authentikComponents.frontend}/dist/,' web/static.go
1516
sed -i"" -e 's,./web/dist/,${authentikComponents.frontend}/dist/,' internal/web/static.go
1617
sed -i"" -e 's,./lifecycle/gunicorn.conf.py,${authentikComponents.staticWorkdirDeps}/lifecycle/gunicorn.conf.py,' internal/gounicorn/gounicorn.go
18+
substituteInPlace internal/outpost/rac/guacd.go \
19+
--replace-fail '/opt/guacamole/sbin/guacd' \
20+
"${lib.getExe guacamole-server}/"
1721
'';
1822
src = lib.cleanSourceWith {
1923
src = authentik-src;
@@ -41,6 +45,7 @@ buildGo124Module {
4145
"cmd/server"
4246
"cmd/proxy"
4347
"cmd/radius"
48+
"cmd/rac"
4449
];
4550
vendorHash = "sha256-wTTEDBRYCW1UFaeX49ufLT0c17sacJzcCaW/8cPNYR4=";
4651
nativeBuildInputs = [ makeWrapper ];

module.nix

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,29 @@ in
204204
};
205205
};
206206

207+
# RAC oupost
208+
authentik-rac = {
209+
enable = mkEnableOption "authentik RAC outpost";
210+
211+
environmentFile = mkOption {
212+
type = types.nullOr pathToSecret;
213+
default = null;
214+
example = "/run/secrets/authentik-rac/authentik-rac-env";
215+
description = ''
216+
Environment file as defined in {manpage}`systemd.exec(5)`.
217+
218+
Secrets may be passed to the service without adding them to the world-readable
219+
/nix/store, by specifying the desied secrets as environment variables according
220+
to the authentic documentation.
221+
222+
```
223+
# example content
224+
AUTHENTIK_TOKEN=<token from authentik for this outpost>
225+
```
226+
'';
227+
};
228+
};
229+
207230
# RADIUS oupost
208231
authentik-radius = {
209232
enable = mkEnableOption "authentik RADIUS outpost";
@@ -497,6 +520,32 @@ in
497520
}
498521
))
499522

523+
# RAC outpost
524+
(mkIf config.services.authentik-rac.enable (
525+
let
526+
cfg = config.services.authentik-rac;
527+
in
528+
{
529+
systemd.services.authentik-rac = {
530+
wantedBy = [ "multi-user.target" ];
531+
wants = [ "network-online.target" ];
532+
after = [
533+
"network-online.target"
534+
"authentik.service"
535+
];
536+
serviceConfig = {
537+
RuntimeDirectory = "authentik-rac";
538+
UMask = "0027";
539+
WorkingDirectory = "%t/authentik-rac";
540+
DynamicUser = true;
541+
ExecStart = "${config.services.authentik.authentikComponents.gopkgs}/bin/rac";
542+
EnvironmentFile = mkIf (cfg.environmentFile != null) [ cfg.environmentFile ];
543+
Restart = "on-failure";
544+
};
545+
};
546+
}
547+
))
548+
500549
# RADIUS outpost
501550
(mkIf config.services.authentik-radius.enable (
502551
let

0 commit comments

Comments
 (0)