Skip to content

Commit 7cff1fd

Browse files
author
Administrator
committed
clean
1 parent 42d915b commit 7cff1fd

File tree

6 files changed

+25
-59
lines changed

6 files changed

+25
-59
lines changed

Dockerfile

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ ENV LDAP_BASE_DN dc=example,dc=com
77
ENV LDAP_LOGIN_DN cn=admin,dc=example,dc=com
88
ENV LDAP_SERVER_NAME docker.io phpLDAPadmin
99

10-
# LDAP TLS configs
11-
# add to run command -v some/host/dir:/etc/ldap/ssl
12-
# the directory some/host/dir must contain the ldap CA certificat file named ca.crt
10+
# phpmyadmin SSL certificat and private key filename
11+
ENV PHPLDAPADMIN_SSL_CRT_FILENAME phpmyadmin.crt
12+
ENV PHPLDAPADMIN_SSL_KEY_FILENAME phpmyadmin.key
13+
14+
# LDAP CA certificat filename
15+
ENV LDAP_TLS_CA_NAME ca.crt
1316

1417
# Disable SSH
1518
# RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh
@@ -26,21 +29,15 @@ RUN apt-get -y update
2629
# Install phpLDAPadmin
2730
RUN LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends phpldapadmin
2831

29-
# Expose port 443 (must match port in phpLDAPadmin.nginx)
30-
EXPOSE 443
32+
# Expose http and https default ports
33+
EXPOSE 80 443
3134

32-
# Create TSL certificats directory
35+
# Create LDAP CA certificat directory
3336
RUN mkdir /etc/ldap/ssl
3437

3538
# phpLDAPadmin config
3639
RUN mkdir -p /etc/my_init.d
3740
ADD service/phpldapadmin/phpldapadmin.sh /etc/my_init.d/phpldapadmin.sh
3841

39-
# Hide template warnings
40-
RUN echo "<?php \$config->custom->appearance['hide_template_warning'] = true; ?>" >>/usr/share/phpldapadmin/config/config.php
41-
42-
# phpLDAPadmin nginx config
43-
ADD service/phpldapadmin/config/phpldapadmin.nginx /etc/nginx/sites-available/phpldapadmin
44-
4542
# Clear out the local repository of retrieved package files
4643
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

service/phpldapadmin/config/phpldapadmin.nginx

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

service/phpldapadmin/phpldapadmin.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ else
4242
LDAP_SERVER_NAME=${LDAP_SERVER_NAME}
4343
fi
4444

45+
PHPLDAPADMIN_SSL_CRT_FILENAME=${PHPLDAPADMIN_SSL_CRT_FILENAME}
46+
PHPLDAPADMIN_SSL_KEY_FILENAME=${PHPLDAPADMIN_SSL_KEY_FILENAME}
47+
48+
LDAP_TLS_CA_NAME=${LDAP_TLS_CA_NAME}
49+
4550
if [ ! -e /etc/phpldapadmin/docker_bootstrapped ]; then
4651
status "configuring LDAP for first run"
4752

48-
if [ -e /etc/ldap/ssl/ca.crt ]; then
53+
if [ -e /etc/ldap/ssl/$LDAP_TLS_CA_NAME ]; then
4954
# LDAP CA
5055
sed -i "s/TLS_CACERT.*/TLS_CACERT \/etc\/ldap\/ssl\/ca.crt/g" /etc/ldap/ldap.conf
5156
sed -i '/TLS_CACERT/a\TLS_CIPHER_SUITE HIGH:MEDIUM:+SSLv3' /etc/ldap/ldap.conf
@@ -63,8 +68,11 @@ if [ ! -e /etc/phpldapadmin/docker_bootstrapped ]; then
6368
# See http://stackoverflow.com/questions/20673186/getting-error-for-setting-password-feild-when-creating-generic-user-account-phpl
6469
sed -i "s/'password_hash'/'password_hash_custom'/" /usr/share/phpldapadmin/lib/TemplateRender.php
6570

71+
# Hide template warnings
72+
sed -i "s:// \$config->custom->appearance\['hide_template_warning'\] = false;:\$config->custom->appearance\[\'hide_template_warning\'\] = true;:g" /etc/phpldapadmin/config.php
73+
6674
# nginx config (tools from osixia/baseimage)
67-
/sbin/nginx-add-vhost localhost /usr/share/phpldapadmin/htdocs php ssl
75+
/sbin/nginx-add-vhost localhost /usr/share/phpldapadmin/htdocs --php --ssl --ssl-crt=/etc/nginx/ssl/$PHPLDAPADMIN_SSL_CRT_FILENAME --ssl-key=/etc/nginx/ssl/$PHPLDAPADMIN_SSL_KEY_FILENAME
6876
/sbin/nginx-remove-vhost default
6977

7078
touch /etc/phpldapadmin/docker_bootstrapped

test/link.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ dir=$(dirname $0)
1212
runOptions="--link osixia-phpldapadmin-openldap:ldap"
1313
. $dir/tools/run-container.sh
1414

15-
echo "curl -c $testDir/cookie.txt $IP"
16-
curl -c $testDir/cookie.txt $IP
15+
echo "curl --insecure -c $testDir/cookie.txt https://$IP"
16+
curl --insecure -c $testDir/cookie.txt https://$IP
1717

18-
echo "curl http://$IP/cmd.php -L -b $testDir/cookie.txt -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Connection: keep-alive' --data 'cmd=login&server_id=1&nodecode%5Blogin_pass%5D=1&login=cn%3Dadmin%2Cdc%3Dexample%2Cdc%3Dcom&login_pass=toor&submit=Authenticate' --compressed"
18+
echo "curl --insecure https://$IP/cmd.php -L -b $testDir/cookie.txt -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Connection: keep-alive' --data 'cmd=login&server_id=1&nodecode%5Blogin_pass%5D=1&login=cn%3Dadmin%2Cdc%3Dexample%2Cdc%3Dcom&login_pass=toor&submit=Authenticate' --compressed"
1919

20-
curl http://$IP/cmd.php -L -b $testDir/cookie.txt -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Connection: keep-alive' --data 'cmd=login&server_id=1&nodecode%5Blogin_pass%5D=1&login=cn%3Dadmin%2Cdc%3Dexample%2Cdc%3Dcom&login_pass=toor&submit=Authenticate' --compressed
20+
curl --insecure https://$IP/cmd.php -L -b $testDir/cookie.txt -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Connection: keep-alive' --data 'cmd=login&server_id=1&nodecode%5Blogin_pass%5D=1&login=cn%3Dadmin%2Cdc%3Dexample%2Cdc%3Dcom&login_pass=toor&submit=Authenticate' --compressed
2121

2222
docker.io stop $openldap
2323
docker.io rm $openldap

test/simple.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
dir=$(dirname $0)
44
. $dir/tools/run-container.sh
55

6-
echo "curl $IP"
7-
curl $IP
6+
echo "curl --insecure https://$IP"
7+
curl --insecure https://$IP
88

99
$dir/tools/delete-container.sh

test/test.out

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)