keycloak: init

This commit is contained in:
Rouven Seifert 2024-05-02 13:21:16 +02:00
parent 4fa9a2fe7d
commit 5294cd68f8
Signed by untrusted user: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
2 changed files with 32 additions and 3 deletions

27
modules/keycloak.nix Normal file
View file

@ -0,0 +1,27 @@
{ config, ... }:
let
domain = "sso.${config.networking.domain}";
in
{
sops.secrets."keykloak/db" = { };
services.keycloak = {
enable = true;
settings = {
http-port = 8086;
https-port = 19000;
hostname = domain;
proxy = "edge";
};
# The module requires a password for the DB and works best with its own DB config
# Does an automatic Postgresql configuration
database = {
passwordFile = config.sops.secrets."keycloak/db".path;
};
initialAdminPassword = "plschangeme";
};
services.nginx.virtualHosts."${domain}" = {
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.keycloak.settings.http-port}";
};
};
}