dataset/seed/applicationservice/2022.03.08/openldap/templates/users.ldif

119 lines
3 KiB
Text
Raw Normal View History

2022-03-08 19:42:28 +01:00
# BaseDN
2022-06-24 19:00:16 +02:00
%set groups = {}
dn: %%ldapclient_base_dn
%set %%attribute, %%organization = %%ldapclient_base_dn.split(',', 1)[0].split('=')
2022-03-08 19:42:28 +01:00
%%attribute: %%organization
objectClass: top
%if %%attribute == 'o'
objectClass: organization
%else
objectClass: organizationalUnit
%end if
# Remote
%for %%remote in %%accounts.remotes
%set %%name = %%normalize_family(%%remote)
dn: %%accounts['remote_' + %%name]['dn_' + %%name]
cn: %%remote
sn: %%remote
uid: %%remote
userPassword:: %%ssha_encode(%%accounts['remote_' + %%name]['password_' + %%name])
objectClass: top
objectClass: inetOrgPerson
%end for
2022-05-07 08:11:18 +02:00
# Accounts
2022-06-24 19:00:16 +02:00
dn: %%calc_ldapclient_base_dn(%%ldapclient_base_dn, family_name=None, base=True)
2022-05-07 08:11:18 +02:00
ou: accounts
objectClass: top
objectClass: organizationalUnit
2022-06-24 19:00:16 +02:00
## Accounts users
%set %%users = %%calc_ldapclient_base_dn(%%ldapclient_base_dn, family_name=None)
2022-05-07 08:11:18 +02:00
dn: %%users
2022-03-08 19:42:28 +01:00
ou: users
objectClass: top
objectClass: organizationalUnit
%for %%user in %%accounts.users.ldap_user_mail
2022-06-24 19:00:16 +02:00
%set %%userdn = "cn=" + %%user + "," + %%users
%%groups.setdefault('users', []).append(%%userdn)
dn: %%userdn
2022-03-08 19:42:28 +01:00
cn: %%user
mail: %%user
sn: %%user.ldap_user_sn
givenName: %%user.ldap_user_gn
uid: %%user.ldap_user_uid
userPassword:: %%ssha_encode(%%user.ldap_user_password)
2022-05-04 10:29:03 +02:00
homeDirectory: /srv/home/users/%%user
2022-05-23 08:54:15 +02:00
mailLocalAddress: %%user
%if %%user.ldap_user_aliases
%for %%alias in %%user.ldap_user_aliases
mailLocalAddress: %%alias
%end for
%end if
2022-05-04 10:29:03 +02:00
uidNumber: 0
gidNumber: 0
2022-03-08 19:42:28 +01:00
objectClass: top
objectClass: inetOrgPerson
2022-05-04 10:29:03 +02:00
objectClass: posixAccount
2022-05-23 08:54:15 +02:00
objectClass: inetLocalMailRecipient
2022-03-08 19:42:28 +01:00
%end for
2022-05-07 08:11:18 +02:00
## Families
2022-06-24 19:00:16 +02:00
dn: %%calc_ldapclient_base_dn(%%ldapclient_base_dn, family_name='-')
2022-04-28 21:48:16 +02:00
ou: families
objectClass: top
objectClass: organizationalUnit
%for %%family in %%accounts.families
2022-06-24 19:00:16 +02:00
%set %%families = %%calc_ldapclient_base_dn(%%ldapclient_base_dn, family_name=%%family)
2022-05-07 08:11:18 +02:00
dn: %%families
2022-04-28 21:48:16 +02:00
ou: %%family
objectClass: top
objectClass: organizationalUnit
%for %%user in %%accounts['family_' + %%family]['users_' + %%family]['ldap_user_mail_' + %%family]
2022-06-24 19:00:16 +02:00
%set %%userdn = "cn=" + %%user + "," + %%families
%%groups.setdefault(%%family, []).append(%%userdn)
dn: %%userdn
2022-04-28 21:48:16 +02:00
cn: %%user
mail: %%user
sn: %%user['ldap_user_sn_' + %%family]
givenName: %%user['ldap_user_gn_' + %%family]
uid: %%user['ldap_user_uid_' + %%family]
userPassword:: %%ssha_encode(%%user['ldap_user_password_' + %%family])
2022-05-04 10:29:03 +02:00
homeDirectory: /srv/home/families/%%family/%%user
2022-05-23 08:54:15 +02:00
mailLocalAddress: %%user
%if %%user['ldap_user_aliases_' + %%family]
%for %%alias in %%user['ldap_user_aliases_' + %%family]
mailLocalAddress: %%alias
%end for
%end if
2022-05-04 10:29:03 +02:00
uidNumber: 0
gidNumber: 0
2022-04-28 21:48:16 +02:00
objectClass: top
objectClass: inetOrgPerson
2022-05-04 10:29:03 +02:00
objectClass: posixAccount
2022-05-23 08:54:15 +02:00
objectClass: inetLocalMailRecipient
2022-04-28 21:48:16 +02:00
%end for
%end for
2022-06-24 19:00:16 +02:00
## Groups
%set %%groupdn = %%calc_ldapclient_base_dn(%%ldapclient_base_dn, family_name=None, group=True)
dn: %%groupdn
ou: groups
objectClass: top
objectClass: organizationalUnit
%for %%group, %%members in %%groups.items()
dn: cn=%%group,%%groupdn
cn: %%group
objectclass: top
objectclass: groupOfNames
%for %%member in %%members
member: %%member
%end for
%end for