gerd.lldap: utilise settings module for LDAP
This commit is contained in:
parent
a7f869923f
commit
865e1251de
3 changed files with 61 additions and 16 deletions
|
@ -29,19 +29,19 @@ let
|
||||||
--active \
|
--active \
|
||||||
--security-protocol unencrypted \
|
--security-protocol unencrypted \
|
||||||
--skip-tls-verify \
|
--skip-tls-verify \
|
||||||
--host localhost \
|
--host ${config.mine.settings.ldap.host} \
|
||||||
--port 3890 \
|
--port ${builtins.toString config.mine.settings.ldap.port} \
|
||||||
--bind-dn "uid=bind_user,ou=people,dc=fricloud,dc=dk" \
|
--bind-dn "${config.mine.settings.ldap.bind_dn}" \
|
||||||
--bind-password "$BIND_USERPASS" \
|
--bind-password "$BIND_USERPASS" \
|
||||||
--user-filter '(&(memberof=cn=base_member,ou=groups,dc=fricloud,dc=dk)(|(uid=%[1]s)(mail=%[1]s)))' \
|
--user-filter '(&${config.mine.settings.ldap.user_filter}(|(${config.mine.settings.ldap.attr.uid}=%[1]s)(${config.mine.settings.ldap.attr.email}=%[1]s)))' \
|
||||||
--admin-filter '(memberof=cn=lldap_admin,ou=groups,dc=fricloud,dc=dk)' \
|
--admin-filter '${config.mine.settings.ldap.admin_filter}' \
|
||||||
--username-attribute uid \
|
--username-attribute ${config.mine.settings.ldap.attr.uid} \
|
||||||
--firstname-attribute givenName \
|
--firstname-attribute ${config.mine.settings.ldap.attr.firstname} \
|
||||||
--surname-attribute sn \
|
--surname-attribute ${config.mine.settings.ldap.attr.lastname} \
|
||||||
--email-attribute mail \
|
--email-attribute ${config.mine.settings.ldap.attr.email} \
|
||||||
--avatar-attribute jpegPhoto \
|
--avatar-attribute ${config.mine.settings.ldap.attr.avatar} \
|
||||||
--synchronize-users \
|
--synchronize-users \
|
||||||
--user-search-base 'ou=people,dc=fricloud,dc=dk' \
|
--user-search-base '${config.mine.settings.ldap.search_base}' \
|
||||||
|
|
||||||
echo "PRERUN-LDAP: Finished adding/updating..."
|
echo "PRERUN-LDAP: Finished adding/updating..."
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -28,11 +28,11 @@ in {
|
||||||
# setup ldap
|
# setup ldap
|
||||||
# https://github.com/lldap/lldap/blob/main/example_configs/hedgedoc.md
|
# https://github.com/lldap/lldap/blob/main/example_configs/hedgedoc.md
|
||||||
ldap = {
|
ldap = {
|
||||||
url = "ldap://localhost:3890";
|
url = config.mine.settings.ldap.url;
|
||||||
bindDn = "uid=bind_user,ou=people,dc=fricloud,dc=dk";
|
bindDn = config.mine.settings.ldap.bind_dn;
|
||||||
searchBase = "ou=people,dc=fricloud,dc=dk";
|
searchBase = config.mine.settings.ldap.search_base;
|
||||||
searchFilter = "(&(memberOf=cn=base_member,ou=groups,dc=fricloud,dc=dk)(uid={{username}}))";
|
searchFilter = "(&${config.mine.settings.ldap.user_filter}(|(${config.mine.settings.ldap.attr.uid}={{username}})(${config.mine.settings.ldap.attr.email}={{username}})))";
|
||||||
useridField = "uid";
|
useridField = config.mine.settings.ldap.attr.uid;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,4 +37,49 @@
|
||||||
age.secrets = {
|
age.secrets = {
|
||||||
lldap-admin-user-pass.owner = "lldap";
|
lldap-admin-user-pass.owner = "lldap";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# set settings other services can use
|
||||||
|
# CN = Common Name
|
||||||
|
# OU = Organizational Unit
|
||||||
|
# DC = Domain Component
|
||||||
|
#
|
||||||
|
# The users are all located in ou=people, + the base DN, so by default user bob is at cn=bob,ou=people,dc=example,dc=com.
|
||||||
|
# Similarly, the groups are located in ou=groups, so the group family will be at cn=family,ou=groups,dc=example,dc=com.
|
||||||
|
# Testing group membership through memberOf is supported, so you can have a filter like: (memberOf=cn=admins,ou=groups,dc=example,dc=com).
|
||||||
|
mine.settings.ldap = rec {
|
||||||
|
host = "localhost";
|
||||||
|
port = 3890;
|
||||||
|
url = "ldap://${host}:${builtins.toString port}";
|
||||||
|
|
||||||
|
dc = "dc=fricloud,dc=dk";
|
||||||
|
bind_dn = "uid=${users.bind},ou=${ou.users},${dc}";
|
||||||
|
search_base = "ou=${ou.users},${dc}";
|
||||||
|
user_filter = "(memberof=cn=${groups.member},ou=${ou.groups},${dc})";
|
||||||
|
admin_filter = "(memberof=cn=${groups.admin},ou=${ou.groups},${dc})";
|
||||||
|
|
||||||
|
users = {
|
||||||
|
admin = "admin";
|
||||||
|
bind = "bind_user";
|
||||||
|
};
|
||||||
|
|
||||||
|
groups = {
|
||||||
|
admin = "lldap_admin";
|
||||||
|
member = "base_member";
|
||||||
|
};
|
||||||
|
|
||||||
|
ou = {
|
||||||
|
groups = "groups";
|
||||||
|
users = "people";
|
||||||
|
};
|
||||||
|
|
||||||
|
attr = {
|
||||||
|
uid = "uid";
|
||||||
|
firstname = "givenName";
|
||||||
|
lastname = "sn";
|
||||||
|
email = "mail";
|
||||||
|
avatar = "jpegPhoto";
|
||||||
|
};
|
||||||
|
|
||||||
|
age_secret = config.age.secrets.lldap-bind-user-pass.path;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue