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.
This commit is contained in:
parent
d2db10786f
commit
be2175dc94
2 changed files with 13 additions and 2 deletions
|
@ -13,10 +13,17 @@ let
|
||||||
objectClass: organizationalUnit
|
objectClass: organizationalUnit
|
||||||
ou: users
|
ou: users
|
||||||
'';
|
'';
|
||||||
|
ldapClientConfig = {
|
||||||
|
enable = true;
|
||||||
|
loginPam = false;
|
||||||
|
nsswitch = false;
|
||||||
|
server = "ldap://";
|
||||||
|
base = "dc=example";
|
||||||
|
};
|
||||||
testScript = ''
|
testScript = ''
|
||||||
machine.wait_for_unit("openldap.service")
|
machine.wait_for_unit("openldap.service")
|
||||||
machine.succeed(
|
machine.succeed(
|
||||||
'ldapsearch -LLL -D "cn=root,dc=example" -w notapassword -b "dc=example"',
|
'ldapsearch -LLL -D "cn=root,dc=example" -w notapassword',
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
|
@ -57,6 +64,7 @@ in {
|
||||||
};
|
};
|
||||||
declarativeContents."dc=example" = dbContents;
|
declarativeContents."dc=example" = dbContents;
|
||||||
};
|
};
|
||||||
|
users.ldap = ldapClientConfig;
|
||||||
};
|
};
|
||||||
}) { inherit pkgs system; };
|
}) { inherit pkgs system; };
|
||||||
|
|
||||||
|
@ -76,6 +84,7 @@ in {
|
||||||
rootpw = "notapassword";
|
rootpw = "notapassword";
|
||||||
declarativeContents."dc=example" = dbContents;
|
declarativeContents."dc=example" = dbContents;
|
||||||
};
|
};
|
||||||
|
users.ldap = ldapClientConfig;
|
||||||
};
|
};
|
||||||
}) { inherit system pkgs; };
|
}) { inherit system pkgs; };
|
||||||
|
|
||||||
|
@ -88,6 +97,7 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
configDir = "/var/db/slapd.d";
|
configDir = "/var/db/slapd.d";
|
||||||
};
|
};
|
||||||
|
users.ldap = ldapClientConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = let
|
testScript = let
|
||||||
|
|
|
@ -97,7 +97,7 @@ stdenv.mkDerivation rec {
|
||||||
"CC=${stdenv.cc.targetPrefix}cc"
|
"CC=${stdenv.cc.targetPrefix}cc"
|
||||||
"STRIP=" # Disable install stripping as it breaks cross-compiling. We strip binaries anyway in fixupPhase.
|
"STRIP=" # Disable install stripping as it breaks cross-compiling. We strip binaries anyway in fixupPhase.
|
||||||
"prefix=${placeholder "out"}"
|
"prefix=${placeholder "out"}"
|
||||||
"sysconfdir=${placeholder "out"}/etc"
|
"sysconfdir=/etc"
|
||||||
"systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
|
"systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
|
||||||
# contrib modules require these
|
# contrib modules require these
|
||||||
"moduledir=${placeholder "out"}/lib/modules"
|
"moduledir=${placeholder "out"}/lib/modules"
|
||||||
|
@ -134,6 +134,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
installFlags = [
|
installFlags = [
|
||||||
"prefix=${placeholder "out"}"
|
"prefix=${placeholder "out"}"
|
||||||
|
"sysconfdir=${placeholder "out"}/etc"
|
||||||
"moduledir=${placeholder "out"}/lib/modules"
|
"moduledir=${placeholder "out"}/lib/modules"
|
||||||
"INSTALL=install"
|
"INSTALL=install"
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue