1 {pkgs, lib, config, ...}:
2 let inherit (config.services) openldap;
3 inherit (config.users) users groups;
4 domainSuffix = openldap.domainSuffix;
13 # sudo ldapsearch -LLL -H ldapi:// -D cn=admin,cn=config -Y EXTERNAL -b 'olcDatabase={1}mdb,cn=config' -s sub
14 dn: olcBackend={1}mdb,cn=config
15 objectClass: olcBackendConfig
17 dn: olcDatabase={1}mdb,cn=config
18 objectClass: olcDatabaseConfig
19 objectClass: olcMdbConfig
20 # NOTE: checkpoint the database periodically in case of system failure
21 # and to speed slapd shutdown.
22 olcDbCheckpoint: 512 30
23 # Database max size is 1G
24 olcDbMaxSize: 1073741824
26 # NOTE: database superuser. Needed for syncrepl.
27 olcRootDN: cn=admin,${domainSuffix}
28 # NOTE: superuser password, generated with slappasswd -s SECRET
29 # FIXME: remove when dovecot2 compiled with SASL
30 olcRootPW: {SSHA}NONVwwKnKsCBmFxkMqTCFekdu3SJQHc9
32 olcDbIndex: objectClass eq
34 olcDbIndex: uidNumber,gidNumber eq
35 olcDbIndex: member,memberUid eq
37 olcDbIndex: mailEnabled eq
38 olcDbIndex: mailacceptinggeneralid eq
40 olcAccess: to attrs=userPassword
43 by dn="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read
45 olcAccess: to attrs=shadowLastChange
48 olcAccess: to dn.sub="ou=posix,${domainSuffix}"
49 by dn="gidNumber=${toString groups.nslcd.gid}+uidNumber=${toString users.nslcd.uid},cn=peercred,cn=external,cn=auth" read
50 by dn="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read
51 # NOTE: dovecot/auth runs as root, hence the gidNumber=0+uidNumber=0
60 objectClass: organization
61 o: ${config.networking.baseName}
63 dn: cn=admin,${domainSuffix}
64 objectClass: simpleSecurityObject
65 objectClass: organizationalRole
66 description: ${config.networking.baseName} LDAP administrator
67 roleOccupant: ${domainSuffix}
69 #userPassword: {SSHA}NONVwwKnKsCBmFxkMqTCFekdu3SJQHc9
71 dn: ou=posix,${domainSuffix}
73 objectClass: organizationalUnit
75 dn: ou=accounts,ou=posix,${domainSuffix}
77 objectClass: organizationalUnit
79 dn: ou=groups,ou=posix,${domainSuffix}
81 objectClass: organizationalUnit
83 dn: cn=users,ou=groups,ou=posix,${domainSuffix}
85 objectclass: posixGroup
90 #dn: cn=dovemail,ou=groups,ou=posix,${domainSuffix}
92 #objectclass: posixGroup
94 # # FIXME: do not hardcode this gid
98 dn: uid=ju,ou=accounts,ou=posix,${domainSuffix}
101 objectClass: posixAccount
102 objectclass: postfixUser
103 objectclass: PostfixBookMailAccount
104 objectclass: PostfixBookMailForward
107 mail: ju@commonsoft.coop
108 mailAlias: juju@commonsoft.coop
109 #mailacceptinggeneralid: julm
113 homeDirectory: /home/ju
114 loginShell: /run/current-system/sw/bin/bash
115 userPassword: {SSHA}144Rfau9KJ14U0U4KdLNB7OrtpiEc3E3
117 dn: uid=sevy,ou=accounts,ou=posix,${domainSuffix}
118 #objectClass: account
120 objectClass: posixAccount
121 objectclass: postfixUser
122 objectclass: PostfixBookMailAccount
123 objectclass: PostfixBookMailForward
126 mail: sevy@commonsoft.coop
127 mailAlias: severine.popek@commonsoft.coop
130 homeDirectory: /home/sevy
131 loginShell: /run/current-system/sw/bin/bash
132 userPassword: {SSHA}dwqaKo5nmId8Bym5PghloK+UEndwrVTN