Skip to content

Commit

Permalink
Allow to start without certificates ( without ldaps or starttls ) (#11)
Browse files Browse the repository at this point in the history
- update backup template with removal of optional cert related values if not provided
- fix useful for rhel quick validation tests
  - without this test would require many more change in default that are for debian.
  • Loading branch information
philhaworteks authored and davidcoutadeur committed Oct 18, 2023
1 parent 2b3cb1a commit c906a6a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 29 deletions.
31 changes: 31 additions & 0 deletions tasks/ldaptoolbox-certificates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

- name: allow ldap to read TLS certificates
ansible.builtin.user:
name: "{{ ldaptoolbox_openldap_configuration_owner }}"
groups: "{{ ldaptoolbox_openldap_sslgroup }}"
state: present
when: ( ldaptoolbox_openldap_olcTLSCertificateFile )

- name: Ensure correct file ownership, group and permissions for CA
ansible.builtin.file:
path: "{{ ldaptoolbox_openldap_olcTLSCACertificateFile }}"
owner: "root"
group: "root"
mode: "644"
when: ( ldaptoolbox_openldap_olcTLSCACertificateFile )

- name: Ensure correct file ownership, group and permissions for certificate
ansible.builtin.file:
path: "{{ ldaptoolbox_openldap_olcTLSCertificateFile }}"
owner: "root"
group: "root"
mode: "644"
when: ( ldaptoolbox_openldap_olcTLSCertificateFile )

- name: Ensure correct file ownership, group and permissions for key
ansible.builtin.file:
path: "{{ ldaptoolbox_openldap_olcTLSCertificateKeyFile }}"
owner: "root"
group: "{{ ldaptoolbox_openldap_sslgroup }}"
mode: "640"
when: ( ldaptoolbox_openldap_olcTLSCertificateKeyFile )
29 changes: 2 additions & 27 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,8 @@
name: "{{ ldaptoolbox_openldap_packages_base }}"
state: "{{ ldaptoolbox_openldap_packages_state }}"

- name: allow ldap to read TLS certificates
ansible.builtin.user:
name: "{{ ldaptoolbox_openldap_configuration_owner }}"
groups: "{{ ldaptoolbox_openldap_sslgroup }}"
state: present
when: ldaptoolbox_openldap_olcTLSCertificateFile is defined

- name: Ensure correct file ownership, group and permissions for CA
ansible.builtin.file:
path: "{{ ldaptoolbox_openldap_olcTLSCACertificateFile }}"
owner: "root"
group: "root"
mode: "644"

- name: Ensure correct file ownership, group and permissions for certificate
ansible.builtin.file:
path: "{{ ldaptoolbox_openldap_olcTLSCertificateFile }}"
owner: "root"
group: "root"
mode: "644"

- name: Ensure correct file ownership, group and permissions for key
ansible.builtin.file:
path: "{{ ldaptoolbox_openldap_olcTLSCertificateKeyFile }}"
owner: "root"
group: "{{ ldaptoolbox_openldap_sslgroup }}"
mode: "640"
- name: setup certificates
include_tasks: ldaptoolbox-certificates.yml

# Configuration
# -------------
Expand Down
8 changes: 6 additions & 2 deletions templates/var/backups/openldap/config.ldif
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ olcServerID: {{ ldaptoolbox_openldap_olcServerID }}
olcSockbufMaxIncoming: 262143
olcSockbufMaxIncomingAuth: 16777215
olcThreads: 16
{% if ldaptoolbox_openldap_olcTLSCACertificateFile %}
olcTLSCACertificateFile: {{ ldaptoolbox_openldap_olcTLSCACertificateFile }}
olcTLSCertificateFile: {{ ldaptoolbox_openldap_olcTLSCertificateFile }}
olcTLSCertificateKeyFile: {{ ldaptoolbox_openldap_olcTLSCertificateKeyFile }}
olcTLSCRLCheck: none
olcTLSVerifyClient: allow
{% endif %}
{% if ldaptoolbox_openldap_olcTLSCertificateFile %}
olcTLSProtocolMin: {{ ldaptoolbox_openldap_olcTLSProtocolMin }}
olcTLSCertificateFile: {{ ldaptoolbox_openldap_olcTLSCertificateFile }}
olcTLSCertificateKeyFile: {{ ldaptoolbox_openldap_olcTLSCertificateKeyFile }}
{% endif %}
olcToolThreads: 1
olcWriteTimeout: 0
olcLogLevel: {{ ldaptoolbox_openldap_olcLogLevel }}
Expand Down

0 comments on commit c906a6a

Please sign in to comment.