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.

127 lines
2.6 KiB

2 months ago
2 years ago
2 years ago
2 years ago
2 months ago
2 years ago
2 months ago
2 years 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. users.mutableUsers = false;
  10. users.users."root" = {
  11. hashedPassword = "$y$j9T$tz8ojZ2gVOQ5AUp6GMhoj.$mAeE0eTGGsKNGddC7ebk/zFr5IMDyIpOpMP/6o.GI6D";
  12. openssh.authorizedKeys.keys = [
  13. "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK2nkarN0+uSuP5sGwDCb9KRu+FCjO/+da4VypGanPUZ fooker@k-2so"
  14. ];
  15. };
  16. security.pam.services = {
  17. sshd = {
  18. makeHomeDir = true;
  19. sssdStrictAccess = true;
  20. unixAuth = lib.mkForce true;
  21. };
  22. login = {
  23. makeHomeDir = true;
  24. sssdStrictAccess = true;
  25. unixAuth = lib.mkForce true;
  26. };
  27. lightdm = {
  28. makeHomeDir = true;
  29. sssdStrictAccess = true;
  30. unixAuth = lib.mkForce true;
  31. };
  32. systemd-user = {
  33. makeHomeDir = true;
  34. sssdStrictAccess = true;
  35. unixAuth = lib.mkForce true;
  36. };
  37. };
  38. security.pam.loginLimits = [
  39. {
  40. domain = "@cluster";
  41. item = "memlock";
  42. type = "-";
  43. value = "unlimited";
  44. }
  45. ];
  46. services.sssd = {
  47. enable = true;
  48. environmentFile = config.sops.secrets."ldap/login/environment".path;
  49. config = ''
  50. [sssd]
  51. config_file_version = 2
  52. services = nss, pam, ssh, ifp
  53. domains = hsfd
  54. debug_level = 8
  55. [nss]
  56. override_homedir = /home/%u
  57. override_shell = /run/current-system/sw/bin/bash
  58. filter_users = root
  59. filter_groups = root
  60. reconnection_retries = 3
  61. [pam]
  62. [domain/hsfd]
  63. id_provider = ldap
  64. access_provider = ldap
  65. auth_provider = ldap
  66. cache_credentials = true
  67. ldap_uri = ldaps://ldap.${config.networking.domain}/
  68. ldap_search_base = ou=users,${baseDN}
  69. ldap_tls_reqcert = demand
  70. ldap_id_use_start_tls = true
  71. ldap_default_bind_dn = cn=login,${baseDN}
  72. ldap_default_authtok_type = password
  73. ldap_default_authtok = $SSSD_LDAP_DEFAULT_AUTHTOK
  74. ldap_access_order = filter
  75. ldap_access_filter = (objectClass=*)
  76. ldap_user_object_class = posixAccount
  77. ldap_user_name = cn
  78. ldap_search_timeout = 10
  79. ldap_network_timeout = 10
  80. ldap_deref_threshold = 0
  81. ignore_group_members = true
  82. subdomain_inherit = ignore_group_members
  83. entry_negative_timeout = 3
  84. override_gid = ${toString config.users.groups."cluster".gid}
  85. cache_credentials = true
  86. min_id = 1000
  87. enumerate = true
  88. '';
  89. };
  90. users.groups."cluster" = {
  91. gid = 1000; # Fixed, becaused it is used for LDAP users
  92. };
  93. sops.secrets."ldap/login/environment" = {
  94. sopsFile = ./secrets.yaml;
  95. };
  96. }