22
0
mirror of https://github.com/SuperSandro2000/nixos-modules.git synced 2024-06-11 18:54:06 +02:00
nixos-modules/modules/portunus.nix

58 lines
1.7 KiB
Nix
Raw Normal View History

{ config, lib, ... }:
let
cfg = config.services.portunus;
in
{
options.services.portunus = {
2023-01-17 00:23:31 +01:00
addToHosts = lib.mkOption {
type = lib.types.bool;
default = false;
2023-01-17 02:14:18 +01:00
description = lib.mdDoc "Whether to add a hosts entry for the portunus domain pointing to externalIp";
2023-01-17 00:23:31 +01:00
};
2023-02-23 00:34:37 +01:00
internalIp4 = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
description = lib.mdDoc "Internal IPv4 of portunus instance. This is used in the addToHosts option.";
};
2023-02-23 00:34:37 +01:00
internalIp6 = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
description = lib.mdDoc "Internal IPv6 of portunus instance. This is used in the addToHosts option.";
};
2023-01-17 00:23:31 +01:00
ldapPreset = lib.mkOption {
type = lib.types.bool;
2023-01-17 00:56:46 +01:00
default = false;
2023-01-17 02:14:18 +01:00
description = lib.mdDoc "Whether to set config.security.ldap to portunus specific settings.";
};
};
2023-01-17 00:23:31 +01:00
config = {
networking.hosts = lib.mkIf cfg.addToHosts {
2023-02-23 00:34:37 +01:00
${cfg.internalIp4} = [ cfg.domain ];
${cfg.internalIp6} = [ cfg.domain ];
2023-01-17 00:23:31 +01:00
};
security.ldap = lib.mkIf cfg.ldapPreset {
domainName = cfg.domain;
2023-03-17 01:50:30 +01:00
givenNameField = "givenName";
2023-03-21 23:41:18 +01:00
groupFilter = group: "(&(objectclass=person)(isMemberOf=cn=${group},${config.security.ldap.roleBaseDN}))";
2023-03-17 01:50:30 +01:00
mailField = "mail";
port = 636;
2023-01-17 00:23:31 +01:00
roleBaseDN = "ou=groups";
roleField = "cn";
roleFilter = "(&(objectclass=groupOfNames)(member=%s))";
roleValue = "dn";
2023-03-18 01:24:55 +01:00
sshPublicKeyField = "sshPublicKey";
2023-01-17 00:23:31 +01:00
searchUID = "search";
2023-03-17 01:50:30 +01:00
surnameField = "sn";
2023-01-17 00:23:31 +01:00
userField = "uid";
userFilter = param: "(&(objectclass=person)(|(uid=${param})(mail=${param})))";
2023-01-17 00:23:31 +01:00
userBaseDN = "ou=users";
};
};
}