Skip to content

Commit b658686

Browse files
committed
Merge branch 'hotfix-1.0.1' into stable
2 parents 62596a8 + 20147b0 commit b658686

File tree

17 files changed

+167
-107
lines changed

17 files changed

+167
-107
lines changed

CHANGELOG.md

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

3+
## 1.0.1
4+
- Upgrade baseimage: osixia/light-baseimage:0.1.1
5+
- Rename environment variables
6+
7+
- Fixes :
8+
- OpenLdap container won't start when dhparam.pem is missing in bound volume #13
9+
10+
## 1.0.0
11+
- Use light-baseimage
12+
- Improve documentation
13+
314
## 0.10.2
415

516
- New features:

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.0.0
2+
VERSION = 1.0.1
33

44
.PHONY: all build test tag_latest release
55

README.md

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ simply mount this directories as a volume to `/var/lib/ldap` and `/etc/ldap/slap
8484
You can also use data volume containers. Please refer to :
8585
> [https://docs.docker.com/userguide/dockervolumes/](https://docs.docker.com/userguide/dockervolumes/)
8686
87-
### Using TLS
87+
### TLS
8888

8989
#### Use autogenerated certificate
9090
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).
@@ -93,37 +93,36 @@ By default TLS is enable, a certificate is created with the container hostname (
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.yaml** 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/certs** 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 **/container/service/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/certs** and adjust there name with the following environment variables :
9999

100-
docker run -h ldap.example.org -v /path/to/certifates:/container/service/slapd/assets/ssl \
101-
-e SSL_CRT_FILENAME=my-ldap.crt \
102-
-e SSL_KEY_FILENAME=my-ldap.key \
103-
-e SSL_CA_CRT_FILENAME=the-ca.crt \
100+
docker run -h ldap.example.org -v /path/to/certifates:/container/service/slapd/assets/certs \
101+
-e LDAP_TLS_CRT_FILENAME=my-ldap.crt \
102+
-e LDAP_TLS_KEY_FILENAME=my-ldap.key \
103+
-e LDAP_TLS_CA_CRT_FILENAME=the-ca.crt \
104104
-d osixia/openldap
105105

106106
#### Disable TLS
107-
Add -e USE_TLS=false to the run command :
107+
Add -e LDAP_TLS=false to the run command :
108108

109-
docker run -e USE_TLS=false -d osixia/openldap
109+
docker run -e LDAP_TLS=false -d osixia/openldap
110110

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

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

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

122122
#Add the pair "ip hostname" to /etc/hosts on each containers,
123123
#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
126-
124+
docker exec $LDAP_CID bash -c "echo $LDAP2_IP ldap2.example.org >> /etc/hosts"
125+
docker exec $LDAP2_CID bash -c "echo $LDAP_IP ldap.example.org >> /etc/hosts"
127126

128127
That's it ! But a litle test to be sure :
129128

@@ -151,7 +150,7 @@ Search on the second ldap server, and billy should show up !
151150
If you are looking for a simple solution to administrate your ldap server you can take a look at our phpLDAPadmin docker image :
152151
> [osixia/phpldapadmin](https://github.com/osixia/docker-phpLDAPadmin)
153152
154-
## Backups
153+
## Backup
155154
A simple solution to backup your ldap server, our openldap-backup docker image :
156155
> [osixia/openldap-backup](https://github.com/osixia/docker-openldap-backup)
157156
@@ -167,18 +166,26 @@ Required and used for new ldap server only :
167166
- **LDAP_DOMAIN**: Ldap domain. Defaults to `example.org`
168167
- **LDAP_ADMIN_PASSWORD** Ldap Admin password. Defaults to `admin`
169168
- **LDAP_CONFIG_PASSWORD** Ldap Config password. Defaults to `config`
169+
170+
- **LDAP_READONLY_USER** Add a read only user. Defaults to `false`
171+
- **LDAP_READONLY_USER_USERNAME** Read only user username. Defaults to `readonly`
172+
- **LDAP_READONLY_USER_PASSWORD** Read only user password. Defaults to `readonly`
170173

171174
TLS options :
172-
- **USE_TLS**: Add openldap TLS capabilities. Defaults to `true`
173-
- **SSL_CRT_FILENAME**: Ldap ssl certificate filename. Defaults to `ldap.crt`
174-
- **SSL_KEY_FILENAME**: Ldap ssl certificate private key filename. Defaults to `ldap.key`
175-
- **SSL_CA_CRT_FILENAME**: Ldap ssl CA certificate filename. Defaults to `ca.crt`
175+
- **LDAP_TLS**: Add openldap TLS capabilities. Defaults to `true`
176+
- **LDAP_TLS_CRT_FILENAME**: Ldap ssl certificate filename. Defaults to `ldap.crt`
177+
- **LDAP_TLS_KEY_FILENAME**: Ldap ssl certificate private key filename. Defaults to `ldap.key`
178+
- **LDAP_TLS_CA_CRT_FILENAME**: Ldap ssl CA certificate filename. Defaults to `ca.crt`
176179

177180
Replication options :
178-
- **USE_REPLICATION**: Add openldap replication capabilities. Defaults to `false`
179-
- **REPLICATION_CONFIG_SYNCPROV**: olcSyncRepl options used for the config database. Without **rid** and **provider** which are automaticaly added based on REPLICATION_HOSTS. Defaults to `binddn="cn=admin,cn=config" bindmethod=simple credentials=$LDAP_CONFIG_PASSWORD searchbase="cn=config" type=refreshAndPersist retry="5 5 300 5" timeout=1 starttls=critical`
180-
- **REPLICATION_HDB_SYNCPROV**: olcSyncRepl options used for the HDB database. Without **rid** and **provider** which are automaticaly added based on REPLICATION_HOSTS. Defaults to `binddn="cn=admin,$BASE_DN" bindmethod=simple credentials=$LDAP_ADMIN_PASSWORD searchbase="$BASE_DN" type=refreshAndPersist interval=00:00:00:10 retry="5 5 300 5" timeout=1 starttls=critical`
181-
- **REPLICATION_HOSTS**: list of replication hosts, must contains the current container hostname set by -h on docker run command. Defaults to `['ldap://ldap.example.org', 'ldap://ldap2.example.org']`
181+
- **LDAP_REPLICATION**: Add openldap replication capabilities. Defaults to `false`
182+
183+
- **LDAP_REPLICATION_CONFIG_SYNCPROV**: olcSyncRepl options used for the config database. Without **rid** and **provider** which are automaticaly added based on LDAP_REPLICATION_HOSTS. Defaults to `binddn="cn=admin,cn=config" bindmethod=simple credentials=$LDAP_CONFIG_PASSWORD searchbase="cn=config" type=refreshAndPersist retry="5 5 300 5" timeout=1 starttls=critical`
184+
185+
- **LDAP_REPLICATION_HDB_SYNCPROV**: olcSyncRepl options used for the HDB database. Without **rid** and **provider** which are automaticaly added based on LDAP_REPLICATION_HOSTS. Defaults to `binddn="cn=admin,$LDAP_BASE_DN" bindmethod=simple credentials=$LDAP_ADMIN_PASSWORD searchbase="$LDAP_BASE_DN" type=refreshAndPersist interval=00:00:00:10 retry="5 5 300 5" timeout=1 starttls=critical`
186+
187+
188+
- **LDAP_REPLICATION_HOSTS**: list of replication hosts, must contains the current container hostname set by -h on docker run command. Defaults to `['ldap://ldap.example.org', 'ldap://ldap2.example.org']`
182189

183190
### Set environment variables at run time :
184191

image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM osixia/light-baseimage:0.1.0
1+
FROM osixia/light-baseimage:0.1.1
22
MAINTAINER Bertrand Gouny <[email protected]>
33

44
# Use baseimage's init system.

image/env.yaml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
1+
# General container configuration
2+
# see table 5.1 in http://www.openldap.org/doc/admin24/slapdconf2.html for the available log levels.
3+
LDAP_LOG_LEVEL: 256
4+
5+
# Required and used for new ldap server only
16
LDAP_ORGANISATION: Example Inc.
27
LDAP_DOMAIN: example.org
38
LDAP_ADMIN_PASSWORD: admin
49
LDAP_CONFIG_PASSWORD: config
510

6-
#See table 5.1 in http://www.openldap.org/doc/admin24/slapdconf2.html for the available log levels.
7-
LDAP_LOG_LEVEL: 256
8-
9-
USE_TLS: true
10-
SSL_CRT_FILENAME: ldap.crt
11-
SSL_KEY_FILENAME: ldap.key
12-
SSL_CA_CRT_FILENAME: ca.crt
11+
LDAP_READONLY_USER: false
12+
LDAP_READONLY_USER_USERNAME: readonly
13+
LDAP_READONLY_USER_PASSWORD: readonly
1314

15+
# Tls
16+
LDAP_TLS: true
17+
LDAP_TLS_CRT_FILENAME: ldap.crt
18+
LDAP_TLS_KEY_FILENAME: ldap.key
19+
LDAP_TLS_CA_CRT_FILENAME: ca.crt
1420

15-
USE_REPLICATION: false
16-
# variables $BASE_DN, $LDAP_ADMIN_PASSWORD, $LDAP_CONFIG_PASSWORD
21+
# Replication
22+
LDAP_REPLICATION: false
23+
# variables $LDAP_BASE_DN, $LDAP_ADMIN_PASSWORD, $LDAP_CONFIG_PASSWORD
1724
# are automaticaly replaced at run time
1825

1926
# if you want to add replication to an existing ldap
20-
# adapt REPLICATION_CONFIG_SYNCPROV and REPLICATION_HDB_SYNCPROV to your configuration
21-
# avoid using $BASE_DN, $LDAP_ADMIN_PASSWORD and $LDAP_CONFIG_PASSWORD variables
22-
REPLICATION_CONFIG_SYNCPROV: binddn="cn=admin,cn=config" bindmethod=simple credentials=$LDAP_CONFIG_PASSWORD searchbase="cn=config" type=refreshAndPersist retry="5 5 300 5" timeout=1 starttls=critical
23-
REPLICATION_HDB_SYNCPROV: binddn="cn=admin,$BASE_DN" bindmethod=simple credentials=$LDAP_ADMIN_PASSWORD searchbase="$BASE_DN" type=refreshAndPersist interval=00:00:00:10 retry="5 5 300 5" timeout=1 starttls=critical
24-
REPLICATION_HOSTS:
27+
# adapt LDAP_REPLICATION_CONFIG_SYNCPROV and LDAP_REPLICATION_HDB_SYNCPROV to your configuration
28+
# avoid using $LDAP_BASE_DN, $LDAP_ADMIN_PASSWORD and $LDAP_CONFIG_PASSWORD variables
29+
LDAP_REPLICATION_CONFIG_SYNCPROV: binddn="cn=admin,cn=config" bindmethod=simple credentials=$LDAP_CONFIG_PASSWORD searchbase="cn=config" type=refreshAndPersist retry="5 5 300 5" timeout=1 starttls=critical
30+
LDAP_REPLICATION_HDB_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="5 5 300 5" timeout=1 starttls=critical
31+
LDAP_REPLICATION_HOSTS:
2532
- ldap://ldap.example.org # The order must be the same on all ldap servers
2633
- ldap://ldap2.example.org
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add your tls server certificate, key and the CA certificate (if any) here
2+
or during docker run mount a data volume with thoses files to /container/service/slapd/assets/certs
File renamed without changes.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ changeType: modify
44

55
dn: olcDatabase={0}config,cn=config
66
add: olcRootPW
7-
olcRootPW: {{ CONFIG_PASSWORD_ENCRYPTED }}
7+
olcRootPW: {{ LDAP_CONFIG_PASSWORD_ENCRYPTED }}
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
dn: olcDatabase={1}hdb,cn=config
1+
dn: olcDatabase={1}hdb,cn=config
22
changetype: modify
33
delete: olcAccess
44
-
55
add: olcAccess
6-
olcAccess: {0}to attrs=userPassword,shadowLastChange by self write by anonymous auth by dn="cn=admin,dc=example,dc=org" write by * none
7-
-
8-
add: olcAccess
9-
olcAccess: {1}to dn.base="" by * read
10-
-
11-
add: olcAccess
12-
olcAccess: {2}to * by self write by dn="cn=admin,dc=example,dc=org" write by * none
13-
-
6+
olcAccess: to attrs=userPassword,shadowLastChange by self write by dn="cn=admin,{{ LDAP_BASE_DN }}" write by anonymous auth by * none
7+
olcAccess: to * by self write by dn="cn=admin,{{ LDAP_BASE_DN }}" write by * none

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ dn: olcDatabase={1}hdb,cn=config
33
changetype: modify
44
replace: olcDbIndex
55
olcDbIndex: uid eq
6+
olcDbIndex: mail eq
67
olcDbIndex: memberOf eq
78
olcDbIndex: entryCSN eq
89
olcDbIndex: entryUUID eq
10+
olcDbIndex: objectClass eq

0 commit comments

Comments
 (0)