2024-05-14 18:57:23 +02:00
|
|
|
{ config, nixpkgs-unstable, ... }:
|
2024-05-02 13:21:16 +02:00
|
|
|
let
|
|
|
|
domain = "sso.${config.networking.domain}";
|
|
|
|
in
|
|
|
|
{
|
2024-05-06 17:05:22 +02:00
|
|
|
sops.secrets."keycloak/db" = { };
|
2024-05-02 13:21:16 +02:00
|
|
|
services.keycloak = {
|
|
|
|
enable = true;
|
2024-05-14 18:59:43 +02:00
|
|
|
# we use unstable as the release in stable is insecure
|
2024-05-14 18:57:23 +02:00
|
|
|
package = nixpkgs-unstable.legacyPackages.x86_64-linux.keycloak;
|
2024-05-02 13:21:16 +02:00
|
|
|
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}";
|
2024-05-07 11:57:15 +02:00
|
|
|
extraConfig = ''
|
|
|
|
proxy_buffer_size 128k;
|
|
|
|
proxy_buffers 4 256k;
|
|
|
|
proxy_busy_buffers_size 256k;
|
|
|
|
'';
|
2024-05-02 13:21:16 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|