Skip to content
Snippets Groups Projects
Verified Commit 741a13b4 authored by ynerant's avatar ynerant
Browse files

[re2o-ldap-replica] Support LDAPS


Signed-off-by: ynerant's avatarYohann D'ANELLO <ynerant@crans.org>
parent 05c641fa
No related branches found
No related tags found
1 merge request!254Cachan
......@@ -6,3 +6,5 @@ glob_re2o_ldap_replica:
suffix: dc=crans,dc=org
url: "ldaps://{{ query('ldap', 'ip', 're2o-ldap', 'adm') | ipv4 | first }}:636"
root_password_hash: "{{ vault.ldap_master_password_hash }}"
certificate: "{{ vault.ldap_re2o_certificate }}"
private_key: "{{ vault.ldap_re2o_private_key }}"
---
- name: Restart slapd
service:
name: slapd.service
state: restarted
......@@ -42,10 +42,10 @@
- /etc/ldap/slapd.d
- /var/lib/ldap
- name: Copy ldiff files
- name: Copy ldif files
template:
src: 'ldap/{{ item }}.ldiff.j2'
dest: '/tmp/{{ item }}.ldiff'
src: 'ldap/{{ item }}.ldif.j2'
dest: '/tmp/{{ item }}.ldif'
owner: openldap
group: openldap
mode: 0600
......@@ -53,15 +53,16 @@
- db
- schema
- consumer_simple_sync
- certinfo
- name: Initialize re2o-ldap schema
when: not installation.stat.exists
shell: slapadd -n 0 -l /tmp/schema.ldiff -F /etc/ldap/slapd.d/
shell: slapadd -n 0 -l /tmp/schema.ldif -F /etc/ldap/slapd.d/
become_user: openldap
- name: Initialize re2o-ldap database
when: not installation.stat.exists
shell: slapadd -n 1 -l /tmp/db.ldiff
shell: slapadd -n 1 -l /tmp/db.ldif
become_user: openldap
- name: Start slapd
......@@ -72,7 +73,30 @@
- name: Enable data replication
when: not installation.stat.exists
shell: ldapadd -Q -Y EXTERNAL -H ldapi:/// -f /tmp/consumer_simple_sync.ldiff
shell: ldapadd -Q -Y EXTERNAL -H ldapi:/// -f /tmp/consumer_simple_sync.ldif
- name: Copy TLS certificate
template:
src: "ldap/{{ item }}.j2"
dest: "/etc/ldap/{{ item }}"
owner: openldap
group: openldap
mode: 0600
loop:
- ldap.pem
- ldap.key
- name: Load TLS certificates
when: not installation.stat.exists
shell: ldapmodify -Y EXTERNAL -H ldapi:/// -f /tmp/certinfo.ldif
- name: Enable LDAPS
lineinfile:
path: /etc/default/slapd
regexp: '^SLAPD_SERVICES='
line: 'SLAPD_SERVICES="ldap:/// ldaps:/// ldapi:///"'
notify: Restart slapd
check_mode: no
- name: Touch installation marker
when: not installation.stat.exists
......
dn: cn=config
add: olcTLSCertificateFile
olcTLSCertificateFile: /etc/ldap/ldap.pem
-
add: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/ldap/ldap.key
{{ re2o_ldap_replica.private_key }}
{{ re2o_ldap_replica.certificate }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment