2022-06-26 23:48:43 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
2021-07-26 01:29:05 +02:00
|
|
|
let
|
|
|
|
my = config.my;
|
|
|
|
port = 8080;
|
2022-06-26 23:48:43 +02:00
|
|
|
keycloak-protocol-cas = pkgs.callPackage ./keycloak/keycloak-protocol-cas.nix {};
|
|
|
|
domain = "auth.${my.subZone}";
|
|
|
|
certs = config.security.acme.certs."${domain}".directory;
|
2021-07-26 01:29:05 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
services.keycloak = {
|
|
|
|
enable = true;
|
|
|
|
initialAdminPassword = "changemeasap";
|
2022-06-26 23:48:43 +02:00
|
|
|
plugins = [ pkgs.keycloak.plugins.keycloak-metrics-spi keycloak-protocol-cas ];
|
|
|
|
database = {
|
|
|
|
type = "postgresql";
|
|
|
|
username = "keycloak";
|
|
|
|
name = "keycloak";
|
|
|
|
createLocally = true;
|
|
|
|
passwordFile = "${config.age.secrets.keycloakDatabasePasswordFile.path}";
|
|
|
|
};
|
|
|
|
settings = {
|
|
|
|
hostname-strict-backchannel = true;
|
|
|
|
http-port = port;
|
|
|
|
proxy = "edge";
|
|
|
|
http-relative-path = "/auth";
|
|
|
|
hostname = domain;
|
2021-07-26 01:29:05 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-06-26 23:48:43 +02:00
|
|
|
services.nginx.virtualHosts."${domain}" = {
|
2021-07-26 01:29:05 +02:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:${toString port}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|