Skip to content

Commit 81b1367

Browse files
committed
Merge branch 'release-0.6.0' into stable
2 parents 2fc5a6f + 53e1208 commit 81b1367

File tree

15 files changed

+257
-113
lines changed

15 files changed

+257
-113
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
## 0.5.1 (release date: 2015-05-17)
1+
# Changelog
2+
3+
## 0.6.0
4+
- Use new baseimage: osixia/light-baseimage
5+
6+
## 0.5.1
27
- Fix #1 (can't activate SSL with own certificates)
38

4-
## 0.5.0 (release date: 2015-03-03)
9+
## 0.5.0
510
- New version initial release

Makefile

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

44
.PHONY: all build test tag_latest release
55

@@ -16,6 +16,5 @@ tag_latest:
1616

1717
release: build test tag_latest
1818
@if ! docker images $(NAME) | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME) version $(VERSION) is not yet built. Please run 'make build'"; false; fi
19-
@if ! head -n 1 CHANGELOG.md | grep -q 'release date'; then echo 'Please note the release date in Changelog.md.' && false; fi
2019
docker push $(NAME)
2120
@echo "*** Don't forget to run 'twgit release/hotfix finish' :)"

README.md

Lines changed: 95 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# osixia/phpldapadmin
22

3+
[![](https://badge.imagelayers.io/osixia/phpldapadmin:latest.svg)](https://imagelayers.io/?images=osixia/phpldapadmin:latest 'Get your own badge on imagelayers.io')
4+
35
A docker image to run phpLDAPadmin.
46
> [phpldapadmin.sourceforge.net](http://phpldapadmin.sourceforge.net)
57
6-
78
## Quick start
89

910
Run a phpLDAPadmin docker image by replacing `ldap.example.com` with your ldap host or IP :
@@ -17,22 +18,40 @@ That's it :) you can access phpLDAPadmin on **https://localhost**
1718

1819
## Examples
1920

20-
### OpenLDAP & phpLDAPadmin in 1''
21+
### OpenLDAP & phpLDAPadmin in 1'
22+
23+
Example script:
24+
25+
#!/bin/bash -e
26+
27+
# Run a ldap server, save the container id in LDAP_CID and get its IP:
28+
LDAP_CID=$(docker run -h ldap.example.org -d osixia/openldap:1.0.0)
29+
LDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP_CID)
30+
31+
# Run phpLDAPadmin and set ldap host to ldap ip
32+
PHPLDAP_CID=$(docker run -h phpldapadmin.example.org -e LDAP_HOSTS=$LDAP_IP -d osixia/phpldapadmin:0.6.0)
33+
34+
# We get phpLDAPadmin container ip
35+
PHPLDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $PHPLDAP_CID)
36+
37+
echo "Go to: https://$PHPLDAP_IP"
38+
echo "Login DN: cn=admin,dc=example,dc=org"
39+
echo "Password: admin"
2140

2241
### HTTPS
2342

2443
#### Use autogenerated certificate
25-
By default HTTPS is enable, a certificate is created for the CN (common name) example.org. To work properly on your server adjust SERVER_NAME environment variable to match the phpLDAPadmin server CN.
44+
By default HTTPS is enable, a certificate is created with the container hostname (set by -h option eg: phpldapadmin.my-compagny.com).
2645

27-
docker run -e SERVER_NAME=phpldapadmin.my-compagny.com -d osixia/phpldapadmin
46+
docker run -h phpldapadmin.my-compagny.com -d osixia/phpldapadmin
2847

2948
#### Use your own certificate
3049

31-
Add your custom certificate, private key and CA certificate in the directory **image/service/phpldapadmin/assets/apache2/ssl** adjust filename in **image/env.yml** and rebuild the image ([see manual build](#manual-build)).
50+
Add your custom certificate, private key and CA certificate in the directory **image/service/phpldapadmin/assets/apache2/ssl** adjust filename in **image/env.yaml** and rebuild the image ([see manual build](#manual-build)).
3251

33-
Or you can set your custom certificate at run time, by mouting your a directory containing thoses files to **/osixia/phpldapadmin/apache2/ssl** and adjust there name with the following environment variables :
52+
Or you can set your custom certificate at run time, by mouting your a directory containing thoses files to **/container/service/phpldapadmin/assets/apache2/ssl** and adjust there name with the following environment variables :
3453

35-
docker run -v /path/to/certifates:/osixia/phpldapadmin/apache2/ssl \
54+
docker run -v /path/to/certifates:/container/service/phpldapadmin/assets/apache2/ssl \
3655
-e SSL_CRT_FILENAME=my-phpldapadmin.crt \
3756
-e SSL_KEY_FILENAME=my-phpldapadmin.key \
3857
-e SSL_CA_CRT_FILENAME=the-ca.crt \
@@ -47,26 +66,90 @@ Add -e HTTPS=false to the run command :
4766

4867
## Environment Variables
4968

69+
Environement variables defaults are set in **image/env.yaml**. You can modify environment variable values directly in this file and rebuild the image ([see manual build](#manual-build)). You can also override those values at run time with -e argument or by setting your own env.yaml file as a docker volume to `/etc/env.yaml`. See examples below.
70+
71+
- **LDAP_HOSTS**: Set phpLDAPadmin server config. Defaults to :
72+
73+
- ldap.example.org:
74+
- server:
75+
- tls: true
76+
- login:
77+
- bind_id: cn=admin,dc=example,dc=org
78+
- ldap2.example.org
79+
- ldap3.example.org
80+
81+
This will be converted in the phpldapadmin config.php file to :
82+
83+
$servers->newServer('ldap_pla');
84+
$servers->setValue('server','name','ldap.example.org');
85+
$servers->setValue('server','host','ldap.example.org');
86+
$servers->setValue('server','tls',true);
87+
$servers->setValue('login','bind_id','cn=admin,dc=example,dc=org');
88+
$servers->newServer('ldap_pla');
89+
$servers->setValue('server','name','ldap2.example.org');
90+
$servers->setValue('server','host','ldap2.example.org');
91+
$servers->newServer('ldap_pla');
92+
$servers->setValue('server','name','ldap3.example.org');
93+
$servers->setValue('server','host','ldap3.example.org');
94+
95+
If you want to set this variable at docker run command convert the yaml in python :
96+
97+
docker run -e LDAP_HOSTS="[{'ldap.example.org': [{'server': [{'tls': True}]},{'login': [{'bind_id': 'cn=admin,dc=example,dc=org'}]}]}, 'ldap2.example.org', 'ldap3.example.org']" -d osixia/phpldapadmin
98+
99+
To convert yaml to python online :
100+
http://yaml-online-parser.appspot.com/
101+
102+
Apache config :
103+
- **SERVER_ADMIN**: Server admin email. Defaults to `webmaster@example.org`
104+
105+
HTTPS options :
106+
- **HTTPS**: Use apache ssl config. Defaults to `true`
107+
- **SSL_CRT_FILENAME**: Apache ssl certificate filename. Defaults to `phpldapadmin.crt`
108+
- **SSL_KEY_FILENAME**: Apache ssl certificate private key filename. Defaults to `phpldapadmin.key`
109+
- **SSL_CA_CRT_FILENAME**: Apache ssl CA certificate filename. Defaults to `ca.crt`
110+
111+
Ldap client TLS/LDAPS options :
112+
113+
- **USE_LDAP_CLIENT_SSL**: Enable ldap client tls config, ldap serveur certificate check and set client certificate. Defaults to `true`
114+
- **LDAP_REQCERT**: Set ldap.conf TLS_REQCERT. Defaults to `demand`
115+
- **LDAP_CA_CRT_FILENAME**: Set ldap.conf TLS_CACERT to /container/service/phpldapadmin/ssl/$LDAP_CA_CRT_FILENAME. Defaults to `ldap-ca.crt`
116+
- **LDAP_CRT_FILENAME**: Set .ldaprc TLS_CERT to /container/service/phpldapadmin/ssl/$LDAP_CRT_FILENAME. Defaults to `ldap-client.crt`
117+
- **LDAP_KEY_FILENAME**: Set .ldaprc TLS_KEY to /container/service/phpldapadmin/ssl/$LDAP_KEY_FILENAME. Defaults to `ldap-client.key`
118+
119+
More information at : http://www.openldap.org/doc/admin24/tls.html (16.2.2. Client Configuration)
120+
121+
### Set environment variables at run time :
122+
123+
Environment variable can be set directly by adding the -e argument in the command line, for example :
124+
125+
docker run -h phpldapadmin.example.org -e LDAP_HOSTS="ldap.example.org" \
126+
-d osixia/phpldapadmin
127+
128+
Or by setting your own `env.yaml` file as a docker volume to `/etc/env.yaml`
129+
130+
docker run -h ldap.example.org -v /data/my-env.yaml:/etc/env.yaml \
131+
-d osixia/openldap
132+
50133
## Manual build
51134

52135
Clone this project :
53136

54137
git clone https://github.com/osixia/docker-phpLDAPadmin
55-
cd docker-mariadb
138+
cd docker-phpLDAPadmin
56139

57140
Adapt Makefile, set your image NAME and VERSION, for example :
58141

59142
NAME = osixia/phpldapadmin
60-
VERSION = 0.5.0
61-
143+
VERSION = 0.6.0
144+
62145
becomes :
63146
NAME = billy-the-king/phpldapadmin
64147
VERSION = 0.1.0
65148

66149
Build your image :
67-
150+
68151
make build
69-
152+
70153
Run your image :
71154

72155
docker run -d billy-the-king/phpldapadmin:0.1.0
@@ -80,6 +163,3 @@ We use **Bats** (Bash Automated Testing System) to test this image:
80163
Install Bats, and in this project directory run :
81164

82165
make test
83-
84-
85-

image/Dockerfile

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,48 @@
1-
FROM osixia/baseimage:0.10.3
1+
FROM osixia/web-baseimage:0.1.0
22
MAINTAINER Bertrand Gouny <bertrand.gouny@osixia.net>
33

44
# phpLDAPadmin version
55
ENV PHPLDAPADMIN_VERSION 1.2.3
66
ENV PHPLDAPADMIN_SHA1 669fca66c75e24137e106fdd02e3832f81146e23
77

8-
# Use baseimage-docker's init system.
9-
CMD ["/sbin/my_init"]
8+
# Use baseimage's init system.
9+
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/run
10+
CMD ["/container/tool/run"]
1011

1112
# Install apache2 and php5-fpm using osixia/baseimage utils
12-
# Caution: /sbin/enable-service arguments order is important
13+
# Caution: /sbin/add-service-available arguments order is important
1314
# php5-fpm install will detect apache2 and configure it
1415

1516
# Download, check integrity and unzip phpLDAPadmin to /var/www/phpldapadmin_bootstrap
16-
RUN apt-get update && /sbin/enable-service apache2 php5-fpm ssl-kit \
17-
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends patch php5-ldap php5-readline \
18-
&& curl -o phpldapadmin.tgz -SL http://downloads.sourceforge.net/project/phpldapadmin/phpldapadmin-php5/${PHPLDAPADMIN_VERSION}/phpldapadmin-${PHPLDAPADMIN_VERSION}.tgz \
19-
&& echo "$PHPLDAPADMIN_SHA1 *phpldapadmin.tgz" | sha1sum -c - \
20-
&& mkdir -p /var/www/phpldapadmin_bootstrap /var/www/phpldapadmin \
21-
&& tar -xzf phpldapadmin.tgz --strip 1 -C /var/www/phpldapadmin_bootstrap
22-
23-
# Add install script and phpLDAPadmin assets
24-
ADD service/install.sh /tmp/install.sh
25-
ADD service/phpldapadmin/assets /osixia/phpldapadmin
26-
27-
# Run install script and clean all
28-
RUN ./tmp/install.sh \
29-
&& rm phpldapadmin.tgz \
30-
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
17+
RUN apt-get update \
18+
&& /container/tool/install-multiple-process-stack \
19+
&& /container/tool/install-service-available apache2 php5-fpm ssl-helper-openssl ssl-helper-gnutls \
20+
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
21+
patch \
22+
php5-ldap \
23+
php5-readline \
24+
curl \
25+
&& curl -o phpldapadmin.tgz -SL http://downloads.sourceforge.net/project/phpldapadmin/phpldapadmin-php5/${PHPLDAPADMIN_VERSION}/phpldapadmin-${PHPLDAPADMIN_VERSION}.tgz \
26+
&& echo "$PHPLDAPADMIN_SHA1 *phpldapadmin.tgz" | sha1sum -c - \
27+
&& mkdir -p /var/www/phpldapadmin_bootstrap /var/www/phpldapadmin \
28+
&& tar -xzf phpldapadmin.tgz --strip 1 -C /var/www/phpldapadmin_bootstrap \
29+
&& apt-get remove -y --purge --auto-remove curl
30+
31+
# Add service directory to /container/service
32+
ADD service /container/service
33+
34+
# Use baseimage install-service script and clean all
35+
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-service
36+
RUN /container/tool/install-service \
37+
&& rm phpldapadmin.tgz \
38+
&& apt-get clean \
39+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
3140

3241
# Add default env variables
33-
ADD env.yml /etc/env.yml
34-
35-
# Add phpLDAPadmin container start config
36-
ADD service/phpldapadmin/container-start.sh /etc/my_init.d/phpldapadmin
42+
ADD env.yaml /etc/env.yaml
3743

3844
# Set phpLDAPadmin data directory in a data volume
3945
VOLUME ["/var/www/phpldapadmin"]
4046

4147
# Expose http and https default ports
42-
EXPOSE 80 443
48+
EXPOSE 80 443
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
LDAP_HOSTS:
2-
- ldap1.example.org:
2+
- ldap.example.org:
33
- server:
44
- tls: true
55
- login:
@@ -8,16 +8,25 @@ LDAP_HOSTS:
88
- ldap3.example.org
99

1010
# Apache
11-
SERVER_NAME: example.org
1211
SERVER_ADMIN: webmaster@example.org
1312

14-
# Self signed certificat will be generated
13+
# Self signed certificat will be generated
1514
# if HTTPS is set to true and no certificat and key are provided.
1615

1716
# To use your custom certificat and key 2 options :
1817
# - add them in service/phpldapadmin/assets/apache2/ssl and build the image
19-
# - or during docker run mount a data volume with thoses files to /osixia/phpldapadmin/apache2/ssl
18+
# - or during docker run mount a data volume with thoses files to /container/service/phpldapadmin/assets/apache2/ssl
2019
HTTPS: true
2120
SSL_CRT_FILENAME: phpldapadmin.crt
2221
SSL_KEY_FILENAME: phpldapadmin.key
23-
SSL_CA_CRT_FILENAME: ca.crt
22+
SSL_CA_CRT_FILENAME: ca.crt
23+
24+
# LDAP certificate
25+
USE_LDAP_CLIENT_SSL: true
26+
27+
LDAP_REQCERT: demand
28+
LDAP_CA_CRT_FILENAME: ldap-ca.crt
29+
30+
# client certificate
31+
LDAP_CRT_FILENAME: ldap-client.crt
32+
LDAP_KEY_FILENAME: ldap-client.key

image/service/install.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<VirtualHost *:80>
2-
ServerName ${SERVER_NAME}
3-
Redirect permanent / https://${SERVER_NAME}/
2+
ServerName ${HOSTNAME}
3+
Redirect permanent / https://${HOSTNAME}/
44
</VirtualHost>
55

66
<IfModule mod_ssl.c>
77
<VirtualHost _default_:443>
88

9-
ServerName ${SERVER_NAME}
9+
ServerName ${HOSTNAME}
1010
ServerAdmin ${SERVER_ADMIN}
11+
ServerPath /phpldapadmin
1112

1213
DocumentRoot /var/www/phpldapadmin/htdocs
1314

@@ -16,9 +17,9 @@
1617

1718
Include /etc/apache2/conf-available/vhost-partial-ssl.conf
1819

19-
SSLCertificateFile /osixia/phpldapadmin/apache2/ssl/${SSL_CRT_FILENAME}
20-
SSLCertificateKeyFile /osixia/phpldapadmin/apache2/ssl/${SSL_KEY_FILENAME}
21-
#SSLCACertificateFile /osixia/phpldapadmin/apache2/ssl/${SSL_CA_CRT_FILENAME}
20+
SSLCertificateFile /container/service/phpldapadmin/assets/apache2/ssl/${SSL_CRT_FILENAME}
21+
SSLCertificateKeyFile /container/service/phpldapadmin/assets/apache2/ssl/${SSL_KEY_FILENAME}
22+
#SSLCACertificateFile /container/service/phpldapadmin/assets/apache2/ssl/${SSL_CA_CRT_FILENAME}
2223

2324
<Directory /var/www/phpldapadmin/htdocs >
2425
Require all granted
@@ -29,4 +30,4 @@
2930
</files>
3031

3132
</VirtualHost>
32-
</IfModule>
33+
</IfModule>
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<VirtualHost *:80>
2-
ServerName ${SERVER_NAME}
32

3+
ServerName ${HOSTNAME}
44
ServerAdmin ${SERVER_ADMIN}
5+
ServerPath /phpldapadmin
6+
57
DocumentRoot /var/www/phpldapadmin/htdocs
68

79
ErrorLog ${APACHE_LOG_DIR}/error.log
810
CustomLog ${APACHE_LOG_DIR}/access.log combined
911

10-
<Directory /var/www/phpldapadmin/htdocs >
12+
<Directory /var/www/phpldapadmin/htdocs >
1113
Require all granted
1214
</Directory>
1315

1416
<files config.php >
1517
Require all denied
1618
</files>
1719

18-
</VirtualHost>
20+
</VirtualHost>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Add your ssl crt, key and ca crt here
2-
or during docker run mount a data volume with thoses files to /osixia/phpldapadmin/apache2/ssl
1+
Add your https ssl crt, key and ca crt here
2+
or during docker run mount a data volume with thoses files to /container/service/phpldapadmin/assets/apache2/ssl

0 commit comments

Comments
 (0)