Skip to content

Commit b6b13ab

Browse files
Victor NawothnigMa27
andcommitted
Add RAC outpost
Co-authored-by: Maximilian Bosch <[email protected]>
1 parent 3082a94 commit b6b13ab

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

components/gopkgs.nix

Lines changed: 8 additions & 1 deletion
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,12 +45,14 @@ buildGo124Module {
4145
"ldap"
4246
"proxy"
4347
"radius"
48+
"rac"
4449
];
4550
subPackages = [
4651
"cmd/ldap"
4752
"cmd/server"
4853
"cmd/proxy"
4954
"cmd/radius"
55+
"cmd/rac"
5056
];
5157
vendorHash = "sha256-wTTEDBRYCW1UFaeX49ufLT0c17sacJzcCaW/8cPNYR4=";
5258
nativeBuildInputs = [ makeWrapper ];
@@ -55,9 +61,10 @@ buildGo124Module {
5561
wrapProgram $out/bin/server --prefix PATH : ${authentikComponents.pythonEnv}/bin
5662
wrapProgram $out/bin/server --prefix PYTHONPATH : ${authentikComponents.staticWorkdirDeps}
5763
58-
mkdir -p $ldap/bin $proxy/bin $radius/bin
64+
mkdir -p $ldap/bin $proxy/bin $radius/bin $rac/bin
5965
mv $out/bin/ldap $ldap/bin/
6066
mv $out/bin/proxy $proxy/bin/
6167
mv $out/bin/radius $radius/bin/
68+
mv $out/bin/rac $rac/bin/
6269
'';
6370
}

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.rac}/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)