fix(vouch): local access

This commit is contained in:
arcnmx 2024-03-22 14:02:17 -07:00
parent 34bca016b4
commit b16d6faee7
8 changed files with 110 additions and 193 deletions

View file

@ -5,7 +5,8 @@
}: let }: let
inherit (lib.options) mkOption; inherit (lib.options) mkOption;
inherit (lib.modules) mkIf mkDefault mkOptionDefault; inherit (lib.modules) mkIf mkDefault mkOptionDefault;
inherit (lib.strings) optionalString; inherit (lib.lists) filter;
inherit (lib.strings) optionalString hasPrefix;
inherit (config.services) tailscale; inherit (config.services) tailscale;
inherit (config) networking; inherit (config) networking;
hostModule = {config, ...}: let hostModule = {config, ...}: let
@ -37,6 +38,9 @@
allServerNames = mkOption { allServerNames = mkOption {
type = listOf str; type = listOf str;
}; };
otherServerNames = mkOption {
type = listOf str;
};
}; };
config = { config = {
@ -66,9 +70,12 @@
(mkIf (cfg.localName != null) cfg.localName) (mkIf (cfg.localName != null) cfg.localName)
(mkIf (cfg.tailscaleName != null) cfg.tailscaleName) (mkIf (cfg.tailscaleName != null) cfg.tailscaleName)
]); ]);
allServerNames = mkOptionDefault ( allServerNames = mkOptionDefault (filter (name: ! hasPrefix "@" name) (
[ config.serverName ] ++ config.serverAliases [ config.serverName ] ++ config.serverAliases
); ));
otherServerNames = mkOptionDefault (filter (name: ! hasPrefix "@" name) (
config.serverAliases
));
}; };
}; };
in { in {

View file

@ -22,7 +22,7 @@
}; };
}; };
config = let config = let
enableVouchLocal = vouch.localSso.enable && config.local.enable; enableVouchLocal = virtualHost.vouch.localSso.enable;
enableVouchTail = enableVouchLocal && tailscale.enable; enableVouchTail = enableVouchLocal && tailscale.enable;
allowOrigin = url: "add_header Access-Control-Allow-Origin ${url};"; allowOrigin = url: "add_header Access-Control-Allow-Origin ${url};";
in mkIf config.vouch.requireAuth { in mkIf config.vouch.requireAuth {
@ -57,6 +57,9 @@
}; };
vouch = { vouch = {
enable = mkEnableOption "vouch auth proxy"; enable = mkEnableOption "vouch auth proxy";
localSso.enable = mkEnableOption "lan-local vouch" // {
default = vouch.localSso.enable && config.local.enable;
};
requireAuth = mkEnableOption "require auth to access this host" // { requireAuth = mkEnableOption "require auth to access this host" // {
default = true; default = true;
}; };
@ -155,8 +158,8 @@
(mkBefore '' (mkBefore ''
set $vouch_url ${vouch.url}; set $vouch_url ${vouch.url};
'') '')
(mkIf (vouch.localSso.enable && config.local.enable or false) localVouchUrl) (mkIf cfg.localSso.enable localVouchUrl)
(mkIf (vouch.localSso.enable && config.local.enable or false && tailscale.enable) tailVouchUrl) (mkIf (cfg.localSso.enable && tailscale.enable) tailVouchUrl)
]; ];
in mkIf cfg.enable (mkMerge ( in mkIf cfg.enable (mkMerge (
[ [
@ -184,8 +187,8 @@
proxied.rewriteReferer = false; proxied.rewriteReferer = false;
extraConfig = let extraConfig = let
# nginx-proxied vouch must use X-Forwarded-Host, but vanilla vouch requires Host # nginx-proxied vouch must use X-Forwarded-Host, but vanilla vouch requires Host
vouchProxyHost = if vouch.doubleProxy vouchProxyHost = if vouch.doubleProxy.enable
then "${config.proxy.host}" then (if cfg.localSso.enable then vouch.doubleProxy.localServerName else vouch.doubleProxy.serverName)
else "$x_forwarded_host"; else "$x_forwarded_host";
in '' in ''
proxy_set_header Host ${vouchProxyHost}; proxy_set_header Host ${vouchProxyHost};
@ -204,18 +207,32 @@ in {
services.nginx = { services.nginx = {
vouch = { vouch = {
enable = mkEnableOption "vouch auth proxy"; enable = mkEnableOption "vouch auth proxy";
enableLocal = mkEnableOption "use local vouch instance" // {
default = true;
};
localSso = { localSso = {
# NOTE: this won't work without multiple vouch-proxy instances with different auth urls... enable = mkEnableOption "lan-local auth" // {
enable = mkEnableOption "lan-local auth"; default = true;
};
}; };
proxyOrigin = mkOption { proxyOrigin = mkOption {
type = str; type = str;
default = "https://login.local.${networking.domain}"; default = "https://login.local.${networking.domain}";
}; };
doubleProxy = mkOption { doubleProxy = {
enable = mkOption {
type = bool; type = bool;
default = true; default = true;
}; };
serverName = mkOption {
type = str;
default = "@vouch_internal";
};
localServerName = mkOption {
type = str;
default = "@vouch_internal_local";
};
};
authUrl = mkOption { authUrl = mkOption {
type = str; type = str;
default = "https://sso.${networking.domain}/realms/${networking.domain}"; default = "https://sso.${networking.domain}/realms/${networking.domain}";
@ -245,7 +262,7 @@ in {
mkAlmostOptionDefault "http://login.tail.${networking.domain}" mkAlmostOptionDefault "http://login.tail.${networking.domain}"
); );
} }
(mkIf vouch-proxy.enable { (mkIf (vouch.enableLocal && vouch-proxy.enable) {
proxyOrigin = let proxyOrigin = let
inherit (vouch-proxy.settings.vouch) listen port; inherit (vouch-proxy.settings.vouch) listen port;
host = host =
@ -256,7 +273,7 @@ in {
mkAlmostOptionDefault "http://${host}:${toString port}"; mkAlmostOptionDefault "http://${host}:${toString port}";
authUrl = mkAlmostOptionDefault vouch-proxy.authUrl; authUrl = mkAlmostOptionDefault vouch-proxy.authUrl;
url = mkAlmostOptionDefault vouch-proxy.url; url = mkAlmostOptionDefault vouch-proxy.url;
doubleProxy = mkAlmostOptionDefault false; doubleProxy.enable = mkAlmostOptionDefault false;
}) })
]; ];
}; };

View file

@ -6,7 +6,7 @@
inherit (lib.modules) mkIf mkDefault; inherit (lib.modules) mkIf mkDefault;
inherit (config.services) barcodebuddy nginx; inherit (config.services) barcodebuddy nginx;
name.shortServer = mkDefault "bbuddy"; name.shortServer = mkDefault "bbuddy";
serverName = "bbuddy_internal"; serverName = "@bbuddy_internal";
extraConfig = '' extraConfig = ''
set $x_proxy_host ${serverName}; set $x_proxy_host ${serverName};
''; '';

View file

@ -53,7 +53,7 @@ in {
}; };
}; };
invidious'int = { config, ... }: { invidious'int = { config, ... }: {
serverName = "invidious_internal"; serverName = "@invidious_internal";
proxied.enable = true; proxied.enable = true;
local.denyGlobal = true; local.denyGlobal = true;
# TODO: consider disabling registration then redirecting to login if `SID` cookie is unset instead of using vouch # TODO: consider disabling registration then redirecting to login if `SID` cookie is unset instead of using vouch

View file

@ -1,131 +0,0 @@
{
config,
meta,
lib,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
inherit (config) networking;
inherit (config.services) tailscale nginx;
inherit (nginx) virtualHosts;
cfg = config.services.kanidm;
access = nginx.access.kanidm;
proxyPass = mkDefault "https://${access.host}:${toString access.port}";
locations = {
"/" = {
inherit proxyPass;
};
"=/ca.pem" = mkIf cfg.server.unencrypted.enable {
alias = "${cfg.server.unencrypted.package.ca}";
};
};
localLocations = vouchDomain: {
"/".extraConfig = ''
proxy_redirect $scheme://${nginx.access.vouch.domain or "login.${networking.domain}"}/ $scheme://${vouchDomain}/;
'';
};
in {
imports = let
inherit (meta) nixos;
in [
nixos.access.ldap
];
options.services.nginx.access.kanidm = with lib.types; {
host = mkOption {
type = str;
};
domain = mkOption {
type = str;
default = "id.${networking.domain}";
};
localDomain = mkOption {
type = str;
default = "id.local.${networking.domain}";
};
tailDomain = mkOption {
type = str;
default = "id.tail.${networking.domain}";
};
port = mkOption {
type = port;
};
ldapHost = mkOption {
type = str;
default = access.host;
};
ldapPort = mkOption {
type = port;
};
ldapEnable = mkOption {
type = bool;
default = false;
};
useACMEHost = mkOption {
type = nullOr str;
default = virtualHosts.${access.domain}.useACMEHost;
};
};
config = {
services.nginx = {
access.kanidm = mkIf cfg.enableServer {
domain = mkOptionDefault cfg.server.frontend.domain;
host = mkOptionDefault "localhost";
port = mkOptionDefault cfg.server.frontend.port;
ldapPort = mkOptionDefault cfg.server.ldap.port;
ldapEnable = mkDefault cfg.server.ldap.enable;
};
access.ldap = mkIf (cfg.enableServer && cfg.ldapEnable) {
enable = mkDefault true;
host = mkOptionDefault access.kanidm.ldapHost;
port = mkOptionDefault access.kanidm.ldapPort;
useACMEHost = mkDefault access.kanidm.useACMEHost;
};
virtualHosts = {
${access.domain} = {
inherit locations;
};
${access.localDomain} = {
inherit (virtualHosts.${access.domain}) useACMEHost;
addSSL = mkDefault (access.useACMEHost != null || virtualHosts.${access.domain}.forceSSL);
local.enable = true;
locations = mkMerge [
locations
(localLocations nginx.access.vouch.localDomain or "login.local.${networking.domain}")
];
};
${access.tailDomain} = mkIf tailscale.enable {
inherit (virtualHosts.${access.domain}) useACMEHost;
addSSL = mkDefault (access.useACMEHost != null || virtualHosts.${access.domain}.forceSSL);
local.enable = true;
locations = mkMerge [
locations
(localLocations nginx.access.vouch.tailDomain or "login.tail.${networking.domain}")
];
};
};
};
services.kanidm.server.unencrypted.domain = mkMerge [
[
access.localDomain
config.networking.fqdn
config.lib.access.hostnameForNetwork.local
]
(mkIf tailscale.enable [
"id.tail.${config.networking.domain}"
config.lib.access.hostnameForNetwork.tail
])
];
networking.firewall = {
interfaces.local.allowedTCPPorts = [
389
];
allowedTCPPorts = [
636
];
};
};
}

View file

@ -44,11 +44,11 @@ in {
}; };
local.enable = true; local.enable = true;
inherit locations; inherit locations;
extraConfig = mkIf nginx.vouch.localSso.enable '' extraConfig = mkIf false ''
set $vouch_local_url ${nginx.vouch.localUrl}; set $vouch_local_url ${nginx.vouch.localUrl};
if ($x_forwarded_host ~ "\.tail\.${networking.domain}$") { #if ($x_forwarded_host ~ "\.tail\.${networking.domain}$") {
set $vouch_local_url $x_scheme://${nginx.vouch.tailDomain}; # set $vouch_local_url $x_scheme://${nginx.vouch.tailDomain};
} #}
proxy_redirect ${nginx.vouch.url}/ $vouch_local_url/; proxy_redirect ${nginx.vouch.url}/ $vouch_local_url/;
''; '';
}; };

View file

@ -3,40 +3,31 @@
lib, lib,
... ...
}: let }: let
inherit (lib.options) mkOption;
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault; inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
inherit (config) networking; inherit (config) networking;
inherit (config.services) tailscale nginx; inherit (config.services) tailscale nginx;
cfg = config.services.vouch-proxy; cfg = config.services.vouch-proxy;
access = nginx.access.vouch;
in { in {
options.services.nginx.access.vouch = with lib.types; {
url = mkOption {
type = str;
};
};
config.services.nginx = { config.services.nginx = {
access.vouch = mkIf cfg.enable { virtualHosts = let
url = let localVouchUrl = let
inherit (cfg.settings.vouch) listen; inherit (cfg.settings.vouch) listen;
host = host =
if listen == "0.0.0.0" || listen == "[::]" if listen == "0.0.0.0" || listen == "[::]"
then "localhost" then "localhost"
else listen; else listen;
in in
mkOptionDefault "http://${host}:${toString cfg.settings.vouch.port}"; "http://${host}:${toString cfg.settings.vouch.port}";
};
virtualHosts = let
locations = { locations = {
"/" = { "/" = {
proxyPass = mkDefault access.url;
extraConfig = '' extraConfig = ''
proxy_redirect default; proxy_redirect default;
set $x_proxy_host $x_forwarded_host;
''; '';
}; };
"/validate" = {config, ...}: { "/validate" = {config, virtualHost, ...}: {
proxied.enable = true; proxied.enable = true;
proxyPass = mkDefault (access.url + "/validate"); proxyPass = mkDefault (virtualHost.locations."/".proxyPass + "/validate");
proxy.headers.enableRecommended = true; proxy.headers.enableRecommended = true;
local.denyGlobal = true; local.denyGlobal = true;
extraConfig = '' extraConfig = ''
@ -44,7 +35,7 @@ in {
''; '';
}; };
}; };
localLocations = kanidmDomain: mkIf nginx.vouch.localSso.enable { localLocations = kanidmDomain: mkIf (nginx.vouch.localSso.enable && false) {
"/" = { "/" = {
proxied.xvars.enable = true; proxied.xvars.enable = true;
extraConfig = '' extraConfig = ''
@ -55,14 +46,25 @@ in {
name.shortServer = mkDefault "login"; name.shortServer = mkDefault "login";
in { in {
vouch = { vouch = {
inherit name locations; inherit name;
serverAliases = [ nginx.vouch.doubleProxy.serverName ];
proxied.enable = true;
local.denyGlobal = true;
locations = mkMerge [
locations
{
"/".proxyPass = mkIf cfg.enable (mkDefault localVouchUrl);
}
];
ssl.force = true; ssl.force = true;
}; };
vouch'local = { vouch'local = {
name = { name = {
inherit (name) shortServer; inherit (name) shortServer;
includeTailscale = false; includeTailscale = mkDefault false;
}; };
serverAliases = mkIf cfg.enable [ nginx.vouch.doubleProxy.localServerName ];
proxied.enable = true;
local.enable = true; local.enable = true;
ssl = { ssl = {
force = true; force = true;
@ -70,11 +72,14 @@ in {
}; };
locations = mkMerge [ locations = mkMerge [
locations locations
{
"/".proxyPass = mkDefault nginx.virtualHosts.vouch.locations."/".proxyPass;
}
(localLocations "sso.local.${networking.domain}") (localLocations "sso.local.${networking.domain}")
]; ];
}; };
vouch'tail = { vouch'tail = {
enable = mkDefault tailscale.enable; enable = mkDefault (tailscale.enable && !nginx.virtualHosts.vouch'local.name.includeTailscale);
ssl.cert.copyFromVhost = "vouch'local"; ssl.cert.copyFromVhost = "vouch'local";
name = { name = {
inherit (name) shortServer; inherit (name) shortServer;
@ -83,6 +88,9 @@ in {
local.enable = true; local.enable = true;
locations = mkMerge [ locations = mkMerge [
locations locations
{
"/".proxyPass = mkDefault nginx.virtualHosts.vouch'local.locations."/".proxyPass;
}
(localLocations "sso.tail.${networking.domain}") (localLocations "sso.tail.${networking.domain}")
]; ];
}; };

View file

@ -11,10 +11,10 @@
tei = access.nixosFor "tei"; tei = access.nixosFor "tei";
utsuho = access.nixosFor "utsuho"; utsuho = access.nixosFor "utsuho";
inherit (mediabox.services) plex; inherit (mediabox.services) plex;
inherit (keycloak.services) vouch-proxy;
inherit (tei.services) home-assistant zigbee2mqtt; inherit (tei.services) home-assistant zigbee2mqtt;
inherit (utsuho.services) unifi; inherit (utsuho.services) unifi;
inherit (config.services) nginx; inherit (config.services) nginx;
inherit (nginx) virtualHosts;
in { in {
imports = let imports = let
inherit (meta) nixos; inherit (meta) nixos;
@ -31,6 +31,7 @@ in {
nixos.ddclient nixos.ddclient
nixos.acme nixos.acme
nixos.nginx nixos.nginx
nixos.vouch
nixos.access.nginx nixos.access.nginx
nixos.access.global nixos.access.global
nixos.access.gensokyo nixos.access.gensokyo
@ -56,7 +57,7 @@ in {
}; };
services.cloudflared = let services.cloudflared = let
inherit (nginx) virtualHosts defaultHTTPListenPort; inherit (nginx) defaultHTTPListenPort;
tunnelId = "964121e3-b3a9-4cc1-8480-954c4728b604"; tunnelId = "964121e3-b3a9-4cc1-8480-954c4728b604";
localNginx = "http://localhost:${toString defaultHTTPListenPort}"; localNginx = "http://localhost:${toString defaultHTTPListenPort}";
in { in {
@ -70,9 +71,14 @@ in {
}; };
}; };
security.acme.certs = let # configure a secondary vouch instance for local clients, but don't use it by default
inherit (nginx) virtualHosts; services.vouch-proxy = {
in { authUrl = "https://${virtualHosts.keycloak'local.serverName}/realms/${config.networking.domain}";
domain = "login.local.${config.networking.domain}";
#cookie.domain = "local.${config.networking.domain}";
};
security.acme.certs = {
hakurei = { hakurei = {
inherit (nginx) group; inherit (nginx) group;
domain = config.networking.fqdn; domain = config.networking.fqdn;
@ -85,7 +91,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.keycloak.serverName; domain = virtualHosts.keycloak.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.keycloak.serverAliases virtualHosts.keycloak.otherServerNames
virtualHosts.keycloak'local.allServerNames virtualHosts.keycloak'local.allServerNames
]; ];
}; };
@ -93,7 +99,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.home-assistant.serverName; domain = virtualHosts.home-assistant.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.home-assistant.serverAliases virtualHosts.home-assistant.otherServerNames
virtualHosts.home-assistant'local.allServerNames virtualHosts.home-assistant'local.allServerNames
]; ];
}; };
@ -101,7 +107,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.zigbee2mqtt.serverName; domain = virtualHosts.zigbee2mqtt.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.zigbee2mqtt.serverAliases virtualHosts.zigbee2mqtt.otherServerNames
virtualHosts.zigbee2mqtt'local.allServerNames virtualHosts.zigbee2mqtt'local.allServerNames
]; ];
}; };
@ -109,7 +115,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.grocy.serverName; domain = virtualHosts.grocy.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.grocy.serverAliases virtualHosts.grocy.otherServerNames
virtualHosts.grocy'local.allServerNames virtualHosts.grocy'local.allServerNames
]; ];
}; };
@ -117,7 +123,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.barcodebuddy.serverName; domain = virtualHosts.barcodebuddy.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.barcodebuddy.serverAliases virtualHosts.barcodebuddy.otherServerNames
virtualHosts.barcodebuddy'local.allServerNames virtualHosts.barcodebuddy'local.allServerNames
]; ];
}; };
@ -125,7 +131,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.vouch.serverName; domain = virtualHosts.vouch.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.vouch.serverAliases virtualHosts.vouch.otherServerNames
virtualHosts.vouch'local.allServerNames virtualHosts.vouch'local.allServerNames
(mkIf virtualHosts.vouch'tail.enable virtualHosts.vouch'tail.allServerNames) (mkIf virtualHosts.vouch'tail.enable virtualHosts.vouch'tail.allServerNames)
]; ];
@ -134,7 +140,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.unifi.serverName; domain = virtualHosts.unifi.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.unifi.serverAliases virtualHosts.unifi.otherServerNames
virtualHosts.unifi'local.allServerNames virtualHosts.unifi'local.allServerNames
]; ];
}; };
@ -142,7 +148,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.freeipa.serverName; domain = virtualHosts.freeipa.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.freeipa.serverAliases virtualHosts.freeipa.otherServerNames
virtualHosts.freeipa'web.allServerNames virtualHosts.freeipa'web.allServerNames
virtualHosts.freeipa'web'local.allServerNames virtualHosts.freeipa'web'local.allServerNames
virtualHosts.freeipa'ldap.allServerNames virtualHosts.freeipa'ldap.allServerNames
@ -154,7 +160,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.freepbx.serverName; domain = virtualHosts.freepbx.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.freepbx.serverAliases virtualHosts.freepbx.otherServerNames
virtualHosts.freepbx'local.allServerNames virtualHosts.freepbx'local.allServerNames
]; ];
}; };
@ -162,7 +168,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.prox.serverName; domain = virtualHosts.prox.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.prox.serverAliases virtualHosts.prox.otherServerNames
virtualHosts.prox'local.allServerNames virtualHosts.prox'local.allServerNames
(mkIf virtualHosts.prox'tail.enable virtualHosts.prox'tail.allServerNames) (mkIf virtualHosts.prox'tail.enable virtualHosts.prox'tail.allServerNames)
]; ];
@ -171,7 +177,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.plex.serverName; domain = virtualHosts.plex.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.plex.serverAliases virtualHosts.plex.otherServerNames
virtualHosts.plex'local.allServerNames virtualHosts.plex'local.allServerNames
]; ];
}; };
@ -179,7 +185,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.kitchencam.serverName; domain = virtualHosts.kitchencam.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.kitchencam.serverAliases virtualHosts.kitchencam.otherServerNames
virtualHosts.kitchencam'local.allServerNames virtualHosts.kitchencam'local.allServerNames
]; ];
}; };
@ -187,7 +193,7 @@ in {
inherit (nginx) group; inherit (nginx) group;
domain = virtualHosts.invidious.serverName; domain = virtualHosts.invidious.serverName;
extraDomainNames = mkMerge [ extraDomainNames = mkMerge [
virtualHosts.invidious.serverAliases virtualHosts.invidious.otherServerNames
virtualHosts.invidious'local.allServerNames virtualHosts.invidious'local.allServerNames
]; ];
}; };
@ -196,13 +202,11 @@ in {
services.nginx = let services.nginx = let
inherit (nginx) access; inherit (nginx) access;
in { in {
vouch.enableLocal = false;
access.plex = assert plex.enable; { access.plex = assert plex.enable; {
url = "http://${mediabox.lib.access.hostnameForNetwork.local}:${toString plex.port}"; url = "http://${mediabox.lib.access.hostnameForNetwork.local}:${toString plex.port}";
externalPort = 41324; externalPort = 41324;
}; };
access.vouch = assert vouch-proxy.enable; {
url = "http://${keycloak.lib.access.hostnameForNetwork.local}:${toString vouch-proxy.settings.vouch.port}";
};
access.unifi = assert unifi.enable; { access.unifi = assert unifi.enable; {
host = utsuho.lib.access.hostnameForNetwork.local; host = utsuho.lib.access.hostnameForNetwork.local;
}; };
@ -224,7 +228,19 @@ in {
local.denyGlobal = true; local.denyGlobal = true;
ssl.cert.enable = true; ssl.cert.enable = true;
}; };
vouch.ssl.cert.enable = true; vouch = let
inherit (keycloak.services) vouch-proxy;
in assert vouch-proxy.enable; {
ssl.cert.enable = true;
locations."/".proxyPass = "http://${keycloak.lib.access.hostnameForNetwork.local}:${toString vouch-proxy.settings.vouch.port}";
};
vouch'local = let
vouch-proxy = config.services.vouch-proxy;
in assert vouch-proxy.enable; {
locations."/".proxyPass = "http://localhost:${toString vouch-proxy.settings.vouch.port}";
# we're not running another for tailscale sorry...
name.includeTailscale = true;
};
unifi = { unifi = {
# we're not the real unifi record-holder, so don't respond globally.. # we're not the real unifi record-holder, so don't respond globally..
local.denyGlobal = true; local.denyGlobal = true;