Skip to content

Commit 9e4b064

Browse files
committed
Fixup testing host
1 parent 10d2032 commit 9e4b064

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

docker/docker-compose.test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ services:
44
openldap:
55
build: .
66
command: ldap
7+
hostname: ldap.server.intranet
78
restart: on-failure:5
89
mem_limit: 256M
910
mem_reservation: 100M

docker/tests/run.sh

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
# @author William Desportes <williamdes@wdes.fr>
55
##
66

7+
LDAP_URI="ldap://ldap.server.intranet"
8+
79
seedFile() {
8-
ldapadd -H ldap://openldap -D "cn=admin,dc=example,dc=org" -w admin < "/tests/data/$1.ldiff"
10+
ldapadd -H ${LDAP_URI} -D "cn=admin,dc=example,dc=org" -w admin < "/tests/data/$1.ldiff"
911
}
1012

1113
seedEmail() {
@@ -20,9 +22,9 @@ seedOrg() {
2022

2123
set -eu
2224

23-
ldapwhoami -H ldap://openldap -D cn=admin,dc=example,dc=org -w "admin"
24-
ldapwhoami -H ldap://openldap -D cn=config -w "config"
25-
ldapwhoami -H ldap://openldap -D cn=monitor -w "monitor"
25+
ldapwhoami -H ${LDAP_URI} -D cn=admin,dc=example,dc=org -w "admin"
26+
ldapwhoami -H ${LDAP_URI} -D cn=config -w "config"
27+
ldapwhoami -H ${LDAP_URI} -D cn=monitor -w "monitor"
2628

2729
seedOrg org
2830
seedOrg org-email3
@@ -36,74 +38,74 @@ seedEmail email5
3638
seedEmail email6
3739

3840
echo 'Print results'
39-
ldapsearch -LLL -H ldap://openldap -D "cn=admin,dc=example,dc=org" -w admin -b "ou=people,dc=example,dc=org" '*'
41+
ldapsearch -LLL -H ${LDAP_URI} -D "cn=admin,dc=example,dc=org" -w admin -b "ou=people,dc=example,dc=org" '*'
4042

4143
echo 'Print config'
42-
ldapsearch -LLL -H ldap://openldap -D "cn=config" -w config -b "cn=config" 'cn=config'
44+
ldapsearch -LLL -H ${LDAP_URI} -D "cn=config" -w config -b "cn=config" 'cn=config'
4345

4446
echo 'Print supported SASL Mechanisms'
4547
saslauthd -v
46-
ldapsearch -LLL -x -H ldap://openldap -b "" -s base supportedSASLMechanisms
48+
ldapsearch -LLL -x -H ${LDAP_URI} -b "" -s base supportedSASLMechanisms
4749

4850
echo 'Login as email 1'
49-
ldapwhoami -H ldap://openldap -D "cn=John Pondu,ou=people,dc=example,dc=org" -w 'JohnPassWord!645987zefdm'
51+
ldapwhoami -H ${LDAP_URI} -D "cn=John Pondu,ou=people,dc=example,dc=org" -w 'JohnPassWord!645987zefdm'
5052
echo 'Login as email 1 bad password'
51-
ldapwhoami -H ldap://openldap -D "cn=Pondu John,ou=people,dc=example,dc=org" -w 'JohnPassWord!s645987zefdm' && ret=$? || ret=$?
53+
ldapwhoami -H ${LDAP_URI} -D "cn=Pondu John,ou=people,dc=example,dc=org" -w 'JohnPassWord!s645987zefdm' && ret=$? || ret=$?
5254
if [ $ret -ne 49 ]; then
5355
echo "Login should not work as the CN is wrong ($ret)"
5456
exit 1
5557
fi
5658

5759
echo 'Login as email 1 no password'
58-
ldapwhoami -H ldap://openldap -D "cn=John Pondu,ou=people,dc=example,dc=org" && ret=$? || ret=$?
60+
ldapwhoami -H ${LDAP_URI} -D "cn=John Pondu,ou=people,dc=example,dc=org" && ret=$? || ret=$?
5961
if [ $ret -ne 53 ]; then
6062
echo "Login should not work as the password is missing ($ret)"
6163
exit 1
6264
fi
6365

6466
echo 'Login as email 1 bad password'
65-
ldapwhoami -H ldap://openldap -D "cn=John Pondu,ou=people,dc=example,dc=org" -w 'JohnPassWord!s645987zefdm' && ret=$? || ret=$?
67+
ldapwhoami -H ${LDAP_URI} -D "cn=John Pondu,ou=people,dc=example,dc=org" -w 'JohnPassWord!s645987zefdm' && ret=$? || ret=$?
6668
if [ $ret -ne 49 ]; then
6769
echo "Login should not work as the password is wrong ($ret)"
6870
exit 1
6971
fi
7072

7173
echo 'Login as email 2'
72-
ldapwhoami -H ldap://openldap -D "cn=Cyrielle Pondu,ou=people,dc=example,dc=org" -w 'PassCyrielle!ILoveDogs'
74+
ldapwhoami -H ${LDAP_URI} -D "cn=Cyrielle Pondu,ou=people,dc=example,dc=org" -w 'PassCyrielle!ILoveDogs'
7375

7476
echo 'Login as email 3'
75-
ldapwhoami -H ldap://openldap -D "mail=alice@warz.eu,o=warz.eu,ou=people,dc=example,dc=org" -w 'oHHGf7YyJSihb6ifSwNWZPtEGzijjp8'
77+
ldapwhoami -H ${LDAP_URI} -D "mail=alice@warz.eu,o=warz.eu,ou=people,dc=example,dc=org" -w 'oHHGf7YyJSihb6ifSwNWZPtEGzijjp8'
7678

7779
# -a slapd will make it use slapd.conf in the plugin config folder
7880
#echo "oHHGf7YyJSihb6ifSwNWZPtEGzijjp8" | saslpasswd2 -a slapd -n -p -c -u warz.eu edwin@warz.eu
7981

8082
echo 'Login as email 4'
8183
echo -e "\tUsing SASL auth"
82-
ldapwhoami -Q -H ldap://openldap -U edwin@warz.eu -w 'oHHGf7YyJSihb6ifSwNWZPtEGzijjp8'
84+
ldapwhoami -Q -H ${LDAP_URI} -U edwin@warz.eu -w 'oHHGf7YyJSihb6ifSwNWZPtEGzijjp8'
8385
echo -e "\tUsing simple auth"
84-
ldapwhoami -H ldap://openldap -D "mail=edwin@warz.eu,o=warz.eu,ou=people,dc=example,dc=org" -w 'oHHGf7YyJSihb6ifSwNWZPtEGzijjp8'
86+
ldapwhoami -H ${LDAP_URI} -D "mail=edwin@warz.eu,o=warz.eu,ou=people,dc=example,dc=org" -w 'oHHGf7YyJSihb6ifSwNWZPtEGzijjp8'
8587

8688
echo 'Login as email 5'
8789
echo -e "\tUsing secure STARTTLS auth"
88-
ldapwhoami -ZZ -H ldap://openldap -D "mail=elana@caldin.eu,o=caldin.eu,ou=people,dc=example,dc=org" -w 'bandedetsylish'
90+
ldapwhoami -ZZ -H ${LDAP_URI} -D "mail=elana@caldin.eu,o=caldin.eu,ou=people,dc=example,dc=org" -w 'bandedetsylish'
8991
echo -e "\tUsing secure SSL auth"
9092
ldapwhoami -H ldaps://openldap -D "mail=elana@caldin.eu,o=caldin.eu,ou=people,dc=example,dc=org" -w 'bandedetsylish'
9193
echo -e "\tUsing simple auth"
92-
ldapwhoami -H ldap://openldap -D "mail=elana@caldin.eu,o=caldin.eu,ou=people,dc=example,dc=org" -w 'bandedetsylish'
94+
ldapwhoami -H ${LDAP_URI} -D "mail=elana@caldin.eu,o=caldin.eu,ou=people,dc=example,dc=org" -w 'bandedetsylish'
9395
echo -e "\tUsing SASL auth"
94-
ldapwhoami -Q -H ldap://openldap -U elana@caldin.eu -w 'bandedetsylish' && ret=$? || ret=$?
96+
ldapwhoami -Q -H ${LDAP_URI} -U elana@caldin.eu -w 'bandedetsylish' && ret=$? || ret=$?
9597
if [ $ret -ne 49 ]; then
9698
echo "Login can not work because the password is not usable for SASL and SRP secret is not set ($ret)"
9799
exit 1
98100
fi
99101

100102
echo 'Login as email 6'
101103
echo -e "\tUsing SASL auth"
102-
ldapwhoami -Q -H ldap://openldap -U elon@caldin.eu -w 'HVxmD6ejZ9nUX6MSnQUvqKui5YYG56P' && ret=$? || ret=$?
104+
ldapwhoami -Q -H ${LDAP_URI} -U elon@caldin.eu -w 'HVxmD6ejZ9nUX6MSnQUvqKui5YYG56P' && ret=$? || ret=$?
103105
if [ $ret -ne 49 ]; then
104106
echo "Login should not work for clear text passwords in the DB ($ret)"
105107
exit 1
106108
fi
107109

108110
echo -e "\tUsing simple auth"
109-
ldapwhoami -H ldap://openldap -D "mail=elon@caldin.eu,o=caldin.eu,ou=people,dc=example,dc=org" -w 'HVxmD6ejZ9nUX6MSnQUvqKui5YYG56P'
111+
ldapwhoami -H ${LDAP_URI} -D "mail=elon@caldin.eu,o=caldin.eu,ou=people,dc=example,dc=org" -w 'HVxmD6ejZ9nUX6MSnQUvqKui5YYG56P'

0 commit comments

Comments
 (0)