Skip to content

Commit

Permalink
rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandGouny committed Jul 27, 2015
1 parent 45fdd37 commit 105e9e3
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 65 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 1.0.1
- Rename environment variables

## 1.0.0
- Use light-baseimage
- Improve documentation

## 0.10.2

- New features:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = osixia/openldap
VERSION = 1.0.0
VERSION = 1.0.1

.PHONY: all build test tag_latest release

Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,30 @@ By default TLS is enable, a certificate is created with the container hostname (

#### Use your own certificate

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

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

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

#### Disable TLS
Add -e USE_TLS=false to the run command :
Add -e LDAP_PROPOSE_TLS=false to the run command :

docker run -e USE_TLS=false -d osixia/openldap
docker run -e LDAP_PROPOSE_TLS=false -d osixia/openldap

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

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

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

#Add the pair "ip hostname" to /etc/hosts on each containers,
Expand Down Expand Up @@ -169,16 +169,16 @@ Required and used for new ldap server only :
- **LDAP_CONFIG_PASSWORD** Ldap Config password. Defaults to `config`

TLS options :
- **USE_TLS**: Add openldap TLS capabilities. Defaults to `true`
- **SSL_CRT_FILENAME**: Ldap ssl certificate filename. Defaults to `ldap.crt`
- **SSL_KEY_FILENAME**: Ldap ssl certificate private key filename. Defaults to `ldap.key`
- **SSL_CA_CRT_FILENAME**: Ldap ssl CA certificate filename. Defaults to `ca.crt`
- **LDAP_PROPOSE_TLS**: Add openldap TLS capabilities. Defaults to `true`
- **LDAP_TLS_CRT_FILENAME**: Ldap ssl certificate filename. Defaults to `ldap.crt`
- **LDAP_TLS_KEY_FILENAME**: Ldap ssl certificate private key filename. Defaults to `ldap.key`
- **LDAP_TLS_CA_CRT_FILENAME**: Ldap ssl CA certificate filename. Defaults to `ca.crt`

Replication options :
- **USE_REPLICATION**: Add openldap replication capabilities. Defaults to `false`
- **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`
- **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`
- **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']`
- **LDAP_REPLICATION**: Add openldap replication capabilities. Defaults to `false`
- **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`
- **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,$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`
- **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']`

### Set environment variables at run time :

Expand Down
18 changes: 9 additions & 9 deletions image/env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ LDAP_CONFIG_PASSWORD: config
#See table 5.1 in http://www.openldap.org/doc/admin24/slapdconf2.html for the available log levels.
LDAP_LOG_LEVEL: 256

USE_TLS: true
SSL_CRT_FILENAME: ldap.crt
SSL_KEY_FILENAME: ldap.key
SSL_CA_CRT_FILENAME: ca.crt
LDAP_PROPOSE_TLS: true
LDAP_TLS_CRT_FILENAME: ldap.crt
LDAP_TLS_KEY_FILENAME: ldap.key
LDAP_TLS_CA_CRT_FILENAME: ca.crt


USE_REPLICATION: false
LDAP_REPLICATION: false
# variables $BASE_DN, $LDAP_ADMIN_PASSWORD, $LDAP_CONFIG_PASSWORD
# are automaticaly replaced at run time

# if you want to add replication to an existing ldap
# adapt REPLICATION_CONFIG_SYNCPROV and REPLICATION_HDB_SYNCPROV to your configuration
# adapt LDAP_REPLICATION_CONFIG_SYNCPROV and LDAP_REPLICATION_HDB_SYNCPROV to your configuration
# avoid using $BASE_DN, $LDAP_ADMIN_PASSWORD and $LDAP_CONFIG_PASSWORD variables
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
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
REPLICATION_HOSTS:
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
LDAP_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
LDAP_REPLICATION_HOSTS:
- ldap://ldap.example.org # The order must be the same on all ldap servers
- ldap://ldap2.example.org
2 changes: 2 additions & 0 deletions image/service/slapd/assets/certs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add your tls server certificate, key and the CA certificate (if any) here
or during docker run mount a data volume with thoses files to /container/service/slapd/assets/certs
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ olcModuleLoad: syncprov
dn: cn=config
changeType: modify
add: olcServerID
{{ REPLICATION_HOSTS }}
{{ LDAP_REPLICATION_HOSTS }}

# Add syncprov on config
dn: olcOverlay=syncprov,olcDatabase={0}config,cn=config
Expand All @@ -21,7 +21,7 @@ olcOverlay: syncprov
dn: olcDatabase={0}config,cn=config
changetype: modify
add: olcSyncRepl
{{ REPLICATION_HOSTS_CONFIG_SYNC_REPL }}
{{ LDAP_REPLICATION_HOSTS_CONFIG_SYNC_REPL }}
-
add: olcMirrorMode
olcMirrorMode: TRUE
Expand All @@ -37,7 +37,7 @@ olcOverlay: syncprov
dn: olcDatabase={1}hdb,cn=config
changetype: modify
add: olcSyncRepl
{{ REPLICATION_HOSTS_HDB_SYNC_REPL }}
{{ LDAP_REPLICATION_HOSTS_HDB_SYNC_REPL }}
-
add: olcMirrorMode
olcMirrorMode: TRUE
8 changes: 4 additions & 4 deletions image/service/slapd/assets/config/tls/tls-enable.ldif
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ replace: olcTLSCipherSuite
olcTLSCipherSuite: SECURE256:-VERS-SSL3.0
-
replace: olcTLSCACertificateFile
olcTLSCACertificateFile: /container/service/slapd/assets/ssl/ca.crt
olcTLSCACertificateFile: /container/service/slapd/assets/certs/ca.crt
-
replace: olcTLSCertificateFile
olcTLSCertificateFile: /container/service/slapd/assets/ssl/ldap.crt
olcTLSCertificateFile: /container/service/slapd/assets/certs/ldap.crt
-
replace: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /container/service/slapd/assets/ssl/ldap.key
olcTLSCertificateKeyFile: /container/service/slapd/assets/certs/ldap.key
-
replace: olcTLSDHParamFile
olcTLSDHParamFile: /container/service/slapd/assets/ssl/dhparam.pem
olcTLSDHParamFile: /container/service/slapd/assets/certs/dhparam.pem
-
replace: olcTLSVerifyClient
olcTLSVerifyClient: demand
2 changes: 0 additions & 2 deletions image/service/slapd/assets/ssl/README.md

This file was deleted.

46 changes: 23 additions & 23 deletions image/service/slapd/container-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ if [ ! -e "$FIRST_START_DONE" ]; then
local LDAP_KEY=$3

# check certificat and key or create it
/sbin/ssl-helper "/container/service/slapd/assets/ssl/$LDAP_CRT" "/container/service/slapd/assets/ssl/$LDAP_KEY" --ca-crt=/container/service/slapd/assets/ssl/$CA_CRT --gnutls
/sbin/ssl-helper "/container/service/slapd/assets/certs/$LDAP_CRT" "/container/service/slapd/assets/certs/$LDAP_KEY" --ca-crt=/container/service/slapd/assets/certs/$CA_CRT --gnutls

# create DHParamFile if not found
[ -f /container/service/slapd/assets/ssl/dhparam.pem ] || openssl dhparam -out /container/service/slapd/assets/ssl/dhparam.pem 2048
[ -f /container/service/slapd/assets/certs/dhparam.pem ] || openssl dhparam -out /container/service/slapd/assets/certs/dhparam.pem 2048

# fix file permissions
chown -R openldap:openldap /container/service/slapd
Expand Down Expand Up @@ -97,7 +97,7 @@ EOF

. $WAS_STARTED_WITH_TLS

check_tls_files $PREVIOUS_SSL_CA_CRT_FILENAME $PREVIOUS_SSL_CRT_FILENAME $PREVIOUS_SSL_KEY_FILENAME
check_tls_files $PREVIOUS_LDAP_TLS_CA_CRT_FILENAME $PREVIOUS_LDAP_TLS_CRT_FILENAME $PREVIOUS_LDAP_TLS_KEY_FILENAME
fi
fi

Expand Down Expand Up @@ -150,34 +150,34 @@ EOF
fi

# TLS config
if [ "${USE_TLS,,}" == "true" ]; then
if [ "${LDAP_PROPOSE_TLS,,}" == "true" ]; then

echo "Use TLS"

check_tls_files $SSL_CA_CRT_FILENAME $SSL_CRT_FILENAME $SSL_KEY_FILENAME
check_tls_files $LDAP_TLS_CA_CRT_FILENAME $LDAP_TLS_CRT_FILENAME $LDAP_TLS_KEY_FILENAME

# adapt tls ldif
sed -i "s,/container/service/slapd/assets/ssl/ca.crt,/container/service/slapd/assets/ssl/${SSL_CA_CRT_FILENAME},g" /container/service/slapd/assets/config/tls/tls-enable.ldif
sed -i "s,/container/service/slapd/assets/ssl/ldap.crt,/container/service/slapd/assets/ssl/${SSL_CRT_FILENAME},g" /container/service/slapd/assets/config/tls/tls-enable.ldif
sed -i "s,/container/service/slapd/assets/ssl/ldap.key,/container/service/slapd/assets/ssl/${SSL_KEY_FILENAME},g" /container/service/slapd/assets/config/tls/tls-enable.ldif
sed -i "s,/container/service/slapd/assets/certs/ca.crt,/container/service/slapd/assets/certs/${LDAP_TLS_CA_CRT_FILENAME},g" /container/service/slapd/assets/config/tls/tls-enable.ldif
sed -i "s,/container/service/slapd/assets/certs/ldap.crt,/container/service/slapd/assets/certs/${LDAP_TLS_CRT_FILENAME},g" /container/service/slapd/assets/config/tls/tls-enable.ldif
sed -i "s,/container/service/slapd/assets/certs/ldap.key,/container/service/slapd/assets/certs/${LDAP_TLS_KEY_FILENAME},g" /container/service/slapd/assets/config/tls/tls-enable.ldif

ldapmodify -Y EXTERNAL -Q -H ldapi:/// -f /container/service/slapd/assets/config/tls/tls-enable.ldif

[[ -f "$WAS_STARTED_WITH_TLS" ]] && rm -f "$WAS_STARTED_WITH_TLS"
touch $WAS_STARTED_WITH_TLS
echo "export PREVIOUS_SSL_CA_CRT_FILENAME=${SSL_CA_CRT_FILENAME}" >> $WAS_STARTED_WITH_TLS
echo "export PREVIOUS_SSL_CRT_FILENAME=${SSL_CRT_FILENAME}" >> $WAS_STARTED_WITH_TLS
echo "export PREVIOUS_SSL_KEY_FILENAME=${SSL_KEY_FILENAME}" >> $WAS_STARTED_WITH_TLS
echo "export PREVIOUS_LDAP_TLS_CA_CRT_FILENAME=${LDAP_TLS_CA_CRT_FILENAME}" >> $WAS_STARTED_WITH_TLS
echo "export PREVIOUS_LDAP_TLS_CRT_FILENAME=${LDAP_TLS_CRT_FILENAME}" >> $WAS_STARTED_WITH_TLS
echo "export PREVIOUS_LDAP_TLS_KEY_FILENAME=${LDAP_TLS_KEY_FILENAME}" >> $WAS_STARTED_WITH_TLS
chmod +x $WAS_STARTED_WITH_TLS

# ldap client config
sed -i "s,TLS_CACERT.*,TLS_CACERT /container/service/slapd/assets/ssl/${SSL_CA_CRT_FILENAME},g" /etc/ldap/ldap.conf
sed -i "s,TLS_CACERT.*,TLS_CACERT /container/service/slapd/assets/certs/${LDAP_TLS_CA_CRT_FILENAME},g" /etc/ldap/ldap.conf
echo "TLS_REQCERT demand" >> /etc/ldap/ldap.conf

[[ -f "$HOME/.ldaprc" ]] && rm -f $HOME/.ldaprc
touch $HOME/.ldaprc
echo "TLS_CERT /container/service/slapd/assets/ssl/${SSL_CRT_FILENAME}" >> $HOME/.ldaprc
echo "TLS_KEY /container/service/slapd/assets/ssl/${SSL_KEY_FILENAME}" >> $HOME/.ldaprc
echo "TLS_CERT /container/service/slapd/assets/certs/${LDAP_TLS_CRT_FILENAME}" >> $HOME/.ldaprc
echo "TLS_KEY /container/service/slapd/assets/certs/${LDAP_TLS_KEY_FILENAME}" >> $HOME/.ldaprc

else

Expand All @@ -190,24 +190,24 @@ EOF


# replication config
if [ "${USE_REPLICATION,,}" == "true" ]; then
if [ "${LDAP_REPLICATION,,}" == "true" ]; then

if [ -e "$WAS_STARTED_WITH_REPLICATION" ]; then
echo "Replication already set"
else
echo "Use replication"

REPLICATION_HOSTS=($REPLICATION_HOSTS)
LDAP_REPLICATION_HOSTS=($LDAP_REPLICATION_HOSTS)
i=1
for host in "${REPLICATION_HOSTS[@]}"
for host in "${LDAP_REPLICATION_HOSTS[@]}"
do

#host var contain a variable name, we access to the variable value
host=${!host}

sed -i "s|{{ REPLICATION_HOSTS }}|olcServerID: $i ${host}\n{{ REPLICATION_HOSTS }}|g" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "s|{{ REPLICATION_HOSTS_CONFIG_SYNC_REPL }}|olcSyncRepl: rid=00$i provider=${host} ${REPLICATION_CONFIG_SYNCPROV}\n{{ REPLICATION_HOSTS_CONFIG_SYNC_REPL }}|g" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "s|{{ REPLICATION_HOSTS_HDB_SYNC_REPL }}|olcSyncRepl: rid=10$i provider=${host} ${REPLICATION_HDB_SYNCPROV}\n{{ REPLICATION_HOSTS_HDB_SYNC_REPL }}|g" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "s|{{ LDAP_REPLICATION_HOSTS }}|olcServerID: $i ${host}\n{{ LDAP_REPLICATION_HOSTS }}|g" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "s|{{ LDAP_REPLICATION_HOSTS_CONFIG_SYNC_REPL }}|olcSyncRepl: rid=00$i provider=${host} ${LDAP_REPLICATION_CONFIG_SYNCPROV}\n{{ LDAP_REPLICATION_HOSTS_CONFIG_SYNC_REPL }}|g" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "s|{{ LDAP_REPLICATION_HOSTS_HDB_SYNC_REPL }}|olcSyncRepl: rid=10$i provider=${host} ${LDAP_REPLICATION_HDB_SYNCPROV}\n{{ LDAP_REPLICATION_HOSTS_HDB_SYNC_REPL }}|g" /container/service/slapd/assets/config/replication/replication-enable.ldif

((i++))
done
Expand All @@ -217,9 +217,9 @@ EOF
sed -i "s|\$LDAP_ADMIN_PASSWORD|$LDAP_ADMIN_PASSWORD|g" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "s|\$LDAP_CONFIG_PASSWORD|$LDAP_CONFIG_PASSWORD|g" /container/service/slapd/assets/config/replication/replication-enable.ldif

sed -i "/{{ REPLICATION_HOSTS }}/d" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "/{{ REPLICATION_HOSTS_CONFIG_SYNC_REPL }}/d" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "/{{ REPLICATION_HOSTS_HDB_SYNC_REPL }}/d" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "/{{ LDAP_REPLICATION_HOSTS }}/d" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "/{{ LDAP_REPLICATION_HOSTS_CONFIG_SYNC_REPL }}/d" /container/service/slapd/assets/config/replication/replication-enable.ldif
sed -i "/{{ LDAP_REPLICATION_HOSTS_HDB_SYNC_REPL }}/d" /container/service/slapd/assets/config/replication/replication-enable.ldif

ldapmodify -c -Y EXTERNAL -Q -H ldapi:/// -f /container/service/slapd/assets/config/replication/replication-enable.ldif
touch $WAS_STARTED_WITH_REPLICATION
Expand Down
10 changes: 5 additions & 5 deletions test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ load test_helper

@test "ldapsearch new database" {

run_image -h ldap.example.org -e USE_TLS=false
run_image -h ldap.example.org -e LDAP_PROPOSE_TLS=false
wait_service slapd
run docker exec $CONTAINER_ID ldapsearch -x -h ldap.example.org -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin
clear_container
Expand All @@ -32,7 +32,7 @@ load test_helper

@test "ldapsearch new database with strict TLS and custom ca/crt" {

run_image -h ldap.osixia.net -v $BATS_TEST_DIRNAME/ssl:/container/service/slapd/assets/ssl -e SSL_CRT_FILENAME=ldap-test.crt -e SSL_KEY_FILENAME=ldap-test.key -e SSL_CA_CRT_FILENAME=ca-test.crt
run_image -h ldap.osixia.net -v $BATS_TEST_DIRNAME/ssl:/container/service/slapd/assets/certs -e LDAP_TLS_CRT_FILENAME=ldap-test.crt -e LDAP_TLS_KEY_FILENAME=ldap-test.key -e LDAP_TLS_CA_CRT_FILENAME=ca-test.crt
wait_service slapd
run docker exec $CONTAINER_ID ldapsearch -x -h ldap.osixia.net -b dc=example,dc=org -ZZ -D "cn=admin,dc=example,dc=org" -w admin
clear_container
Expand All @@ -45,7 +45,7 @@ load test_helper

@test "ldapsearch existing database and config" {

run_image -h ldap.example.org -e USE_TLS=false -v $BATS_TEST_DIRNAME/database:/var/lib/ldap -v $BATS_TEST_DIRNAME/config:/etc/ldap/slapd.d
run_image -h ldap.example.org -e LDAP_PROPOSE_TLS=false -v $BATS_TEST_DIRNAME/database:/var/lib/ldap -v $BATS_TEST_DIRNAME/config:/etc/ldap/slapd.d
wait_service slapd
run docker exec $CONTAINER_ID ldapsearch -x -h ldap.example.org -b dc=osixia,dc=net -D "cn=admin,dc=osixia,dc=net" -w admin
clear_container
Expand All @@ -62,13 +62,13 @@ load test_helper
tmp_file="$BATS_TMPDIR/docker-test"

# replication ldap server
LDAP_REPL_CID=$(docker run -h ldap2.example.org -e USE_REPLICATION=true -e IS_REPLICATION_TEST=true -d $NAME:$VERSION)
LDAP_REPL_CID=$(docker run -h ldap2.example.org -e LDAP_REPLICATION=true -e IS_REPLICATION_TEST=true -d $NAME:$VERSION)
LDAP_REPL_IP=$(get_container_ip_by_cid $LDAP_REPL_CID)

sleep 2

# ldap server
run_image -h ldap.example.org -e USE_REPLICATION=true -e IS_REPLICATION_TEST=true
run_image -h ldap.example.org -e LDAP_REPLICATION=true -e IS_REPLICATION_TEST=true

# add route to hosts
docker exec $LDAP_REPL_CID /sbin/add-host $CONTAINER_IP ldap.example.org
Expand Down

0 comments on commit 105e9e3

Please sign in to comment.