Skip to content

Commit 62596a8

Browse files
committed
Merge branch 'release-1.0.0' into stable
2 parents 2f7ea27 + 3f8cf10 commit 62596a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+150
-141
lines changed

Makefile

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

44
.PHONY: all build test tag_latest release
55

@@ -16,6 +16,5 @@ tag_latest:
1616

1717
release: build test tag_latest
1818
@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
19-
@if ! head -n 1 CHANGELOG.md | grep -q 'release date'; then echo 'Please note the release date in Changelog.md.' && false; fi
2019
docker push $(NAME)
2120
@echo "*** Don't forget to run 'twgit release/hotfix finish' :)"

README.md

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# osixia/openldap
22

3+
[![](https://badge.imagelayers.io/osixia/openldap:latest.svg)](https://imagelayers.io/?images=osixia/openldap:latest 'Get your own badge on imagelayers.io')
4+
35
A docker image to run OpenLDAP.
46
> [www.openldap.org](http://www.openldap.org/)
57
68
Fork of Nick Stenning docker-slapd :
79
https://github.com/nickstenning/docker-slapd
810

9-
Add support of TLS and multi master replication.
11+
Add support of TLS, multi master replication and easy bootstrap.
1012

1113
## Quick start
1214
Run OpenLDAP docker image :
1315

14-
docker run -h ldap.example.org -d osixia/openldap
16+
docker run -d osixia/openldap
1517

1618
This start a new container with a OpenLDAP server running inside.
1719
The odd string printed by this command is the `CONTAINER_ID`.
@@ -25,7 +27,7 @@ make sure to replace `CONTAINER_ID` by your container id :
2527
You should now be in the container terminal,
2628
and we can search on the ldap server :
2729

28-
ldapsearch -x -h ldap.example.org -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin
30+
ldapsearch -x -h localhost -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin
2931

3032
This should output :
3133

@@ -56,15 +58,13 @@ It will create an empty ldap for the compagny **Example Inc.** and the domain **
5658

5759
By default the admin has the password **admin**. All those default settings can be changed at the docker command line, for example :
5860

59-
docker run -h ldap.example.org -e LDAP_ORGANISATION="My Compagny" -e LDAP_DOMAIN="my-compagny.com" \
61+
docker run -e LDAP_ORGANISATION="My Compagny" -e LDAP_DOMAIN="my-compagny.com" \
6062
-e LDAP_ADMIN_PASSWORD="JonSn0w" -d osixia/openldap
6163

6264
#### Data persitance
6365

6466
The directories `/var/lib/ldap` (LDAP database files) and `/etc/ldap/slapd.d` (LDAP config files) has been declared as volumes, so your ldap files are saved outside the container in data volumes.
6567

66-
Be careful, if you remove the container, data volumes will me removed too, except if you have linked this data volume to an other container.
67-
6868
For more information about docker data volume, please refer to :
6969

7070
> [https://docs.docker.com/userguide/dockervolumes/](https://docs.docker.com/userguide/dockervolumes/)
@@ -77,7 +77,7 @@ Assuming you have a LDAP database on your docker host in the directory `/data/sl
7777
and the corresponding LDAP config files on your docker host in the directory `/data/slapd/config`
7878
simply mount this directories as a volume to `/var/lib/ldap` and `/etc/ldap/slapd.d`:
7979

80-
docker run -h ldap.example.org -v /data/slapd/database:/var/lib/ldap \
80+
docker run -v /data/slapd/database:/var/lib/ldap \
8181
-v /data/slapd/config:/etc/ldap/slapd.d
8282
-d osixia/openldap
8383

@@ -87,17 +87,17 @@ You can also use data volume containers. Please refer to :
8787
### Using TLS
8888

8989
#### Use autogenerated certificate
90-
By default TLS is enable, a certificate is created with the container hostname (set by -h option eg: ldap.example.org).
90+
By default TLS is enable, a certificate is created with the container hostname (it can be set by docker run -h option eg: ldap.example.org).
9191

92-
docker run -h ldap.example.org -e SERVER_NAME=ldap.my-compagny.com -d osixia/openldap
92+
docker run -h ldap.my-compagny.com -d osixia/openldap
9393

9494
#### Use your own certificate
9595

96-
Add your custom certificate, private key and CA certificate in the directory **image/service/slapd/assets/ssl** adjust filename in **image/env.yml** and rebuild the image ([see manual build](#manual-build)).
96+
Add your custom certificate, private key and CA certificate in the directory **image/service/slapd/assets/ssl** adjust filename in **image/env.yaml** and rebuild the image ([see manual build](#manual-build)).
9797

98-
Or you can set your custom certificate at run time, by mouting a directory containing thoses files to **/osixia/slapd/assets/ssl** and adjust there name with the following environment variables :
98+
Or you can set your custom certificate at run time, by mouting a directory containing thoses files to **/container/service/slapd/assets/ssl** and adjust there name with the following environment variables :
9999

100-
docker run -h ldap.example.org -v /path/to/certifates:/osixia/slapd/assets/ssl \
100+
docker run -h ldap.example.org -v /path/to/certifates:/container/service/slapd/assets/ssl \
101101
-e SSL_CRT_FILENAME=my-ldap.crt \
102102
-e SSL_KEY_FILENAME=my-ldap.key \
103103
-e SSL_CA_CRT_FILENAME=the-ca.crt \
@@ -106,37 +106,30 @@ Or you can set your custom certificate at run time, by mouting a directory conta
106106
#### Disable TLS
107107
Add -e USE_TLS=false to the run command :
108108

109-
docker run -h ldap.example.org -e USE_TLS=false -d osixia/openldap
109+
docker run -e USE_TLS=false -d osixia/openldap
110110

111111
### Multi master replication
112112
Quick example, with the default config.
113113

114-
Create the first ldap server, save the container id in LDAP_CID and get its IP:
115-
114+
#Create the first ldap server, save the container id in LDAP_CID and get its IP:
116115
LDAP_CID=$(docker run -h ldap.example.org -e USE_REPLICATION=true -d osixia/openldap)
117116
LDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP_CID)
118117

119-
Create the second ldap server, save the container id in LDAP2_CID and get its IP:
120-
118+
#Create the second ldap server, save the container id in LDAP2_CID and get its IP:
121119
LDAP2_CID=$(docker run -h ldap2.example.org -e USE_REPLICATION=true -d osixia/openldap)
122120
LDAP2_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP2_CID)
123121

124-
Add the pair "ip hostname" to /etc/hosts on each containers,
125-
beacause ldap.example.org and ldap2.example.org are fake hostnames
122+
#Add the pair "ip hostname" to /etc/hosts on each containers,
123+
#beacause ldap.example.org and ldap2.example.org are fake hostnames
124+
docker exec $LDAP_CID /sbin/add-host $LDAP2_IP ldap2.example.org
125+
docker exec $LDAP2_CID /sbin/add-host $LDAP_IP ldap.example.org
126126

127-
docker exec $LDAP_CID /osixia/test/add-host.sh $LDAP2_IP ldap2.example.org
128-
docker exec $LDAP2_CID /osixia/test/add-host.sh $LDAP_IP ldap.example.org
129-
130-
We reload slapd to let him take into consideration /etc/hosts changes
131-
132-
docker exec $LDAP_CID pkill slapd
133-
docker exec $LDAP2_CID pkill slapd
134127

135128
That's it ! But a litle test to be sure :
136129

137130
Add a new user "billy" on the first ldap server
138131

139-
docker exec $LDAP_CID ldapadd -x -D "cn=admin,dc=example,dc=org" -w admin -f /osixia/test/new-user.ldif -h ldap.example.org -ZZ
132+
docker exec $LDAP_CID ldapadd -x -D "cn=admin,dc=example,dc=org" -w admin -f /container/service/slapd/assets/test/new-user.ldif -h ldap.example.org -ZZ
140133

141134
Search on the second ldap server, and billy should show up !
142135

@@ -154,22 +147,26 @@ Search on the second ldap server, and billy should show up !
154147
objectClass: inetOrgPerson
155148
[...]
156149

157-
158150
## Administrate your ldap server
159151
If you are looking for a simple solution to administrate your ldap server you can take a look at our phpLDAPadmin docker image :
160152
> [osixia/phpldapadmin](https://github.com/osixia/docker-phpLDAPadmin)
161153
154+
## Backups
155+
A simple solution to backup your ldap server, our openldap-backup docker image :
156+
> [osixia/openldap-backup](https://github.com/osixia/docker-openldap-backup)
157+
162158
## Environment Variables
163159

164-
Environement variables defaults are set in **image/env.yml**. You can modify environment variable values directly in this file and rebuild the image ([see manual build](#manual-build)). You can also override those values at run time with -e argument or by setting your own env.yml file as a docker volume to `/etc/env.yml`. See examples below.
160+
Environement variables defaults are set in **image/env.yaml**. You can modify environment variable values directly in this file and rebuild the image ([see manual build](#manual-build)). You can also override those values at run time with -e argument or by setting your own env.yaml file as a docker volume to `/etc/env.yaml`. See examples below.
165161

166162
General container configuration :
167-
- **LDAP_LOG_LEVEL**: Slap log level. defaults to `-1`. See table 5.1 in http://www.openldap.org/doc/admin24/slapdconf2.html for the available log levels.
163+
- **LDAP_LOG_LEVEL**: Slap log level. defaults to `256`. See table 5.1 in http://www.openldap.org/doc/admin24/slapdconf2.html for the available log levels.
168164

169165
Required and used for new ldap server only :
170166
- **LDAP_ORGANISATION**: Organisation name. Defaults to `Example Inc.`
171167
- **LDAP_DOMAIN**: Ldap domain. Defaults to `example.org`
172-
- **LDAP_ADMIN_PASSWORD** Admin password. Defaults to `admin`
168+
- **LDAP_ADMIN_PASSWORD** Ldap Admin password. Defaults to `admin`
169+
- **LDAP_CONFIG_PASSWORD** Ldap Config password. Defaults to `config`
173170

174171
TLS options :
175172
- **USE_TLS**: Add openldap TLS capabilities. Defaults to `true`
@@ -187,12 +184,12 @@ Replication options :
187184

188185
Environment variable can be set directly by adding the -e argument in the command line, for example :
189186

190-
docker run -h ldap.example.org -e LDAP_ORGANISATION="My Compagny" -e LDAP_DOMAIN="my-compagny.com" \
187+
docker run -e LDAP_ORGANISATION="My Compagny" -e LDAP_DOMAIN="my-compagny.com" \
191188
-e LDAP_ADMIN_PASSWORD="JonSn0w" -d osixia/openldap
192189

193-
Or by setting your own `env.yml` file as a docker volume to `/etc/env.yml`
190+
Or by setting your own `env.yaml` file as a docker volume to `/etc/env.yaml`
194191

195-
docker run -h ldap.example.org -v /data/my-ldap-env.yml:/etc/env.yml \
192+
docker run -v /data/my-env.yaml:/etc/env.yaml \
196193
-d osixia/openldap
197194

198195
## Manual build
@@ -205,7 +202,7 @@ Clone this project :
205202
Adapt Makefile, set your image NAME and VERSION, for example :
206203

207204
NAME = osixia/openldap
208-
VERSION = 0.10.0
205+
VERSION = 1.0.0
209206

210207
becomes :
211208
NAME = billy-the-king/openldap
@@ -217,7 +214,7 @@ Build your image :
217214

218215
Run your image :
219216

220-
docker run -h ldap.example.org -d billy-the-king/openldap:0.1.0
217+
docker run -d billy-the-king/openldap:0.1.0
221218

222219
## Tests
223220

image/Dockerfile

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
FROM osixia/baseimage:0.10.5
1+
FROM osixia/light-baseimage:0.1.0
22
MAINTAINER Bertrand Gouny <[email protected]>
33

4-
# Use baseimage-docker's init system.
5-
CMD ["/sbin/my_init"]
4+
# Use baseimage's init system.
5+
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/run
6+
CMD ["/container/tool/run"]
67

78
# Add openldap user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
89
RUN groupadd -r openldap && useradd -r -g openldap openldap
910

10-
# Install OpenLDAP, ldap-utils and ssl-kit from baseimage, remove default ldap db
11-
RUN apt-get -y update && /sbin/enable-service ssl-kit \
12-
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends \
13-
slapd ldap-utils ntp \
14-
&& rm -rf /var/lib/ldap /etc/ldap/slapd.d
11+
# Install OpenLDAP, ldap-utils and ssl-helper from baseimage and remove default ldap db
12+
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-service-available
13+
RUN apt-get -y update \
14+
&& /container/tool/install-service-available ssl-helper-gnutls \
15+
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends \
16+
slapd ldap-utils \
17+
&& rm -rf /var/lib/ldap /etc/ldap/slapd.d
1518

16-
# Add service directory to /osixia
17-
ADD service /osixia
19+
# Add service directory to /container/service
20+
ADD service /container/service
1821

19-
# Use baseimage service auto-install script and clean all
20-
RUN ./sbin/auto-install && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
22+
# Use baseimage install-service script and clean all
23+
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-service
24+
RUN /container/tool/install-service \
25+
&& apt-get clean \
26+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2127

2228
# Add default env variables
23-
ADD env.yml /etc/env.yml
29+
ADD env.yaml /etc/env.yaml
2430

2531
# Set OpenLDAP data and config directories in a data volume
2632
VOLUME ["/var/lib/ldap", "/etc/ldap/slapd.d"]

image/env.yml renamed to image/env.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LDAP_ADMIN_PASSWORD: admin
44
LDAP_CONFIG_PASSWORD: config
55

66
#See table 5.1 in http://www.openldap.org/doc/admin24/slapdconf2.html for the available log levels.
7-
LDAP_LOG_LEVEL: -1
7+
LDAP_LOG_LEVEL: 256
88

99
USE_TLS: true
1010
SSL_CRT_FILENAME: ldap.crt
@@ -13,7 +13,7 @@ SSL_CA_CRT_FILENAME: ca.crt
1313

1414

1515
USE_REPLICATION: false
16-
# variables $BASE_DN, $LDAP_ADMIN_PASSWORD, $LDAP_CONFIG_PASSWORD and $SSL_*
16+
# variables $BASE_DN, $LDAP_ADMIN_PASSWORD, $LDAP_CONFIG_PASSWORD
1717
# are automaticaly replaced at run time
1818

1919
# if you want to add replication to an existing ldap

image/service/slapd/assets/config/bootstrap/ldif/config-password.ldif renamed to image/service/slapd/assets/config/bootstrap/ldif/01-config-password.ldif

File renamed without changes.

image/service/slapd/assets/config/bootstrap/ldif/security.ldif renamed to image/service/slapd/assets/config/bootstrap/ldif/02-security.ldif

File renamed without changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Load memberof module
2+
dn: cn=module{0},cn=config
3+
changetype: modify
4+
add: olcModuleLoad
5+
olcModuleLoad: memberof

image/service/slapd/assets/config/bootstrap/ldif/index.ldif renamed to image/service/slapd/assets/config/bootstrap/ldif/04-index.ldif

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
dn: olcDatabase={1}hdb,cn=config
33
changetype: modify
44
replace: olcDbIndex
5+
olcDbIndex: uid eq
6+
olcDbIndex: memberOf eq
57
olcDbIndex: entryCSN eq
68
olcDbIndex: entryUUID eq

image/service/slapd/assets/config/bootstrap/ldif/logging.ldif

Lines changed: 0 additions & 4 deletions
This file was deleted.

image/service/slapd/assets/config/replication/replication-enable-template.ldif renamed to image/service/slapd/assets/config/replication/replication-enable.ldif

File renamed without changes.

0 commit comments

Comments
 (0)