Skip to content

Commit ec41ed7

Browse files
author
David Coutadeur
committed
update to OpenLDAP 2.6 + deploy certificates + new multi-master recipe (#14)
1 parent 695a689 commit ec41ed7

File tree

19 files changed

+593
-238
lines changed

19 files changed

+593
-238
lines changed

README.md

+20-17
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You'll need to store the hash value for your admin passwords. You'll get it like
2222
/usr/local/openldap/sbin/slappasswd -o module-path="/usr/local/openldap/libexec/openldap" -o module-load="argon2" -h "{ARGON2}" -s "password"
2323
```
2424

25-
Store the passwords in the vault file in: `tests/credentials-vault.yml`
25+
Store the passwords in the vault file in: `playbook/credentials-vault.yml`
2626

2727

2828
Playbook examples
@@ -38,46 +38,49 @@ ansible.cfg
3838
roles_path=../
3939
```
4040

41-
See `tests/standalone.yml`
41+
See `playbook/standalone.yml`
4242

4343
Run playbook with:
4444

45+
4546
```
46-
ansible-playbook tests/standalone.yml -i tests/inventory --ask-vault-pass
47+
ansible-playbook playbook/standalone.yml -i playbook/inventory --ask-vault-pass
4748
```
4849

49-
or:
50+
You can also run an openldap cluster with 2 masters and 2 slaves with the multimaster playbook:
5051

5152
```
52-
ansible-playbook tests/standalone.yml -i tests/inventory --vault-password-file .vault_pass
53+
ansible-playbook playbook/multimaster.yml -i playbook/inventory --ask-vault-pass
5354
```
5455

55-
If you need a two-nodes multimaster example, give a look at `tests/multimaster1.yml` and `tests/multimaster2.yml`
56+
or:
5657

58+
```
59+
ansible-playbook playbook/multimaster.yml -i playbook/inventory --vault-password-file .vault_pass
60+
```
5761

58-
Give a look to `tests/monitoring.yml` for an example of playbook that deploys LTB monitoring and statistics tools
62+
For using this cluster, you must create the corresponding machines and declare the routes, as defined in `playbook/inventory`.
5963

60-
Run the corresponding task with:
64+
You also have to fill the certificate in `playbook/certificates-vault.yml`. You can use this command for editing the file: (the default password is: secret)
6165

6266
```
63-
ansible-playbook tests/monitoring.yml -i tests/inventory
67+
ansible-vault edit playbook/certificates-vault.yml
6468
```
6569

6670

67-
If you want to install openldap on RHEL-like OS with certificates, you can define them in `tests/standalone.yml`:
71+
Give a look at `playbook/group_vars/prod.yml`, `playbook/host_vars/master1.yml` and `playbook/host_vars/master2.yml` for variable customization
72+
You can also use `--extra-vars variable=value` at the command line for overloading any variable.
6873

69-
```
70-
ldaptoolbox_openldap_olcTLSCACertificateFile=/etc/pki/ca-trust/source/anchors/ca-cert.pem
71-
ldaptoolbox_openldap_olcTLSCertificateFile=/etc/pki/tls/certs/ldaps-cert.pem
72-
ldaptoolbox_openldap_olcTLSCertificateKeyFile=/etc/pki/tls/private/ldaps.key
73-
```
7474

75-
You can also overload these variables in the command line:
75+
Give a look to `playbook/monitoring.yml` for an example of playbook that deploys LTB monitoring and statistics tools
76+
77+
Run the corresponding task with:
7678

7779
```
78-
ansible-playbook tests/standalone.yml -i tests/inventory --ask-vault-pass --extra-vars "ldaptoolbox_openldap_olcTLSCACertificateFile=/etc/pki/ca-trust/source/anchors/ca-cert.pem ldaptoolbox_openldap_olcTLSCertificateFile=/etc/pki/tls/certs/ldaps-cert.pem ldaptoolbox_openldap_olcTLSCertificateKeyFile=/etc/pki/tls/private/ldaps.key"
80+
ansible-playbook playbook/monitoring.yml -i playbook/inventory
7981
```
8082

83+
8184
License
8285
-------
8386

ansible.cfg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[defaults]
2+
roles_path=../
3+
[colors]
4+
warn = white
5+
error = yellow

defaults/main.yml

+20-49
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ldaptoolbox_openldap_apt_key_url: "https://ltb-project.org/documentation/_static
99
ldaptoolbox_openldap_apt_key_id: "3FC3FD92ABA3975D2BEB95A70AC51F926D45BFC5"
1010
ldaptoolbox_openldap_apt_repo_filename: "ltb-project-openldap"
1111
ldaptoolbox_openldap_apt_keyrings_path: /usr/share/keyrings
12-
ldaptoolbox_openldap_apt_repo: "deb [arch=amd64 signed-by=/usr/share/keyrings/ltb-project-openldap.gpg] http://ltb-project.org/debian/openldap25/bullseye bullseye main"
12+
ldaptoolbox_openldap_apt_repo: "deb [arch=amd64 signed-by=/usr/share/keyrings/ltb-project-openldap.gpg] http://ltb-project.org/debian/openldap26/bookworm bookworm main"
1313
ldaptoolbox_openldap_apt_validate_certs: "true"
1414

1515
# Packages
@@ -35,6 +35,10 @@ ldaptoolbox_openldap_slapd_cli_cmd: /usr/local/openldap/sbin/slapd-cli
3535
# OpenLDAP configuration
3636
################################################################################
3737

38+
# Options
39+
olcAttributeOptions:
40+
- lang-
41+
3842
# Suffix
3943
ldaptoolbox_openldap_suffix: "{{ ldaptoolbox_openldap_suffix }}"
4044

@@ -51,13 +55,20 @@ ldaptoolbox_openldap_olcTLSProtocolMin: 3.3
5155

5256
# Log level
5357
ldaptoolbox_openldap_olcLogLevel: stats
58+
ldaptoolbox_openldap_olcLogFile: "/var/log/slapd-ltb/slapd.log"
59+
ldaptoolbox_openldap_olcLogFileRotate: "30 1024 24"
60+
61+
# Size limit
62+
ldaptoolbox_openldap_olcSizeLimit: 1000
5463

5564
# Enabled modules
5665
ldaptoolbox_openldap_module_list:
5766
- argon2.la
5867
- pw-pbkdf2.la
68+
- pw-sha2.la
5969
- back_mdb.la
6070
- dynlist.la
71+
- memberof.la
6172
- ppolicy.la
6273
- syncprov.la
6374
- unique.la
@@ -104,59 +115,19 @@ ldaptoolbox_openldap_database_olcLimits:
104115

105116
# Indexes definition
106117
ldaptoolbox_openldap_database_olcDbIndexes:
118+
- "entryCSN,entryUUID eq"
107119
- "objectClass eq"
108-
- "entryUUID eq"
109-
- "entryCSN eq"
110-
- "cn pres,eq,sub"
111-
- "uid pres,eq,sub"
112-
113-
########################
114-
# Replication directives
115-
########################
120+
- "cn eq,sub"
121+
- "uid pres,eq"
122+
- "givenName pres,eq,sub"
123+
- "l pres,eq"
124+
- "employeeType pres,eq"
125+
- "mail pres,eq,sub"
126+
- "sn pres,eq,sub"
116127

117-
ldaptoolbox_openldap_olcServerID: 1
118-
ldaptoolbox_openldap_syncrepl:
119-
- rid: "001"
120-
provider: "ldap://localhost:389/"
121-
tlscert: "{{ ldaptoolbox_openldap_olcTLSCertificateFile }}"
122-
tlskey: "{{ ldaptoolbox_openldap_olcTLSCertificateKeyFile }}"
123-
tlscacert: "{{ ldaptoolbox_openldap_olcTLSCACertificateFile }}"
124-
tlsreqcert: "demand"
125-
binddn: "uid=syncrepl,ou=accounts,ou=infrastructure,{{ ldaptoolbox_openldap_suffix }}"
126-
password: "{{ ldaptoolbox_openldap_syncrepl_password_vault }}"
127-
searchbase: "{{ ldaptoolbox_openldap_suffix }}"
128-
scope: "sub"
129-
type: "refreshAndPersist"
130-
retry: "5 5 300 +"
131-
- rid: "002"
132-
provider: "ldap://localhost:389/"
133-
tlscert: "{{ ldaptoolbox_openldap_olcTLSCertificateFile }}"
134-
tlskey: "{{ ldaptoolbox_openldap_olcTLSCertificateKeyFile }}"
135-
tlscacert: "{{ ldaptoolbox_openldap_olcTLSCACertificateFile }}"
136-
tlsreqcert: "demand"
137-
binddn: "uid=syncrepl,ou=accounts,ou=infrastructure,{{ ldaptoolbox_openldap_suffix }}"
138-
password: "{{ ldaptoolbox_openldap_syncrepl_password_vault }}"
139-
searchbase: "{{ ldaptoolbox_openldap_suffix }}"
140-
scope: "sub"
141-
type: "refreshAndPersist"
142-
retry: "5 5 300 +"
143128
ldaptoolbox_openldap_overlay_syncprov_olcSpCheckpoint: "100 10"
144129
ldaptoolbox_openldap_overlay_syncprov_olcSpSessionlog: "100"
145130

146131
########################
147132
# Overlays configuration
148133
########################
149-
150-
# Password policy
151-
ldaptoolbox_openldap_overlay_ppolicy_olcPPolicyDefault: "cn=default,ou=ppolicies,{{ ldaptoolbox_openldap_suffix }}"
152-
ldaptoolbox_openldap_overlay_ppolicy_olcPPolicyHashCleartext: "TRUE"
153-
ldaptoolbox_openldap_overlay_ppolicy_olcPPolicyUseLockout: "TRUE"
154-
155-
# Referential integrity
156-
ldaptoolbox_openldap_overlay_refint_olcRefintAttribute: "member"
157-
ldaptoolbox_openldap_overlay_refint_olcRefintNothing: "cn=nothing,{{ ldaptoolbox_openldap_suffix }}"
158-
159-
# Dynamic groups (dynlist)
160-
ldaptoolbox_openldap_overlay_dynlist_olcDlAttrSet: "groupOfURLs memberURL member+memberOf@groupOfNames*"
161-
162-

0 commit comments

Comments
 (0)