Skip to content

Commit f755a4c

Browse files
committed
Merge branch 'hotfix-1.1.5' into stable
2 parents 055b858 + 279bd77 commit f755a4c

File tree

8 files changed

+79
-45
lines changed

8 files changed

+79
-45
lines changed

CHANGELOG.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# Changelog
22

3+
## 1.1.5
4+
Fix :
5+
- Restarting container with new environment #44
6+
- Cannot rerun with customized certificate at 1.1.1 #36
7+
38
## 1.1.4
4-
- Remove environment variable LDAP_TLS_PROTOCOL_MIN as it takes no effect, see #69
5-
- Adjust default GnuTLS cipher string according to Red Hat's TLS hardening guide.
6-
This by default also restricts the TLS protocol version to 1.2. For reference,
7-
see #69
8-
- Fix Error in Adding "Billy" #71
9-
- Add docker-compose.yml example and update kubernetes examples #52
9+
Fix :
10+
- Remove environment variable LDAP_TLS_PROTOCOL_MIN as it takes no effect, see #69
11+
- Adjust default GnuTLS cipher string according to Red Hat's TLS hardening guide.
12+
This by default also restricts the TLS protocol version to 1.2. For reference,
13+
see #69
14+
- Fix Error in Adding "Billy" #71
15+
- Add docker-compose.yml example and update kubernetes examples #52
1016

1117
Merge pull request :
1218
- Update LDAP_TLS_CIPHER_SUITE, remove LDAP_TLS_PROTOCOL_MIN #70

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NAME = osixia/openldap
2-
VERSION = 1.1.4
2+
VERSION = 1.1.5
33

44
.PHONY: all build build-nocache test tag_latest release
55

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[hub]: https://hub.docker.com/r/osixia/openldap/
77

8-
Latest release: 1.1.4 - OpenLDAP 2.4.40 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/openldap/) 
8+
Latest release: 1.1.5 - OpenLDAP 2.4.40 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/openldap/) 
99

1010
A docker image to run OpenLDAP.
1111

@@ -35,7 +35,7 @@ A docker image to run OpenLDAP.
3535
- [Link environment file](#link-environment-file)
3636
- [Make your own image or extend this image](#make-your-own-image-or-extend-this-image)
3737
- [Advanced User Guide](#advanced-user-guide)
38-
- [Extend osixia/openldap:1.1.4 image](#extend-osixiaopenldap114-image)
38+
- [Extend osixia/openldap:1.1.5 image](#extend-osixiaopenldap115-image)
3939
- [Make your own openldap image](#make-your-own-openldap-image)
4040
- [Tests](#tests)
4141
- [Kubernetes](#kubernetes)
@@ -53,7 +53,7 @@ If you find this image useful here's how you can help:
5353
## Quick Start
5454
Run OpenLDAP docker image:
5555

56-
docker run --name my-openldap-container --detach osixia/openldap:1.1.4
56+
docker run --name my-openldap-container --detach osixia/openldap:1.1.5
5757

5858
This start a new container with OpenLDAP running inside. Let's make the first search in our LDAP container:
5959

@@ -89,7 +89,7 @@ It will create an empty ldap for the company **Example Inc.** and the domain **e
8989
By default the admin has the password **admin**. All those default settings can be changed at the docker command line, for example:
9090

9191
docker run --env LDAP_ORGANISATION="My Company" --env LDAP_DOMAIN="my-company.com" \
92-
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.4
92+
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.5
9393

9494
#### Data persistence
9595

@@ -114,7 +114,7 @@ simply mount this directories as a volume to `/var/lib/ldap` and `/etc/ldap/slap
114114

115115
docker run --volume /data/slapd/database:/var/lib/ldap \
116116
--volume /data/slapd/config:/etc/ldap/slapd.d
117-
--detach osixia/openldap:1.1.4
117+
--detach osixia/openldap:1.1.5
118118

119119
You can also use data volume containers. Please refer to:
120120
> [https://docs.docker.com/userguide/dockervolumes/](https://docs.docker.com/userguide/dockervolumes/)
@@ -134,7 +134,7 @@ If you are looking for a simple solution to administrate your ldap server you ca
134134
#### Use auto-generated certificate
135135
By default TLS is enable, a certificate is created with the container hostname (it can be set by docker run --hostname option eg: ldap.example.org).
136136

137-
docker run --hostname ldap.my-company.com --detach osixia/openldap:1.1.4
137+
docker run --hostname ldap.my-company.com --detach osixia/openldap:1.1.5
138138

139139
#### Use your own certificate
140140

@@ -144,24 +144,24 @@ You can set your custom certificate at run time, by mounting a directory contain
144144
--env LDAP_TLS_CRT_FILENAME=my-ldap.crt \
145145
--env LDAP_TLS_KEY_FILENAME=my-ldap.key \
146146
--env LDAP_TLS_CA_CRT_FILENAME=the-ca.crt \
147-
--detach osixia/openldap:1.1.4
147+
--detach osixia/openldap:1.1.5
148148

149149
Other solutions are available please refer to the [Advanced User Guide](#advanced-user-guide)
150150

151151
#### Disable TLS
152152
Add --env LDAP_TLS=false to the run command:
153153

154-
docker run --env LDAP_TLS=false --detach osixia/openldap:1.1.4
154+
docker run --env LDAP_TLS=false --detach osixia/openldap:1.1.5
155155

156156
### Multi master replication
157157
Quick example, with the default config.
158158

159159
#Create the first ldap server, save the container id in LDAP_CID and get its IP:
160-
LDAP_CID=$(docker run --hostname ldap.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.1.4)
160+
LDAP_CID=$(docker run --hostname ldap.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.1.5)
161161
LDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP_CID)
162162

163163
#Create the second ldap server, save the container id in LDAP2_CID and get its IP:
164-
LDAP2_CID=$(docker run --hostname ldap2.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.1.4)
164+
LDAP2_CID=$(docker run --hostname ldap2.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.1.5)
165165
LDAP2_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP2_CID)
166166

167167
#Add the pair "ip hostname" to /etc/hosts on each containers,
@@ -197,7 +197,7 @@ You may have some problems with mounted files on some systems. The startup scrip
197197

198198
To fix that run the container with `--copy-service` argument :
199199

200-
docker run [your options] osixia/openldap:1.1.4 --copy-service
200+
docker run [your options] osixia/openldap:1.1.5 --copy-service
201201

202202
### Debug
203203

@@ -206,11 +206,11 @@ Available levels are: `none`, `error`, `warning`, `info`, `debug` and `trace`.
206206

207207
Example command to run the container in `debug` mode:
208208

209-
docker run --detach osixia/openldap:1.1.4 --loglevel debug
209+
docker run --detach osixia/openldap:1.1.5 --loglevel debug
210210

211211
See all command line options:
212212

213-
docker run osixia/openldap:1.1.4 --help
213+
docker run osixia/openldap:1.1.5 --help
214214

215215

216216
## Environment Variables
@@ -273,7 +273,7 @@ Replication options:
273273

274274
If you want to set this variable at docker run command add the tag `#PYTHON2BASH:` and convert the yaml in python:
275275

276-
docker run --env LDAP_REPLICATION_HOSTS="#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']" --detach osixia/openldap:1.1.4
276+
docker run --env LDAP_REPLICATION_HOSTS="#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']" --detach osixia/openldap:1.1.5
277277

278278
To convert yaml to python online: http://yaml-online-parser.appspot.com/
279279

@@ -288,7 +288,7 @@ Other environment variables:
288288
Environment variables can be set by adding the --env argument in the command line, for example:
289289

290290
docker run --env LDAP_ORGANISATION="My company" --env LDAP_DOMAIN="my-company.com" \
291-
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.4
291+
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.5
292292

293293
Be aware that environment variable added in command line will be available at any time
294294
in the container. In this example if someone manage to open a terminal in this container
@@ -299,28 +299,28 @@ he will be able to read the admin password in clear text from environment variab
299299
For example if your environment files **my-env.yaml** and **my-env.yaml.startup** are in /data/ldap/environment
300300

301301
docker run --volume /data/ldap/environment:/container/environment/01-custom \
302-
--detach osixia/openldap:1.1.4
302+
--detach osixia/openldap:1.1.5
303303

304304
Take care to link your environment files folder to `/container/environment/XX-somedir` (with XX < 99 so they will be processed before default environment files) and not directly to `/container/environment` because this directory contains predefined baseimage environment files to fix container environment (INITRD, LANG, LANGUAGE and LC_CTYPE).
305305

306306
Note: the container will try to delete the **\*.yaml.startup** file after the end of startup files so the file will also be deleted on the docker host. To prevent that : use --volume /data/ldap/environment:/container/environment/01-custom**:ro** or set all variables in **\*.yaml** file and don't use **\*.yaml.startup**:
307307

308308
docker run --volume /data/ldap/environment/my-env.yaml:/container/environment/01-custom/env.yaml \
309-
--detach osixia/openldap:1.1.4
309+
--detach osixia/openldap:1.1.5
310310

311311
#### Make your own image or extend this image
312312

313313
This is the best solution if you have a private registry. Please refer to the [Advanced User Guide](#advanced-user-guide) just below.
314314

315315
## Advanced User Guide
316316

317-
### Extend osixia/openldap:1.1.4 image
317+
### Extend osixia/openldap:1.1.5 image
318318

319319
If you need to add your custom TLS certificate, bootstrap config or environment files the easiest way is to extends this image.
320320

321321
Dockerfile example:
322322

323-
FROM osixia/openldap:1.1.4
323+
FROM osixia/openldap:1.1.5
324324
MAINTAINER Your Name <[email protected]>
325325

326326
ADD bootstrap /container/service/slapd/assets/config/bootstrap
@@ -342,7 +342,7 @@ Clone this project:
342342
Adapt Makefile, set your image NAME and VERSION, for example:
343343

344344
NAME = osixia/openldap
345-
VERSION = 1.1.4
345+
VERSION = 1.1.5
346346

347347
become:
348348
NAME = cool-guy/openldap

example/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '2'
22
services:
33
openldap:
4-
image: osixia/openldap:1.1.4
4+
image: osixia/openldap:1.1.5
55
container_name: openldap
66
environment:
77
LDAP_LOG_LEVEL: "256"

example/extend-osixia-openldap/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM osixia/openldap:1.1.4
1+
FROM osixia/openldap:1.1.5
22
MAINTAINER Your Name <[email protected]>
33

44
ADD bootstrap /container/service/slapd/assets/config/bootstrap

example/kubernetes/simple/ldap-rc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
spec:
1616
containers:
1717
- name: ldap
18-
image: osixia/openldap:1.1.4
18+
image: osixia/openldap:1.1.5
1919
volumeMounts:
2020
- name: ldap-data
2121
mountPath: /var/lib/ldap

example/kubernetes/using-secrets/ldap-rc.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ spec:
1515
spec:
1616
containers:
1717
- name: ldap
18-
image: osixia/openldap:1.1.4
19-
command:
20-
- --copy-service
18+
image: osixia/openldap:1.1.5
19+
args: ["--copy-service"]
2120
volumeMounts:
2221
- name: ldap-data
2322
mountPath: /var/lib/ldap

image/service/slapd/startup.sh

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ chown -R openldap:openldap ${CONTAINER_SERVICE_DIR}/slapd
2121

2222
FIRST_START_DONE="${CONTAINER_STATE_DIR}/slapd-first-start-done"
2323
WAS_STARTED_WITH_TLS="/etc/ldap/slapd.d/docker-openldap-was-started-with-tls"
24+
WAS_STARTED_WITH_TLS_ENFORCE="/etc/ldap/slapd.d/docker-openldap-was-started-with-tls-enforce"
2425
WAS_STARTED_WITH_REPLICATION="/etc/ldap/slapd.d/docker-openldap-was-started-with-replication"
2526

2627
# CONTAINER_SERVICE_DIR and CONTAINER_STATE_DIR variables are set by
@@ -124,9 +125,18 @@ EOF
124125
fi
125126

126127
# if the config was bootstraped with TLS
127-
# to avoid error (#6) we hard delete TLS config
128+
# to avoid error (#6) (#36) and (#44)
129+
# we create fake temporary certificates if they do not exists
128130
if [ -e "$WAS_STARTED_WITH_TLS" ]; then
129-
sed -i '/olcTLS/d' /etc/ldap/slapd.d/cn\=config.ldif
131+
source $WAS_STARTED_WITH_TLS
132+
133+
log-helper debug "Check previous TLS certificates..."
134+
135+
cfssl-helper $LDAP_CFSSL_PREFIX $PREVIOUS_LDAP_TLS_CRT_PATH $PREVIOUS_LDAP_TLS_KEY_PATH $PREVIOUS_LDAP_TLS_CA_CRT_PATH
136+
[ -f ${PREVIOUS_LDAP_TLS_DH_PARAM_PATH} ] || openssl dhparam -out ${LDAP_TLS_DH_PARAM_PATH} 2048
137+
138+
chmod 600 ${PREVIOUS_LDAP_TLS_DH_PARAM_PATH}
139+
chown openldap:openldap $PREVIOUS_LDAP_TLS_CRT_PATH $PREVIOUS_LDAP_TLS_KEY_PATH $PREVIOUS_LDAP_TLS_CA_CRT_PATH $PREVIOUS_LDAP_TLS_DH_PARAM_PATH
130140
fi
131141

132142
# start OpenLDAP
@@ -217,6 +227,18 @@ EOF
217227
#
218228
# TLS config
219229
#
230+
if [ -e "$WAS_STARTED_WITH_TLS" ] && [ "${LDAP_TLS,,}" != "true" ]; then
231+
log-helper error "/!\ WARNING: LDAP_TLS=false but the container was previously started with LDAP_TLS=true"
232+
log-helper error "TLS can't be disabled once added. Ignoring LDAP_TLS=false."
233+
LDAP_TLS=true
234+
fi
235+
236+
if [ -e "$WAS_STARTED_WITH_TLS_ENFORCE" ] && [ "${LDAP_TLS_ENFORCE,,}" != "true" ]; then
237+
log-helper error "/!\ WARNING: LDAP_TLS_ENFORCE=false but the container was previously started with LDAP_TLS_ENFORCE=true"
238+
log-helper error "TLS enforcing can't be disabled once added. Ignoring LDAP_TLS_ENFORCE=false."
239+
LDAP_TLS_ENFORCE=true
240+
fi
241+
220242
if [ "${LDAP_TLS,,}" == "true" ]; then
221243

222244
log-helper info "Add TLS config..."
@@ -247,7 +269,12 @@ EOF
247269
sed -i "s|{{ LDAP_TLS_VERIFY_CLIENT }}|${LDAP_TLS_VERIFY_CLIENT}|g" ${CONTAINER_SERVICE_DIR}/slapd/assets/config/tls/tls-enable.ldif
248270

249271
ldapmodify -Y EXTERNAL -Q -H ldapi:/// -f ${CONTAINER_SERVICE_DIR}/slapd/assets/config/tls/tls-enable.ldif 2>&1 | log-helper debug
250-
touch $WAS_STARTED_WITH_TLS
272+
273+
[[ -f "$WAS_STARTED_WITH_TLS" ]] && rm -f "$WAS_STARTED_WITH_TLS"
274+
echo "export PREVIOUS_LDAP_TLS_CA_CRT_PATH=${LDAP_TLS_CA_CRT_PATH}" > $WAS_STARTED_WITH_TLS
275+
echo "export PREVIOUS_LDAP_TLS_CRT_PATH=${LDAP_TLS_CRT_PATH}" >> $WAS_STARTED_WITH_TLS
276+
echo "export PREVIOUS_LDAP_TLS_KEY_PATH=${LDAP_TLS_KEY_PATH}" >> $WAS_STARTED_WITH_TLS
277+
echo "export PREVIOUS_LDAP_TLS_DH_PARAM_PATH=${LDAP_TLS_DH_PARAM_PATH}" >> $WAS_STARTED_WITH_TLS
251278

252279
# ldap client config
253280
sed -i --follow-symlinks "s,TLS_CACERT.*,TLS_CACERT ${LDAP_TLS_CA_CRT_PATH},g" /etc/ldap/ldap.conf
@@ -263,18 +290,20 @@ EOF
263290
if [ "${LDAP_TLS_ENFORCE,,}" == "true" ]; then
264291
log-helper info "Add enforce TLS..."
265292
ldapmodify -Y EXTERNAL -Q -H ldapi:/// -f ${CONTAINER_SERVICE_DIR}/slapd/assets/config/tls/tls-enforce-enable.ldif 2>&1 | log-helper debug
293+
touch $WAS_STARTED_WITH_TLS_ENFORCE
266294

267-
# disable tls enforcing
268-
else
269-
log-helper info "Disable enforce TLS..."
270-
ldapmodify -Y EXTERNAL -Q -H ldapi:/// -f ${CONTAINER_SERVICE_DIR}/slapd/assets/config/tls/tls-enforce-disable.ldif 2>&1 | log-helper debug || true
295+
# disable tls enforcing (not possible for now)
296+
#else
297+
#log-helper info "Disable enforce TLS..."
298+
#ldapmodify -Y EXTERNAL -Q -H ldapi:/// -f ${CONTAINER_SERVICE_DIR}/slapd/assets/config/tls/tls-enforce-disable.ldif 2>&1 | log-helper debug || true
299+
#[[ -f "$WAS_STARTED_WITH_TLS_ENFORCE" ]] && rm -f "$WAS_STARTED_WITH_TLS_ENFORCE"
271300
fi
272301

273-
else
274-
log-helper info "Disable TLS config..."
275-
276-
ldapmodify -c -Y EXTERNAL -Q -H ldapi:/// -f ${CONTAINER_SERVICE_DIR}/slapd/assets/config/tls/tls-disable.ldif 2>&1 | log-helper debug || true
277-
[[ -f "$WAS_STARTED_WITH_TLS" ]] && rm -f "$WAS_STARTED_WITH_TLS"
302+
# disable tls (not possible for now)
303+
#else
304+
#log-helper info "Disable TLS config..."
305+
#ldapmodify -c -Y EXTERNAL -Q -H ldapi:/// -f ${CONTAINER_SERVICE_DIR}/slapd/assets/config/tls/tls-disable.ldif 2>&1 | log-helper debug || true
306+
#[[ -f "$WAS_STARTED_WITH_TLS" ]] && rm -f "$WAS_STARTED_WITH_TLS"
278307
fi
279308

280309

0 commit comments

Comments
 (0)