Skip to content

Commit aee8721

Browse files
committed
Merge branch 'hotfix-1.1.9' into stable
2 parents 1bc98e6 + 5b560b2 commit aee8721

File tree

19 files changed

+929
-251
lines changed

19 files changed

+929
-251
lines changed

CHANGELOG.md

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

3+
## 1.1.9
4+
Add :
5+
- LDAP_RFC2307BIS_SCHEMA option to use rfc2307bis schema instead of nis default schema
6+
- KEEP_EXISTING_CONFIG option to not change the ldap config
7+
8+
Update to light-baseimage:1.1.0 (debian stretch)
9+
310
## 1.1.8
411
Fix :
512
- LDAP_ENFORCE_TLS is not working correctly #107

Makefile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
NAME = osixia/openldap
2-
VERSION = 1.1.8
2+
VERSION = 1.1.9
33

4-
.PHONY: all build build-nocache test tag_latest release
5-
6-
all: build
4+
.PHONY: build build-nocache test tag-latest push push-latest release git-tag-version
75

86
build:
97
docker build -t $(NAME):$(VERSION) --rm image
@@ -14,10 +12,17 @@ build-nocache:
1412
test:
1513
env NAME=$(NAME) VERSION=$(VERSION) bats test/test.bats
1614

17-
tag_latest:
15+
tag-latest:
1816
docker tag $(NAME):$(VERSION) $(NAME):latest
1917

20-
release: build test tag_latest
21-
@if ! docker images $(NAME) | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME) version $(VERSION) is not yet built. Please run 'make build'"; false; fi
22-
docker push $(NAME)
23-
@echo "*** Don't forget to run 'twgit release/hotfix finish' :)"
18+
push:
19+
docker push $(NAME):$(VERSION)
20+
21+
push-latest:
22+
docker push $(NAME):latest
23+
24+
release: build test tag-latest push push-latest
25+
26+
git-tag-version: release
27+
git tag -a v$(VERSION) -m "v$(VERSION)"
28+
git push origin v$(VERSION)

README.md

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
![Docker Stars](https://img.shields.io/docker/stars/osixia/openldap.svg)
55
![](https://images.microbadger.com/badges/image/osixia/openldap.svg)
66

7-
Latest release: 1.1.8 - OpenLDAP 2.4.40 -  [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/openldap/) 
7+
Latest release: 1.1.9 - OpenLDAP 2.4.44 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/openldap/) 
88

99
**A docker image to run OpenLDAP.**
1010

11-
Note:
12-
- In the release 1.1.6 files `*.yaml.startup` have been renamed to `*.startup.yaml`
13-
- Due to issues #44 and #73 versions before 1.1.6 are not considered as stable and tags will be removed from docker hub.
14-
1511
> OpenLDAP website : [www.openldap.org](http://www.openldap.org/)
1612
1713
- [Contributing](#contributing)
@@ -38,7 +34,7 @@ Note:
3834
- [Link environment file](#link-environment-file)
3935
- [Make your own image or extend this image](#make-your-own-image-or-extend-this-image)
4036
- [Advanced User Guide](#advanced-user-guide)
41-
- [Extend osixia/openldap:1.1.8 image](#extend-osixiaopenldap118-image)
37+
- [Extend osixia/openldap:1.1.9 image](#extend-osixiaopenldap119-image)
4238
- [Make your own openldap image](#make-your-own-openldap-image)
4339
- [Tests](#tests)
4440
- [Kubernetes](#kubernetes)
@@ -56,7 +52,7 @@ If you find this image useful here's how you can help:
5652
## Quick Start
5753
Run OpenLDAP docker image:
5854

59-
docker run --name my-openldap-container --detach osixia/openldap:1.1.8
55+
docker run --name my-openldap-container --detach osixia/openldap:1.1.9
6056

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

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

9490
docker run --env LDAP_ORGANISATION="My Company" --env LDAP_DOMAIN="my-company.com" \
95-
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.8
91+
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.9
9692

9793
#### Data persistence
9894

@@ -108,6 +104,31 @@ For more information about docker data volume, please refer to:
108104

109105
Do not edit slapd.conf it's not used. To modify your server configuration use ldap utils: **ldapmodify / ldapadd / ldapdelete**
110106

107+
#### Seed ldap database with ldif
108+
109+
This image can load ldif files at startup with either `ldapadd` or `ldapmodify`.
110+
Mount `.ldif` in `/container/service/slapd/assets/config/bootstrap/ldif` directory if you want to overwrite image default boostrap ldif files or in `/container/service/slapd/assets/config/bootstrap/ldif/custom` (recommended) to extend image config.
111+
112+
Files containing `changeType:` attributes will be loaded with `ldapmodify`.
113+
114+
The startup script provide some substitution in bootstrap ldif files:
115+
`{{LDAP_BASE_DN }}` and `{{ LDAP_BACKEND }}` values are supported. Other `{{ * }}`
116+
substitution are left as is.
117+
118+
Since startup script modifies `ldif` files, you **must** add `--copy-service`
119+
argument to entrypoint if you don't want to overwrite them.
120+
121+
122+
# single file example:
123+
docker run \
124+
--volume ./bootstrap.ldif:/container/service/slapd/assets/config/bootstrap/ldif/50-bootstrap.ldif \
125+
osixia/openldap:1.1.9 --copy-service
126+
127+
#directory example:
128+
docker run \
129+
--volume ./lidf:/container/service/slapd/assets/config/bootstrap/ldif/custom \
130+
osixia/openldap:1.1.9 --copy-service
131+
111132
### Use an existing ldap database
112133

113134
This can be achieved by mounting host directories as volume.
@@ -117,7 +138,7 @@ simply mount this directories as a volume to `/var/lib/ldap` and `/etc/ldap/slap
117138

118139
docker run --volume /data/slapd/database:/var/lib/ldap \
119140
--volume /data/slapd/config:/etc/ldap/slapd.d
120-
--detach osixia/openldap:1.1.8
141+
--detach osixia/openldap:1.1.9
121142

122143
You can also use data volume containers. Please refer to:
123144
> [https://docs.docker.com/engine/tutorials/dockervolumes/](https://docs.docker.com/engine/tutorials/dockervolumes/)
@@ -137,7 +158,7 @@ If you are looking for a simple solution to administrate your ldap server you ca
137158
#### Use auto-generated certificate
138159
By default, TLS is already configured and enabled, certificate is created using container hostname (it can be set by docker run --hostname option eg: ldap.example.org).
139160

140-
docker run --hostname ldap.my-company.com --detach osixia/openldap:1.1.8
161+
docker run --hostname ldap.my-company.com --detach osixia/openldap:1.1.9
141162

142163
#### Use your own certificate
143164

@@ -147,24 +168,24 @@ You can set your custom certificate at run time, by mounting a directory contain
147168
--env LDAP_TLS_CRT_FILENAME=my-ldap.crt \
148169
--env LDAP_TLS_KEY_FILENAME=my-ldap.key \
149170
--env LDAP_TLS_CA_CRT_FILENAME=the-ca.crt \
150-
--detach osixia/openldap:1.1.8
171+
--detach osixia/openldap:1.1.9
151172

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

154175
#### Disable TLS
155176
Add --env LDAP_TLS=false to the run command:
156177

157-
docker run --env LDAP_TLS=false --detach osixia/openldap:1.1.8
178+
docker run --env LDAP_TLS=false --detach osixia/openldap:1.1.9
158179

159180
### Multi master replication
160181
Quick example, with the default config.
161182

162183
#Create the first ldap server, save the container id in LDAP_CID and get its IP:
163-
LDAP_CID=$(docker run --hostname ldap.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.1.8)
184+
LDAP_CID=$(docker run --hostname ldap.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.1.9)
164185
LDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP_CID)
165186

166187
#Create the second ldap server, save the container id in LDAP2_CID and get its IP:
167-
LDAP2_CID=$(docker run --hostname ldap2.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.1.8)
188+
LDAP2_CID=$(docker run --hostname ldap2.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.1.9)
168189
LDAP2_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP2_CID)
169190

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

201222
To fix that run the container with `--copy-service` argument :
202223

203-
docker run [your options] osixia/openldap:1.1.8 --copy-service
224+
docker run [your options] osixia/openldap:1.1.9 --copy-service
204225

205226
### Debug
206227

@@ -209,11 +230,11 @@ Available levels are: `none`, `error`, `warning`, `info`, `debug` and `trace`.
209230

210231
Example command to run the container in `debug` mode:
211232

212-
docker run --detach osixia/openldap:1.1.8 --loglevel debug
233+
docker run --detach osixia/openldap:1.1.9 --loglevel debug
213234

214235
See all command line options:
215236

216-
docker run osixia/openldap:1.1.8 --help
237+
docker run osixia/openldap:1.1.9 --help
217238

218239

219240
## Environment Variables
@@ -245,6 +266,8 @@ Required and used for new ldap server only:
245266
- **LDAP_READONLY_USER_USERNAME** Read only user username. Defaults to `readonly`
246267
- **LDAP_READONLY_USER_PASSWORD** Read only user password. Defaults to `readonly`
247268

269+
- **LDAP_RFC2307BIS_SCHEMA** Use rfc2307bis schema instead of nis schema. Defaults to `false`
270+
248271
Backend:
249272
- **LDAP_BACKEND**: Ldap backend. Defaults to `hdb` (In comming versions v1.2.x default will be mdb)
250273

@@ -276,11 +299,15 @@ Replication options:
276299

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

279-
docker run --env LDAP_REPLICATION_HOSTS="#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']" --detach osixia/openldap:1.1.8
302+
docker run --env LDAP_REPLICATION_HOSTS="#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']" --detach osixia/openldap:1.1.9
280303

281304
To convert yaml to python online: http://yaml-online-parser.appspot.com/
282305

283306
Other environment variables:
307+
- **KEEP_EXISTING_CONFIG**: Do not change the ldap config. Defaults to `false`
308+
- if set to *true* with an existing database, config will remain unchanged. Image tls and replication config will not be run. The container can be started with LDAP_ADMIN_PASSWORD and LDAP_CONFIG_PASSWORD empty or filled with fake data.
309+
- if set to *true* when bootstrapping a new database, bootstap ldif and schema will not be added and tls and replication config will not be run.
310+
284311
- **LDAP_REMOVE_CONFIG_AFTER_SETUP**: delete config folder after setup. Defaults to `true`
285312
- **LDAP_SSL_HELPER_PREFIX**: ssl-helper environment variables prefix. Defaults to `ldap`, ssl-helper first search config from LDAP_SSL_HELPER_* variables, before SSL_HELPER_* variables.
286313

@@ -291,7 +318,7 @@ Other environment variables:
291318
Environment variables can be set by adding the --env argument in the command line, for example:
292319

293320
docker run --env LDAP_ORGANISATION="My company" --env LDAP_DOMAIN="my-company.com" \
294-
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.8
321+
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.1.9
295322

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

304331
docker run --volume /data/ldap/environment:/container/environment/01-custom \
305-
--detach osixia/openldap:1.1.8
332+
--detach osixia/openldap:1.1.9
306333

307334
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).
308335

309336
Note: the container will try to delete the **\*.startup.yaml** 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 **\*.startup.yaml**:
310337

311338
docker run --volume /data/ldap/environment/my-env.yaml:/container/environment/01-custom/env.yaml \
312-
--detach osixia/openldap:1.1.8
339+
--detach osixia/openldap:1.1.9
313340

314341
#### Make your own image or extend this image
315342

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

318345
## Advanced User Guide
319346

320-
### Extend osixia/openldap:1.1.8 image
347+
### Extend osixia/openldap:1.1.9 image
321348

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

324351
Dockerfile example:
325352

326-
FROM osixia/openldap:1.1.8
353+
FROM osixia/openldap:1.1.9
327354
MAINTAINER Your Name <[email protected]>
328355

329356
ADD bootstrap /container/service/slapd/assets/config/bootstrap
@@ -345,7 +372,7 @@ Clone this project:
345372
Adapt Makefile, set your image NAME and VERSION, for example:
346373

347374
NAME = osixia/openldap
348-
VERSION = 1.1.8
375+
VERSION = 1.1.9
349376

350377
become:
351378
NAME = cool-guy/openldap

example/docker-compose.yml

Lines changed: 4 additions & 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.8
4+
image: osixia/openldap:1.1.9
55
container_name: openldap
66
environment:
77
LDAP_LOG_LEVEL: "256"
@@ -13,6 +13,7 @@ services:
1313
LDAP_READONLY_USER: "false"
1414
#LDAP_READONLY_USER_USERNAME: "readonly"
1515
#LDAP_READONLY_USER_PASSWORD: "readonly"
16+
LDAP_RFC2307BIS_SCHEMA: "false"
1617
LDAP_BACKEND: "hdb"
1718
LDAP_TLS: "true"
1819
LDAP_TLS_CRT_FILENAME: "ldap.crt"
@@ -26,6 +27,7 @@ services:
2627
#LDAP_REPLICATION_CONFIG_SYNCPROV: "binddn="cn=admin,cn=config" bindmethod=simple credentials=$LDAP_CONFIG_PASSWORD searchbase="cn=config" type=refreshAndPersist retry="60 +" timeout=1 starttls=critical"
2728
#LDAP_REPLICATION_DB_SYNCPROV: "binddn="cn=admin,$LDAP_BASE_DN" bindmethod=simple credentials=$LDAP_ADMIN_PASSWORD searchbase="$LDAP_BASE_DN" type=refreshAndPersist interval=00:00:00:10 retry="60 +" timeout=1 starttls=critical"
2829
#LDAP_REPLICATION_HOSTS: "#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']"
30+
KEEP_EXISTING_CONFIG: "false"
2931
LDAP_REMOVE_CONFIG_AFTER_SETUP: "true"
3032
LDAP_SSL_HELPER_PREFIX: "ldap"
3133
tty: true
@@ -37,6 +39,7 @@ services:
3739
ports:
3840
- "389:389"
3941
- "636:636"
42+
domainname: "example.org" # important: same as hostname
4043
hostname: "example.org"
4144
phpldapadmin:
4245
image: osixia/phpldapadmin:latest

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.8
1+
FROM osixia/openldap:1.1.9
22
MAINTAINER Your Name <[email protected]>
33

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

example/kubernetes/simple/ldap-deployment.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spec:
1313
spec:
1414
containers:
1515
- name: ldap
16-
image: osixia/openldap:1.1.8
16+
image: osixia/openldap:1.1.9
1717
volumeMounts:
1818
- name: ldap-data
1919
mountPath: /var/lib/ldap
@@ -41,6 +41,8 @@ spec:
4141
value: "readonly"
4242
- name: LDAP_READONLY_USER_PASSWORD
4343
value: "readonly"
44+
- name: LDAP_RFC2307BIS_SCHEMA
45+
value: "false"
4446
- name: LDAP_BACKEND
4547
value: "hdb"
4648
- name: LDAP_TLS
@@ -65,6 +67,8 @@ spec:
6567
value: "binddn=\"cn=admin,$LDAP_BASE_DN\" bindmethod=simple credentials=$LDAP_ADMIN_PASSWORD searchbase=\"$LDAP_BASE_DN\" type=refreshAndPersist interval=00:00:00:10 retry=\"60 +\" timeout=1 starttls=critical"
6668
- name: LDAP_REPLICATION_HOSTS
6769
value: "#PYTHON2BASH:['ldap://ldap-one-service', 'ldap://ldap-two-service']"
70+
- name: KEEP_EXISTING_CONFIG
71+
value: "false"
6872
- name: LDAP_REMOVE_CONFIG_AFTER_SETUP
6973
value: "true"
7074
- name: LDAP_SSL_HELPER_PREFIX

example/kubernetes/using-secrets/environment/my-env.startup.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ LDAP_READONLY_USER: false
1818
LDAP_READONLY_USER_USERNAME: readonly
1919
LDAP_READONLY_USER_PASSWORD: readonly
2020

21+
LDAP_RFC2307BIS_SCHEMA: false
22+
2123
# Backend
2224
LDAP_BACKEND: hdb
2325

@@ -46,6 +48,12 @@ LDAP_REPLICATION_HOSTS:
4648
- ldap://ldap2.example.org
4749

4850

51+
# Do not change the ldap config
52+
# - If set to true with an existing database, config will remain unchanged. Image tls and replication config will not be run.
53+
# The container can be started with LDAP_ADMIN_PASSWORD and LDAP_CONFIG_PASSWORD empty or filled with fake data.
54+
# - If set to true when bootstrapping a new database, bootstap ldif and schema will not be added and tls and replication config will not be run.
55+
KEEP_EXISTING_CONFIG: false
56+
4957
# Remove config after setup
5058
LDAP_REMOVE_CONFIG_AFTER_SETUP: true
5159

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spec:
1313
spec:
1414
containers:
1515
- name: ldap
16-
image: osixia/openldap:1.1.8
16+
image: osixia/openldap:1.1.9
1717
args: ["--copy-service"]
1818
volumeMounts:
1919
- name: ldap-data

image/Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Use osixia/light-baseimage
22
# sources: https://github.com/osixia/docker-light-baseimage
3-
FROM osixia/light-baseimage:0.2.6
3+
FROM osixia/light-baseimage:1.1.0
44
MAINTAINER Bertrand Gouny <[email protected]>
55

66
# Add openldap user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
@@ -11,8 +11,14 @@ RUN groupadd -r openldap && useradd -r -g openldap openldap
1111
#  https://github.com/osixia/docker-light-baseimage/blob/stable/image/service-available/:ssl-tools/download.sh
1212
RUN apt-get -y update \
1313
&& /container/tool/add-service-available :ssl-tools \
14-
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends \
14+
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
1515
ldap-utils \
16+
libsasl2-modules \
17+
libsasl2-modules-db \
18+
libsasl2-modules-gssapi-mit \
19+
libsasl2-modules-ldap \
20+
libsasl2-modules-otp \
21+
libsasl2-modules-sql \
1622
openssl \
1723
slapd \
1824
&& apt-get clean \

0 commit comments

Comments
 (0)