NixOS configuration for HPC cluster https://docs.hpc.informatik.hs-fulda.de/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.4 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. { lib, config, ... }:
  2. with lib;
  3. let
  4. baseDN = concatMapStringsSep ","
  5. (part: "dc=${part}")
  6. (splitString "." config.networking.domain);
  7. in
  8. {
  9. services.openldap = {
  10. enable = true;
  11. settings = {
  12. children = {
  13. "cn=schema".includes = [
  14. "${config.services.openldap.package}/etc/schema/core.ldif"
  15. "${config.services.openldap.package}/etc/schema/cosine.ldif"
  16. "${config.services.openldap.package}/etc/schema/inetorgperson.ldif"
  17. "${config.services.openldap.package}/etc/schema/nis.ldif"
  18. ];
  19. "olcDatabase={1}mdb" = {
  20. attrs = {
  21. objectClass = [ "olcDatabaseConfig" "olcMdbConfig" ];
  22. olcDatabase = "{1}mdb";
  23. olcDbDirectory = "/var/lib/openldap/db";
  24. olcSuffix = baseDN;
  25. olcRootDN = "cn=root,${baseDN}";
  26. olcRootPW.path = config.sops.secrets."ldap/root/password".path;
  27. olcAccess = [
  28. # Custom access rules for userPassword attributes
  29. ''{0}to attrs=userPassword
  30. by self write
  31. by anonymous auth
  32. by * none''
  33. # Allow read on anything else
  34. ''{1}to *
  35. by * read''
  36. ];
  37. };
  38. };
  39. };
  40. };
  41. };
  42. sops.secrets."ldap/root/password" = {
  43. owner = "openldap";
  44. };
  45. hpc.hostFile.aliases = [
  46. "ldap.${config.networking.domain}"
  47. ];
  48. }