Skip to content

Commit ae02f79

Browse files
author
Administrator
committed
Merge branch 'release-0.4.0' into stable
2 parents 101d0c4 + 2c039da commit ae02f79

File tree

7 files changed

+58
-53
lines changed

7 files changed

+58
-53
lines changed

Dockerfile

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
FROM osixia/baseimage:0.6.0
2-
MAINTAINER Bertrand Gouny <bertrand.gouny@osixia.fr>
1+
FROM osixia/baseimage:0.8.0
2+
MAINTAINER Bertrand Gouny <bertrand.gouny@osixia.net>
33

44
# Default configuration: can be overridden at the docker command line
55
ENV LDAP_HOST 127.0.0.1
66
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-
# 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,17 +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 80 must (match port in phpLDAPadmin.nginx)
30-
EXPOSE 80
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
37+
3438
# phpLDAPadmin config
3539
RUN mkdir -p /etc/my_init.d
3640
ADD service/phpldapadmin/phpldapadmin.sh /etc/my_init.d/phpldapadmin.sh
3741

38-
# phpLDAPadmin nginx config
39-
ADD service/phpldapadmin/config/phpldapadmin.nginx /etc/nginx/sites-available/phpldapadmin
40-
4142
# Clear out the local repository of retrieved package files
4243
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NAME = osixia/phpldapadmin
2-
VERSION = 0.3.1
2+
VERSION = 0.4.0
33

44
.PHONY: all build test tag_latest release
55

README.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
11
# docker-phpLDAPadmin
22

3-
A docker.io image for phpLDAPadmin
3+
A version of the [osixia/phpldapadmin][1] image with the following improvements:
4+
5+
- A [bug on not finding "password_hash" when trying to create a new user][2] is fixed
6+
- phpLDAPadmin is also exposed via HTTPS on port 443 (using a self-signed certificate)
47

58
### Quick start
69
Run docker image with your custom environment variables :
710

8-
docker run -p 80:80 -e LDAP_HOST=ldap.example.com \
11+
docker run -p 80:80 -p 443:443 \
12+
-e LDAP_HOST=ldap.example.com \
913
-e LDAP_BASE_DN=dc=example,dc=com \
1014
-e LDAP_LOGIN_DN=cn=admin,dc=example,dc=com \
11-
-d osixia/phpldapadmin
15+
-d windfisch/phpldapadmin
16+
17+
phpLDAPadmin should be running on http://localhost and https://localhost
18+
19+
### nginx SSL configuration
20+
21+
The details for the self-signed certificate can be defined with the following environment variables:
1222

13-
phpLDAPadmin should be running on http://localhost
23+
| Variable | Default |
24+
| ---------------- | ----------------- |
25+
| SSL_COUNTRY | XX |
26+
| SSL_STATE | Some-State |
27+
| SSL_LOCATION | Some-Location |
28+
| SSL_ORGANIZATION | Some-Organization |
29+
| SSL_COMMON_NAME | Some-Common-Name |
1430

1531
### Build image from sources
1632

1733
Clone the repository
1834

19-
git clone https://github.com/osixia/docker-phpLDAPadmin
35+
git clone https://github.com/rabejens/docker-phpLDAPadmin
2036
cd docker-phpLDAPadmin
2137

2238
Build image
2339

2440
docker build -t phpldapadmin .
2541

26-
to be completed :)
42+
[1]: https://github.com/osixia/docker-phpLDAPadmin
43+
[2]: http://stackoverflow.com/questions/20673186/getting-error-for-setting-password-feild-when-creating-generic-user-account-phpl

service/phpldapadmin/config/phpldapadmin.nginx

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

service/phpldapadmin/phpldapadmin.sh

Lines changed: 16 additions & 4 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
@@ -59,9 +64,16 @@ if [ ! -e /etc/phpldapadmin/docker_bootstrapped ]; then
5964
sed -i "s/'cn=admin,dc=example,dc=com'/'${LDAP_LOGIN_DN}'/g" /etc/phpldapadmin/config.php
6065
sed -i "s/'My LDAP Server'/'${LDAP_SERVER_NAME}'/g" /etc/phpldapadmin/config.php
6166

62-
# nginx config
63-
ln -s /etc/nginx/sites-available/phpldapadmin /etc/nginx/sites-enabled/phpldapadmin
64-
rm /etc/nginx/sites-enabled/default
67+
# Fix the bug with password_hash
68+
# See http://stackoverflow.com/questions/20673186/getting-error-for-setting-password-feild-when-creating-generic-user-account-phpl
69+
sed -i "s/'password_hash'/'password_hash_custom'/" /usr/share/phpldapadmin/lib/TemplateRender.php
70+
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+
74+
# nginx config (tools from osixia/baseimage)
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
76+
/sbin/nginx-remove-vhost default
6577

6678
touch /etc/phpldapadmin/docker_bootstrapped
6779
else

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

0 commit comments

Comments
 (0)