This repository has been archived on 2026-11-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
docker-openldap/test/run-tls.sh
T
2014-05-06 18:01:09 +02:00

22 lines
659 B
Bash
Executable File

#!/bin/sh
docker.io run --name openldap-test-container --dns=127.0.0.1 -v `pwd`/test/ssl:/etc/ldap/ssl -p 65389:389 -d openldap-test
cert=$(echo `pwd`/test/ssl/ldap.crt)
certCN=$(openssl x509 -in $cert -subject -noout | sed -n 's/.*CN=\(.*\)\/*\(.*\)/\1/p')
addLine=$(echo "127.0.0.1" $certCN)
echo $addLine >> /etc/hosts
cp /etc/ldap/ldap.conf /etc/ldap/ldap.conf.old
sed -i 's,TLS_CACERT.*,TLS_CACERT '"$cert"',g' /etc/ldap/ldap.conf
sleep 5
ldapsearch -x -h $certCN -p 65389 -b dc=example,dc=com -ZZ
sed -i '/'"$addLine"'/d' /etc/hosts
cp /etc/ldap/ldap.conf.old /etc/ldap/ldap.conf
rm /etc/ldap/ldap.conf.old
$(pwd)/test/tools/delete-container.sh