dataset/seed/openldap/templates/config_acl.ldif

55 lines
1.8 KiB
Text
Raw Normal View History

2023-01-17 21:43:32 +01:00
#RISOTTO: do not compare
2023-06-23 08:12:05 +02:00
{% set name_family = 'gnunux' %}
{% set dns = {} %}
{% set groups = [] %}
{{ groups.append('cn=remote_test0,' + ldap_base_dn) }}
{{ groups.append('cn=remote_test1,' + ldap_base_dn) }}
{{ groups.append('cn=remote_test2,' + ldap_base_dn) }}
{{ dns.setdefault(None, []).append(('cn=remote_test0,' + ldap_base_dn, 'read')) }}
{{ dns.setdefault('all', []).append(('cn=remote_test1,' + ldap_base_dn, 'read')) }}
{{ dns.setdefault(name_family, []).append(('cn=remote_test2,' + ldap_base_dn, 'read')) }}
{% for remote in accounts.remotes %}
{% set name = remote|normalize_family %}
{% set family = accounts['remote_' + name]['family_' + name] %}
{{ groups.append(accounts['remote_' + name]['dn_' + name]) }}
{% set right = 'read' %}
{{ dns.setdefault(family, []).append((accounts['remote_' + name]['dn_' + name], right)) }}
{% endfor %}
2022-03-08 19:42:28 +01:00
dn: olcDatabase={2}mdb,cn=config
changetype:modify
replace: olcAccess
olcAccess: {0}to attrs=userPassword
by self write
by anonymous auth
by * none
2023-06-23 08:12:05 +02:00
olcAccess: {1}to dn.subtree="{{ ldap_group_dn }}"
{% for group in groups %}
by dn="{{ group }}" read
{% endfor %}
2022-06-24 19:00:16 +02:00
by * none
2023-06-23 08:12:05 +02:00
{% set acl = {'idx': 2} %}
{% for family, remotes in dns.items() %}
{% if family != 'all' %}
olcAccess: { {{- acl['idx'] -}} }to dn.subtree="{{ ldap_base_dn|calc_ldapclient_base_dn(family) }}"
2022-05-04 10:29:03 +02:00
by self read
2023-06-23 08:12:05 +02:00
{% for remote in remotes %}
by dn="{{ remote[0] }}" {{ remote[1] }}
{% endfor %}
{% if 'all' in dns %}
{% for remote in dns['all'] %}
by dn="{{ remote[0] }}" {{ remote[1] }}
{% endfor %}
{% endif %}
{% set x=acl.__setitem__('idx', acl['idx'] + 1) %}
2022-03-08 19:42:28 +01:00
by * none
2023-06-23 08:12:05 +02:00
{% endif %}
{% endfor %}
{% if 'all' in dns %}
olcAccess: { {{- acl['idx'] -}} }to dn.subtree="{{ ldap_account_dn }}"
2022-07-07 09:37:49 +02:00
by self read
2023-06-23 08:12:05 +02:00
{% for remote in dns['all'] %}
by dn="{{ remote[0] }}" {{ remote[1] }}
{% endfor %}
2022-07-07 09:37:49 +02:00
by * none
2023-06-23 08:12:05 +02:00
{% endif %}