2022-12-20 05:40:58 +01:00
|
|
|
{ config, lib, libz, ... }:
|
2022-07-23 00:06:12 +02:00
|
|
|
|
|
|
|
{
|
2022-12-18 22:16:29 +01:00
|
|
|
c3d2.deployment.server = "server10";
|
2022-07-23 00:06:12 +02:00
|
|
|
|
|
|
|
system.stateVersion = "22.05";
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
hostName = "auth";
|
2022-07-23 02:04:42 +02:00
|
|
|
firewall.allowedTCPPorts = [
|
|
|
|
636 # ldaps
|
|
|
|
];
|
2022-07-23 00:06:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
2022-12-23 08:22:28 +01:00
|
|
|
dex.settings.oauth2.skipApprovalScreen = true;
|
|
|
|
|
2022-07-23 00:06:12 +02:00
|
|
|
nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts."auth.c3d2.de" = {
|
|
|
|
default = true;
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations = {
|
2022-12-20 04:31:37 +01:00
|
|
|
"/".proxyPass = "http://localhost:${toString config.services.portunus.port}";
|
2022-07-23 00:06:12 +02:00
|
|
|
"/dex".proxyPass ="http://localhost:${toString config.services.portunus.dex.port}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
portunus = {
|
|
|
|
enable = true;
|
|
|
|
dex = {
|
2022-12-23 08:22:28 +01:00
|
|
|
enable = true;
|
|
|
|
oidcClients = [ {
|
|
|
|
callbackURL = "https://grafana.hq.c3d2.de/login/generic_oauth";
|
|
|
|
id = "grafana";
|
|
|
|
} ];
|
2022-07-23 00:06:12 +02:00
|
|
|
};
|
|
|
|
domain = "auth.c3d2.de";
|
|
|
|
ldap = {
|
2022-12-20 05:40:58 +01:00
|
|
|
searchUserName = "search";
|
2022-07-23 00:06:12 +02:00
|
|
|
suffix = "dc=c3d2,dc=de";
|
|
|
|
tls = true;
|
|
|
|
};
|
2022-08-01 00:16:40 +02:00
|
|
|
seedPath = config.sops.secrets."portunus/seed".path;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
sops = {
|
|
|
|
defaultSopsFile = ./secrets.yaml;
|
2022-12-23 08:22:28 +01:00
|
|
|
secrets."dex/environment" = libz.sops.permissionForUser "dex";
|
2022-12-20 05:40:58 +01:00
|
|
|
secrets."portunus/seed" = libz.sops.permissionForUser "portunus";
|
2022-07-23 00:06:12 +02:00
|
|
|
};
|
2022-12-23 08:22:28 +01:00
|
|
|
|
|
|
|
systemd.services.dex.serviceConfig = {
|
|
|
|
DynamicUser = lib.mkForce false;
|
|
|
|
EnvironmentFile = config.sops.secrets."dex/environment".path;
|
|
|
|
StateDirectory = "dex";
|
|
|
|
User = "dex";
|
|
|
|
};
|
|
|
|
|
|
|
|
users = {
|
|
|
|
groups.dex = { };
|
|
|
|
users.dex = {
|
|
|
|
group = "dex";
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
};
|
2022-07-23 00:06:12 +02:00
|
|
|
}
|