Skip to content

Commit b594287

Browse files
committed
replication
1 parent aae4e85 commit b594287

19 files changed

+114
-244
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Add support of tls. Use docker 1.5.0
1111
## Quick start
1212
Run OpenLDAP docker image :
1313

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

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

28-
ldapsearch -x -h 127.0.0.1 -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin
28+
ldapsearch -x -h ldap.example.org -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin
2929

3030
This should output :
3131

@@ -56,7 +56,7 @@ It will create an empty ldap for the compagny **Example Inc.** and the domain **
5656

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

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

6262
#### Data persitance
@@ -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 -v /data/slapd/database:/var/lib/ldap \
80+
docker run -h ldap.example.org -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 for the CN (common name) ldap.example.org. To work properly on your server adjust SERVER_NAME environment variable to match the ldap server CN.
90+
By default TLS is enable, a certificate is created with the container hostname eg: ldap.example.org.
9191

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

9494
####Β Use your own certificate
9595

9696
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)).
9797

9898
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 :
9999

100-
docker run -v /path/to/certifates:/osixia/slapd/assets/ssl \
100+
docker run -h ldap.example.org -v /path/to/certifates:/osixia/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,7 +106,7 @@ 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 -e USE_TLS=false -d osixia/openldap
109+
docker run -h ldap.example.org -e USE_TLS=false -d osixia/openldap
110110

111111
## Administrate your ldap server
112112
If you are looking for a simple solution to administrate your ldap server you can take a look at our phpLDAPadmin docker image :
@@ -129,18 +129,17 @@ TLS options :
129129
- **SSL_CRT_FILENAME**: Ldap ssl certificate filename. Defaults to `ldap.crt`
130130
- **SSL_KEY_FILENAME**: Ldap ssl certificate private key filename. Defaults to `ldap.key`
131131
- **SSL_CA_CRT_FILENAME**: Ldap ssl CA certificate filename. Defaults to `ca.crt`
132-
- **SERVER_NAME**: Use by autogenerated certificate: Server CN. Defaults to `ldap.example.org`
133132

134133
### Set environment variables at run time :
135134

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

138-
docker run -e LDAP_ORGANISATION="My Compagny" -e LDAP_DOMAIN="my-compagny.com" \
137+
docker run -h ldap.example.org -e LDAP_ORGANISATION="My Compagny" -e LDAP_DOMAIN="my-compagny.com" \
139138
-e LDAP_ADMIN_PASSWORD="JonSn0w" -d osixia/openldap
140139

141140
Or by setting your own `env.yml` file as a docker volume to `/etc/env.yml`
142141

143-
docker run -v /data/my-ldap-env.yml:/etc/env.yml \
142+
docker run -h ldap.example.org -v /data/my-ldap-env.yml:/etc/env.yml \
144143
-d osixia/openldap
145144

146145
## Manual build
@@ -165,7 +164,7 @@ Build your image :
165164

166165
Run your image :
167166

168-
docker run -d billy-the-king/openldap:0.1.0
167+
docker run -h ldap.example.org -d billy-the-king/openldap:0.1.0
169168

170169
## Tests
171170

β€Žimage/Dockerfileβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN apt-get -y update && /sbin/enable-service ssl-kit \
1313
slapd ldap-utils ntp \
1414
&& rm -rf /var/lib/ldap /etc/ldap/slapd.d
1515

16-
# Add services to /osixia
16+
# Add service directory to /osixia
1717
ADD service /osixia
1818

1919
# Use baseimage service auto-install script and clean all

β€Žimage/env.ymlβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ SSL_CA_CRT_FILENAME: ca.crt
1313

1414

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

1919
# if you want to add replication to an existing ldap
2020
# adapt REPLICATION_CONFIG_SYNCPROV and REPLICATION_HDB_SYNCPROV to your configuration
2121
# 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
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
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
2424
REPLICATION_HOSTS:
2525
- ldap://ldap.example.org # The order must be the same on all ldap servers
2626
- ldap://ldap2.example.org

β€Žimage/service/slapd/assets/config/replication/backup/repl-bdd-disable.ldifβ€Ž

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

β€Žimage/service/slapd/assets/config/replication/backup/repl-bdd-enable.ldifβ€Ž

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

β€Žimage/service/slapd/assets/config/replication/backup/repl-config-disable.ldifβ€Ž

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

β€Žimage/service/slapd/assets/config/replication/backup/repl-config-enable.ldifβ€Ž

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

β€Žimage/service/slapd/assets/config/replication/backup/repl-enable.ldifβ€Ž

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

β€Žimage/service/slapd/assets/config/replication/backup/repl-module-enable.ldifβ€Ž

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

β€Žimage/service/slapd/assets/config/replication/backup/repl-user-disable.ldifβ€Ž

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

0 commit comments

Comments
Β (0)