2022-12-02 14:25:55 +01:00
|
|
|
{config, ...}: let
|
|
|
|
# temporary url, zum testen auf laptop zuhause
|
|
|
|
tld = "moe";
|
|
|
|
hostname = "eisvogel";
|
|
|
|
domain = "portunus.${hostname}.${tld}";
|
2022-12-17 13:58:06 +01:00
|
|
|
|
|
|
|
portunusUser = "portunus";
|
|
|
|
portunusGroup = "portunus";
|
|
|
|
|
|
|
|
ldapUser = "openldap";
|
|
|
|
ldapGroup = "openldap";
|
2022-12-02 14:25:55 +01:00
|
|
|
in {
|
2022-12-17 13:58:06 +01:00
|
|
|
users.users."${portunusUser}" = {
|
|
|
|
isSystemUser = true;
|
|
|
|
group = "${portunusGroup}";
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups."${portunusGroup}" = {
|
|
|
|
name = "${portunusGroup}";
|
|
|
|
members = ["${portunusUser}"];
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users."${ldapUser}" = {
|
|
|
|
isSystemUser = true;
|
|
|
|
group = "${ldapGroup}";
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups."${ldapGroup}" = {
|
|
|
|
name = "${ldapGroup}";
|
|
|
|
members = ["${ldapUser}"];
|
|
|
|
};
|
|
|
|
|
|
|
|
# TODO: eigenes secrets.yaml für seedfile?
|
|
|
|
sops.secrets.portunus_seedfile = {
|
|
|
|
owner = "${portunusUser}";
|
|
|
|
group = "${portunusGroup}";
|
2022-12-02 14:25:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
services.portunus = {
|
|
|
|
enable = true;
|
2022-12-17 13:58:06 +01:00
|
|
|
user = "${portunusUser}";
|
|
|
|
group = "${portunusGroup}";
|
2022-12-02 14:25:55 +01:00
|
|
|
domain = "${domain}";
|
|
|
|
ldap = {
|
2022-12-17 13:58:06 +01:00
|
|
|
user = "${ldapUser}";
|
|
|
|
group = "${ldapGroup}";
|
2022-12-02 14:25:55 +01:00
|
|
|
suffix = "dc=${hostname},dc=${tld}";
|
|
|
|
tls = true;
|
|
|
|
};
|
|
|
|
|
2022-12-17 13:58:06 +01:00
|
|
|
# TODO: wohin seed file?
|
|
|
|
seedPath = "";
|
2022-12-02 14:25:55 +01:00
|
|
|
|
|
|
|
# falls wir das brauchen
|
|
|
|
# dex = {
|
|
|
|
# enable = true;
|
|
|
|
# ...
|
|
|
|
# };
|
|
|
|
# searchUserName = "xxx";
|
|
|
|
};
|
|
|
|
|
|
|
|
users.ldap = {
|
|
|
|
enable = true;
|
|
|
|
server = "ldaps://${domain}";
|
|
|
|
base = "dc=${hostname},dc=${tld}";
|
2022-12-17 13:58:06 +01:00
|
|
|
# useTLS = true; # nicht nötig weil ldaps domain festgelegt. würde sonst starttls auf port 389 versuchen
|
|
|
|
};
|
|
|
|
|
|
|
|
# TODO: acme/letsencrypt oder andere lösung?
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts."${config.services.portunus.domain}" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations = {
|
|
|
|
"/".proxyPass = "http://localhost:${toString config.services.portunus.port}";
|
|
|
|
"/dex".proxyPass = "http://localhost:${toString config.services.portunus.dex.port}";
|
|
|
|
};
|
|
|
|
};
|
2022-12-02 14:25:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
80 # http
|
|
|
|
443 # https
|
|
|
|
636 # ldaps
|
|
|
|
];
|
|
|
|
}
|