Commit f165f9a3 authored by nimrod's avatar nimrod
Browse files

- Flush handlers before configuring olcTLS*, so that slapd restarts and it's

  ssl-cert group membership takes affect.
- Use with_items instead of with_dict to force the order of the loop items.
- Enable service ldaps bind after the olcTLS* settings were committed.
parent f7714178
Loading
Loading
Loading
Loading
+23 −17
Changes for tasks/main.yml: 23 added lines, 17 removed lines.
Original line number Diff line number Diff line
@@ -41,15 +41,6 @@
  notify:
    - Restart OpenLDAP

- name: Set slapd binds
  lineinfile:
    dest: /etc/default/slapd
    line: SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///"
    regexp: '^SLAPD_SERVICES='
    state: present
  notify:
    - Restart OpenLDAP

- name: Set default ldap client settings
  lineinfile:
    dest: /etc/ldap/ldap.conf
@@ -57,23 +48,29 @@
    regexp: '^URI'
    state: present

- meta: flush_handlers

- name: Allow anonymous read access to chsh and chfn
  ldap_attr:
    dn: 'olcDatabase={1}{{ slapd_backend }},cn=config'
    name: olcAccess
    values: '{1}to attrs=loginShell,gecos by dn="cn=admin,dc=example,dc=com" write by self write by * read'
    values: '{1}to attrs=loginShell,gecos by dn="cn=admin,{{ openldap_basedn }}" write by self write by * read'
    state: exact

- name: Configure olcTLS attributes
  with_dict:
    olcTLSCACertificateFile: '{{ tls_ca_cert_path }}'
    olcTLSCertificateKeyFile: '{{ tls_key_path }}'
    olcTLSCertificateFile: '{{ tls_cert_path }}'
    olcTLSCipherSuite: '+AES-128-GCM:+AES-256-GCM:+AES-128-CBC:+AES-256-CBC:+ECDHE-RSA:+DHE-RSA:+AEAD:+SHA1:+SHA256:+SHA384'
  with_items:
  - name: olcTLSCertificateFile
    values: '{{ tls_cert_path }}'
  - name: olcTLSCertificateKeyFile
    values: '{{ tls_key_path }}'
  - name: olcTLSCACertificateFile
    values: '{{ tls_ca_cert_path }}'
  - name: olcTLSCipherSuite
    values: '+AES-128-GCM:+AES-256-GCM:+AES-128-CBC:+AES-256-CBC:+ECDHE-RSA:+DHE-RSA:+AEAD:+SHA1:+SHA256:+SHA384'
  ldap_attr:
    dn: 'cn=config'
    name: '{{ item.key }}'
    values: '{{ item.value }}'
    name: '{{ item.name }}'
    values: '"{{ item.values }}"'
    state: exact
  notify:
    - Restart OpenLDAP
@@ -86,6 +83,15 @@
    group: root
    mode: '0755'

- name: Set slapd binds
  lineinfile:
    dest: /etc/default/slapd
    line: SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///"
    regexp: '^SLAPD_SERVICES='
    state: present
  notify:
    - Restart OpenLDAP

- name: Allow LDAPS port
  ufw:
    rule: limit