Skip to content

Commit ff22d94

Browse files
committed
Merge branch 'hotfix-1.1.2' into stable
2 parents a3aa25d + a6bb373 commit ff22d94

File tree

14 files changed

+61
-33
lines changed

14 files changed

+61
-33
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 1.1.2
4+
Merge pull request :
5+
- Honor LDAP_LOG_LEVEL on startup #39
6+
7+
Fix :
8+
- slapd tcp bind is network not interface, and so does not respond on overlay networks #35
9+
- specify base_dn without domain #37
10+
311
## 1.1.1
412
Update to light-baseimage:0.2.2
513

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.1
2+
VERSION = 1.1.2
33

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

README.md

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

88
[hub]: https://hub.docker.com/r/osixia/openldap/
99

10-
Latest release: 1.1.1 - OpenLDAP 2.4.40 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/openldap/) 
10+
Latest release: 1.1.2 - OpenLDAP 2.4.40 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/openldap/) 
1111

1212
A docker image to run OpenLDAP.
1313

@@ -37,7 +37,7 @@ A docker image to run OpenLDAP.
3737
- [Link environment file](#link-environment-file)
3838
- [Make your own image or extend this image](#make-your-own-image-or-extend-this-image)
3939
- [Advanced User Guide](#advanced-user-guide)
40-
- [Extend osixia/openldap:1.1.1 image](#extend-osixiaopenldap111-image)
40+
- [Extend osixia/openldap:1.1.2 image](#extend-osixiaopenldap112-image)
4141
- [Make your own openldap image](#make-your-own-openldap-image)
4242
- [Tests](#tests)
4343
- [Kubernetes](#kubernetes)
@@ -55,7 +55,7 @@ If you find this image useful here's how you can help:
5555
## Quick Start
5656
Run OpenLDAP docker image:
5757

58-
docker run --name my-openldap-container --detach osixia/openldap:1.1.1
58+
docker run --name my-openldap-container --detach osixia/openldap:1.1.2
5959

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

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

9393
docker run --env LDAP_ORGANISATION="My Company" --env LDAP_DOMAIN="my-company.com" \
94-
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.1
94+
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.2
9595

9696
#### Data persistence
9797

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

116116
docker run --volume /data/slapd/database:/var/lib/ldap \
117117
--volume /data/slapd/config:/etc/ldap/slapd.d
118-
--detach osixia/openldap:1.1.1
118+
--detach osixia/openldap:1.1.2
119119

120120
You can also use data volume containers. Please refer to:
121121
> [https://docs.docker.com/userguide/dockervolumes/](https://docs.docker.com/userguide/dockervolumes/)
@@ -133,7 +133,7 @@ If you are looking for a simple solution to administrate your ldap server you ca
133133
#### Use auto-generated certificate
134134
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).
135135

136-
docker run --hostname ldap.my-company.com --detach osixia/openldap:1.1.1
136+
docker run --hostname ldap.my-company.com --detach osixia/openldap:1.1.2
137137

138138
#### Use your own certificate
139139

@@ -143,24 +143,24 @@ You can set your custom certificate at run time, by mounting a directory contain
143143
--env LDAP_TLS_CRT_FILENAME=my-ldap.crt \
144144
--env LDAP_TLS_KEY_FILENAME=my-ldap.key \
145145
--env LDAP_TLS_CA_CRT_FILENAME=the-ca.crt \
146-
--detach osixia/openldap:1.1.1
146+
--detach osixia/openldap:1.1.2
147147

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

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

153-
docker run --env LDAP_TLS=false --detach osixia/openldap:1.1.1
153+
docker run --env LDAP_TLS=false --detach osixia/openldap:1.1.2
154154

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

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

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

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

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

199-
docker run [your options] osixia/openldap:1.1.1 --copy-service
199+
docker run [your options] osixia/openldap:1.1.2 --copy-service
200200

201201
### Debug
202202

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

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

208-
docker run --detach osixia/openldap:1.1.1 --loglevel debug
208+
docker run --detach osixia/openldap:1.1.2 --loglevel debug
209209

210210
See all command line options:
211211

212-
docker run osixia/openldap:1.1.1 --help
212+
docker run osixia/openldap:1.1.2 --help
213213

214214

215215
## Environment Variables
@@ -233,6 +233,7 @@ This helps to keep your container configuration secret. If you don't care all en
233233
Required and used for new ldap server only:
234234
- **LDAP_ORGANISATION**: Organisation name. Defaults to `Example Inc.`
235235
- **LDAP_DOMAIN**: Ldap domain. Defaults to `example.org`
236+
- **LDAP_BASE_DN**: Ldap base DN. If empty automatically set from LDAP_DOMAIN value. Defaults to `(empty)`
236237
- **LDAP_ADMIN_PASSWORD** Ldap Admin password. Defaults to `admin`
237238
- **LDAP_CONFIG_PASSWORD** Ldap Config password. Defaults to `config`
238239

@@ -267,7 +268,7 @@ Replication options:
267268

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

270-
docker run --env LDAP_REPLICATION_HOSTS="#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']" --detach osixia/openldap:1.1.1
271+
docker run --env LDAP_REPLICATION_HOSTS="#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']" --detach osixia/openldap:1.1.2
271272

272273
To convert yaml to python online: http://yaml-online-parser.appspot.com/
273274

@@ -282,7 +283,7 @@ Other environment variables:
282283
Environment variables can be set by adding the --env argument in the command line, for example:
283284

284285
docker run --env LDAP_ORGANISATION="My company" --env LDAP_DOMAIN="my-company.com" \
285-
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.1
286+
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.2
286287

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

295296
docker run --volume /data/ldap/environment:/container/environment/01-custom \
296-
--detach osixia/openldap:1.1.1
297+
--detach osixia/openldap:1.1.2
297298

298299
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).
299300

300301
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**:
301302

302303
docker run --volume /data/ldap/environment/my-env.yaml:/container/environment/01-custom/env.yaml \
303-
--detach osixia/openldap:1.1.1
304+
--detach osixia/openldap:1.1.2
304305

305306
#### Make your own image or extend this image
306307

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

309310
## Advanced User Guide
310311

311-
### Extend osixia/openldap:1.1.1 image
312+
### Extend osixia/openldap:1.1.2 image
312313

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

315316
Dockerfile example:
316317

317-
FROM osixia/openldap:1.1.1
318+
FROM osixia/openldap:1.1.2
318319
MAINTAINER Your Name <[email protected]>
319320

320321
ADD bootstrap /container/service/slapd/assets/config/bootstrap
@@ -333,7 +334,7 @@ Clone this project:
333334
Adapt Makefile, set your image NAME and VERSION, for example:
334335

335336
NAME = osixia/openldap
336-
VERSION = 1.1.1
337+
VERSION = 1.1.2
337338

338339
become:
339340
NAME = cool-guy/openldap

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.1
1+
FROM osixia/openldap:1.1.2
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.1
18+
image: osixia/openldap:1.1.2
1919
volumeMounts:
2020
- name: ldap-data
2121
mountPath: /var/lib/ldap

example/kubernetes/using-secrets/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.1
18+
image: osixia/openldap:1.1.2
1919
command:
2020
- --copy-service
2121
volumeMounts:

image/environment/default.yaml.startup

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
# Required and used for new ldap server only
1010
LDAP_ORGANISATION: Example Inc.
1111
LDAP_DOMAIN: example.org
12+
LDAP_BASE_DN: #if empty automatically set from LDAP_DOMAIN
13+
1214
LDAP_ADMIN_PASSWORD: admin
1315
LDAP_CONFIG_PASSWORD: config
1416

image/service/slapd/process.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ log-helper level eq trace && set -x
99
# see https://github.com/docker/docker/issues/8231
1010
ulimit -n 1024
1111

12-
exec /usr/sbin/slapd -h "ldap://$HOSTNAME ldaps://$HOSTNAME ldap://localhost ldaps://localhost ldapi:///" -u openldap -g openldap -d $LDAP_LOG_LEVEL
12+
exec /usr/sbin/slapd -h "ldap://$HOSTNAME ldaps://$HOSTNAME ldapi:///" -u openldap -g openldap -d $LDAP_LOG_LEVEL

image/service/slapd/startup.sh

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ if [ ! -e "$FIRST_START_DONE" ]; then
2929
# Helpers
3030
#
3131
function get_ldap_base_dn() {
32-
LDAP_BASE_DN=""
33-
IFS='.' read -ra LDAP_BASE_DN_TABLE <<< "$LDAP_DOMAIN"
34-
for i in "${LDAP_BASE_DN_TABLE[@]}"; do
35-
EXT="dc=$i,"
36-
LDAP_BASE_DN=$LDAP_BASE_DN$EXT
37-
done
32+
# if LDAP_BASE_DN is empty set value from LDAP_DOMAIN
33+
if [ -z "$LDAP_BASE_DN" ]; then
34+
IFS='.' read -ra LDAP_BASE_DN_TABLE <<< "$LDAP_DOMAIN"
35+
for i in "${LDAP_BASE_DN_TABLE[@]}"; do
36+
EXT="dc=$i,"
37+
LDAP_BASE_DN=$LDAP_BASE_DN$EXT
38+
done
39+
40+
LDAP_BASE_DN=${LDAP_BASE_DN::-1}
41+
fi
3842

39-
LDAP_BASE_DN=${LDAP_BASE_DN::-1}
4043
}
4144

4245
function is_new_schema() {
@@ -123,8 +126,17 @@ EOF
123126

124127
# start OpenLDAP
125128
log-helper info "Start OpenLDAP..."
126-
slapd -h "ldap://$HOSTNAME $PREVIOUS_HOSTNAME_PARAM ldap://localhost ldapi:///" -u openldap -g openldap
127129

130+
if log-helper level eq debug; then
131+
# debug
132+
slapd -h "ldap://$HOSTNAME $PREVIOUS_HOSTNAME_PARAM ldap://localhost ldapi:///" -u openldap -g openldap -d $LDAP_LOG_LEVEL 2>&1 &
133+
else
134+
slapd -h "ldap://$HOSTNAME $PREVIOUS_HOSTNAME_PARAM ldap://localhost ldapi:///" -u openldap -g openldap
135+
fi
136+
137+
138+
log-helper info "Waiting for OpenLDAP to start..."
139+
while [ ! -e /run/slapd/slapd.pid ]; do sleep 0.1; done
128140

129141
#
130142
# setup bootstrap config - Part 2
@@ -332,4 +344,9 @@ fi
332344
ln -sf ${CONTAINER_SERVICE_DIR}/slapd/assets/.ldaprc $HOME/.ldaprc
333345
ln -sf ${CONTAINER_SERVICE_DIR}/slapd/assets/ldap.conf /etc/ldap/ldap.conf
334346

347+
# force OpenLDAP to listen on all interfaces
348+
ETC_HOSTS=$(cat /etc/hosts | sed "/$HOSTNAME/d")
349+
echo "0.0.0.0 $HOSTNAME" > /etc/hosts
350+
echo "$ETC_HOSTS" >> /etc/hosts
351+
335352
exit 0

test/database/__db.001

0 Bytes
Binary file not shown.

test/database/__db.002

0 Bytes
Binary file not shown.

test/database/__db.003

0 Bytes
Binary file not shown.

test/database/alock

0 Bytes
Binary file not shown.

test/database/log.0000000001

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)