about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorDan Callaghan <djc@djc.id.au>2022-07-19 22:31:11 +1000
committerDan Callaghan <djc@djc.id.au>2022-07-19 22:32:45 +1000
commitbe2175dc949a34334f1ad9a81d95279ead470bb1 (patch)
tree0056146e17b138b6239b32bbe252dbd9b7847b9c /nixos
parentd2db10786f27619d5519b12b03fb10dc8ca95e59 (diff)
openldap: load client config from /etc, not the nix store
We want Openldap clients to load /etc/ldap.conf at runtime, not
${pkgs.openldap}/etc/ldap.conf which is always a sample config.

Pass sysconfdir=/etc at compile time, so that /etc/krb5.conf is embedded
in the library as the path of its config file.

Pass sysconfdir=${out}/etc at install time, so that the sample configs
and schema files are correctly included in the build output.

This hack works because the Makefiles are not smart enough to notice
that the sysconfdir variable has changed across invocations -- because
nobody ever writes their Makefiles to be that smart. :-)

Fixes #181937.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/openldap.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/nixos/tests/openldap.nix b/nixos/tests/openldap.nix
index 3c388119d5d24..96459d21a5efd 100644
--- a/nixos/tests/openldap.nix
+++ b/nixos/tests/openldap.nix
@@ -13,10 +13,17 @@ let
     objectClass: organizationalUnit
     ou: users
   '';
+  ldapClientConfig = {
+    enable = true;
+    loginPam = false;
+    nsswitch = false;
+    server = "ldap://";
+    base = "dc=example";
+  };
   testScript = ''
     machine.wait_for_unit("openldap.service")
     machine.succeed(
-        'ldapsearch -LLL -D "cn=root,dc=example" -w notapassword -b "dc=example"',
+        'ldapsearch -LLL -D "cn=root,dc=example" -w notapassword',
     )
   '';
 in {
@@ -57,6 +64,7 @@ in {
         };
         declarativeContents."dc=example" = dbContents;
       };
+      users.ldap = ldapClientConfig;
     };
   }) { inherit pkgs system; };
 
@@ -76,6 +84,7 @@ in {
         rootpw = "notapassword";
         declarativeContents."dc=example" = dbContents;
       };
+      users.ldap = ldapClientConfig;
     };
   }) { inherit system pkgs; };
 
@@ -88,6 +97,7 @@ in {
         enable = true;
         configDir = "/var/db/slapd.d";
       };
+      users.ldap = ldapClientConfig;
     };
 
     testScript = let