2 dbDomain = "example.org";
3 dbSuffix = "dc=example,dc=org";
5 ldapRootUser = "admin";
6 ldapRootPassword = "foobar";
9 in import ./make-test-python.nix ({pkgs, ...}: {
12 meta = with pkgs.lib.maintainers; {
13 maintainers = [ bbigras ];
16 nodes.machine = { pkgs, ... }: {
21 "cn=schema".includes = [
22 "${pkgs.openldap}/etc/schema/core.ldif"
23 "${pkgs.openldap}/etc/schema/cosine.ldif"
24 "${pkgs.openldap}/etc/schema/inetorgperson.ldif"
25 "${pkgs.openldap}/etc/schema/nis.ldif"
27 "olcDatabase={1}mdb" = {
29 objectClass = [ "olcDatabaseConfig" "olcMdbConfig" ];
30 olcDatabase = "{1}mdb";
31 olcDbDirectory = "/var/lib/openldap/db";
33 olcRootDN = "cn=${ldapRootUser},${dbSuffix}";
34 olcRootPW = ldapRootPassword;
39 declarativeContents = {
44 objectClass: organization
47 dn: ou=posix,${dbSuffix}
49 objectClass: organizationalUnit
51 dn: ou=accounts,ou=posix,${dbSuffix}
53 objectClass: organizationalUnit
55 dn: uid=${testUser},ou=accounts,ou=posix,${dbSuffix}
57 objectClass: posixAccount
58 # userPassword: somePasswordHash
59 homeDirectory: /home/${testUser}
70 # just for testing purposes, don't put this into the Nix store in production!
71 environmentFile = "${pkgs.writeText "ldap-root" "LDAP_BIND_PW=${ldapRootPassword}"}";
74 config_file_version = 2
75 services = nss, pam, sudo
81 ldap_uri = ldap://127.0.0.1:389
82 ldap_search_base = ${dbSuffix}
83 ldap_default_bind_dn = cn=${ldapRootUser},${dbSuffix}
84 ldap_default_authtok_type = password
85 ldap_default_authtok = $LDAP_BIND_PW
92 machine.wait_for_unit("openldap.service")
93 machine.wait_for_unit("sssd.service")
94 result = machine.execute("getent passwd ${testUser}")
96 assert "${testUser}" in result[1]
98 machine.wait_for_console_text("Backend is online")
99 machine.succeed("getent passwd ${testUser}")