fruitbasket/modules/ldap.nix

82 lines
1.6 KiB
Nix
Raw Normal View History

2022-12-17 17:42:10 +01:00
{ config, ... }:
let
2022-12-17 19:21:16 +01:00
domain = "auth.${config.fsr.domain}";
portunusUser = "portunus";
portunusGroup = "portunus";
ldapUser = "openldap";
ldapGroup = "openldap";
2022-12-17 17:42:10 +01:00
in
{
users.users."${portunusUser}" = {
isSystemUser = true;
group = "${portunusGroup}";
};
users.groups."${portunusGroup}" = {
name = "${portunusGroup}";
2022-12-17 17:42:10 +01:00
members = [ "${portunusUser}" ];
};
users.users."${ldapUser}" = {
isSystemUser = true;
group = "${ldapGroup}";
};
users.groups."${ldapGroup}" = {
name = "${ldapGroup}";
2022-12-17 17:42:10 +01:00
members = [ "${ldapUser}" ];
};
sops.secrets = {
"portunus_admin" = {
owner = "${portunusUser}";
group = "${portunusGroup}";
};
"portunus_search" = {
owner = "${portunusUser}";
group = "${portunusGroup}";
};
};
services.portunus = {
enable = true;
user = "${portunusUser}";
group = "${portunusGroup}";
domain = "${domain}";
2022-12-17 21:03:54 +01:00
port = 8081;
ldap = {
user = "${ldapUser}";
group = "${ldapGroup}";
2022-12-17 19:21:16 +01:00
suffix = "dc=ifsr,dc=de";
searchUserName = "search";
# disables port 389, use 636 with tls
# `portunus.domain` resolves to localhost
tls = true;
};
2022-12-17 19:44:16 +01:00
seedPath = ../config/portunus_seeds.json;
};
2023-02-03 15:40:42 +01:00
users.ldap = {
enable = true;
server = "ldap://localhost";
base = "${config.services.portunus.ldap.suffix}";
};
services.nginx = {
enable = true;
virtualHosts."${config.services.portunus.domain}" = {
forceSSL = true;
enableACME = true;
locations = {
"/".proxyPass = "http://localhost:${toString config.services.portunus.port}";
};
};
};
}