Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly split the domain name to support more than two levels of domain component (dc) #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tasks/configure_ldap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
register: result

- name: add the base domain
shell: ldapadd -x -D "cn=Manager,dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}" -w {{ openldap_server_rootpw }} -f {{ result.dest }} && touch {{ openldap_server_app_path }}/rootdn_created creates={{ openldap_server_app_path }}/rootdn_created
shell: ldapadd -x -D "cn=Manager,{{ domain_component }}" -w {{ openldap_server_rootpw }} -f {{ result.dest }} && touch {{ openldap_server_app_path }}/rootdn_created creates={{ openldap_server_app_path }}/rootdn_created
2 changes: 1 addition & 1 deletion templates/domain.ldif
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dn: dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}
dn: {{ domain_component }}
objectClass: domain
dc: {{ openldap_server_domain_name.split('.')[0] }}

2 changes: 1 addition & 1 deletion templates/ldap.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# See ldap.conf(5) for details
# This file should be world readable but not world writable.

BASE dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}
BASE {{ domain_component }}
{% if openldap_server_enable_ssl %}
URI ldaps://localhost
TLS_REQCERT never
Expand Down
8 changes: 4 additions & 4 deletions templates/slapd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ modulepath /usr/lib64/openldap

access to *
by self write
by dn.base="cn=Manager,dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}" write
by dn.base="cn=Manager,{{ domain_component }}" write
by * read
access to attrs=userPassword
by self write
by anonymous auth
by dn.base="cn=Manager,dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}" write
by dn.base="cn=Manager,{{ domain_component }}" write
by * none
access to attrs=shadowLastChange
by self write
by * read

database bdb
suffix "dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}"
rootdn "cn=Manager,dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}"
suffix "{{domain_component}}"
rootdn "cn=Manager,{{domain_component}}"
rootpw {{ root_password.stdout }}
#This directory has to be created and would contain the ldap database.
directory /var/lib/ldap/{{ openldap_server_domain_name }}/
Expand Down
8 changes: 4 additions & 4 deletions templates/slapd.conf_ubuntu.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ moduleload back_bdb.la

access to *
by self write
by dn.base="cn=Manager,dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}" write
by dn.base="cn=Manager,{{domain_component}}" write
by * read
access to attrs=userPassword
by self write
by anonymous auth
by dn.base="cn=Manager,dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}" write
by dn.base="cn=Manager,{{domain_component}}" write
by * none
access to attrs=shadowLastChange
by self write
by * read

database bdb
suffix "dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}"
rootdn "cn=Manager,dc={{ openldap_server_domain_name.split('.')[0] }},dc={{ openldap_server_domain_name.split('.')[1] }}"
suffix "{{domain_component}}"
rootdn "cn=Manager,{{domain_component}}"
rootpw {{ root_password.stdout }}
#This directory has to be created and would contain the ldap database.
directory /var/lib/ldap/{{ openldap_server_domain_name }}/
Expand Down
4 changes: 2 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

domain_component: "dc={{ openldap_server_domain_name.split('.') | join(',dc=') }}"
env:
RUNLEVEL: 1
RUNLEVEL: 1