Skip to content

Commit cbf8af3

Browse files
committed
new baseimage
1 parent 18ec54a commit cbf8af3

File tree

8 files changed

+52
-48
lines changed

8 files changed

+52
-48
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ By default HTTPS is enable, a certificate is created with the container hostname
4848

4949
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)).
5050

51-
Or you can set your custom certificate at run time, by mouting your a directory containing thoses files to **/osixia/service/phpldapadmin/assets/apache2/ssl** and adjust there name with the following environment variables :
51+
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 :
5252

53-
docker run -v /path/to/certifates:/osixia/service/phpldapadmin/assets/apache2/ssl \
53+
docker run -v /path/to/certifates:/container/service/phpldapadmin/assets/apache2/ssl \
5454
-e SSL_CRT_FILENAME=my-phpldapadmin.crt \
5555
-e SSL_KEY_FILENAME=my-phpldapadmin.key \
5656
-e SSL_CA_CRT_FILENAME=the-ca.crt \
@@ -92,7 +92,7 @@ Environement variables defaults are set in **image/env.yaml**. You can modify en
9292
$servers->setValue('server','host','ldap3.example.org');
9393

9494
If you want to set this variable at docker run command convert the yaml in python :
95-
95+
9696
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
9797

9898
To convert yaml to python online :
@@ -111,9 +111,9 @@ Ldap client TLS/LDAPS options :
111111

112112
- **USE_LDAP_CLIENT_SSL**: Enable ldap client tls config, ldap serveur certificate check and set client certificate. Defaults to `true`
113113
- **LDAP_REQCERT**: Set ldap.conf TLS_REQCERT. Defaults to `demand`
114-
- **LDAP_CA_CRT_FILENAME**: Set ldap.conf TLS_CACERT to /osixia/service/phpldapadmin/ssl/$LDAP_CA_CRT_FILENAME. Defaults to `ldap-ca.crt`
115-
- **LDAP_CRT_FILENAME**: Set .ldaprc TLS_CERT to /osixia/service/phpldapadmin/ssl/$LDAP_CRT_FILENAME. Defaults to `ldap-client.crt`
116-
- **LDAP_KEY_FILENAME**: Set .ldaprc TLS_KEY to /osixia/service/phpldapadmin/ssl/$LDAP_KEY_FILENAME. Defaults to `ldap-client.key`
114+
- **LDAP_CA_CRT_FILENAME**: Set ldap.conf TLS_CACERT to /container/service/phpldapadmin/ssl/$LDAP_CA_CRT_FILENAME. Defaults to `ldap-ca.crt`
115+
- **LDAP_CRT_FILENAME**: Set .ldaprc TLS_CERT to /container/service/phpldapadmin/ssl/$LDAP_CRT_FILENAME. Defaults to `ldap-client.crt`
116+
- **LDAP_KEY_FILENAME**: Set .ldaprc TLS_KEY to /container/service/phpldapadmin/ssl/$LDAP_KEY_FILENAME. Defaults to `ldap-client.key`
117117

118118
More information at : http://www.openldap.org/doc/admin24/tls.html (16.2.2. Client Configuration)
119119

image/Dockerfile

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
1-
FROM osixia/light-baseimage:0.1.0
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 ["/osixia/tool/run"]
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
1213
# 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/add-multiple-process-stack \
17-
&& /sbin/add-service-available apache2 php5-fpm ssl-helper-openssl ssl-helper-gnutls \
18-
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
19-
patch \
20-
php5-ldap \
21-
php5-readline \
22-
curl \
23-
&& curl -o phpldapadmin.tgz -SL http://downloads.sourceforge.net/project/phpldapadmin/phpldapadmin-php5/${PHPLDAPADMIN_VERSION}/phpldapadmin-${PHPLDAPADMIN_VERSION}.tgz \
24-
&& echo "$PHPLDAPADMIN_SHA1 *phpldapadmin.tgz" | sha1sum -c - \
25-
&& mkdir -p /var/www/phpldapadmin_bootstrap /var/www/phpldapadmin \
26-
&& tar -xzf phpldapadmin.tgz --strip 1 -C /var/www/phpldapadmin_bootstrap \
27-
&& apt-get remove -y --purge --auto-remove curl
28-
29-
# Add service directory to /osixia/service
30-
ADD service /osixia/service
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
3133

3234
# Use baseimage install-service script and clean all
33-
RUN ./sbin/install-service \
34-
&& rm phpldapadmin.tgz \
35-
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
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/*
3640

3741
# Add default env variables
3842
ADD env.yaml /etc/env.yaml

image/env.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SERVER_ADMIN: webmaster@example.org
1515

1616
# To use your custom certificat and key 2 options :
1717
# - add them in service/phpldapadmin/assets/apache2/ssl and build the image
18-
# - or during docker run mount a data volume with thoses files to /osixia/service/phpldapadmin/assets/apache2/ssl
18+
# - or during docker run mount a data volume with thoses files to /container/service/phpldapadmin/assets/apache2/ssl
1919
HTTPS: true
2020
SSL_CRT_FILENAME: phpldapadmin.crt
2121
SSL_KEY_FILENAME: phpldapadmin.key

image/service/phpldapadmin/assets/apache2/phpldapadmin-ssl.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
Include /etc/apache2/conf-available/vhost-partial-ssl.conf
1919

20-
SSLCertificateFile /osixia/service/phpldapadmin/assets/apache2/ssl/${SSL_CRT_FILENAME}
21-
SSLCertificateKeyFile /osixia/service/phpldapadmin/assets/apache2/ssl/${SSL_KEY_FILENAME}
22-
#SSLCACertificateFile /osixia/service/phpldapadmin/assets/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}
2323

2424
<Directory /var/www/phpldapadmin/htdocs >
2525
Require all granted
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Add your https ssl crt, key and ca crt here
2-
or during docker run mount a data volume with thoses files to /osixia/service/phpldapadmin/assets/apache2/ssl
2+
or during docker run mount a data volume with thoses files to /container/service/phpldapadmin/assets/apache2/ssl
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Add your ldap ssl crt, key and ca crt here
2-
or during docker run mount a data volume with thoses files to /osixia/service/phpldapadmin/assets/ssl
2+
or during docker run mount a data volume with thoses files to /container/service/phpldapadmin/assets/ssl

image/service/phpldapadmin/container-start.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ if [ ! -e "$FIRST_START_DONE" ]; then
99
if [ "${HTTPS,,}" == "true" ]; then
1010

1111
# check certificat and key or create it
12-
/sbin/ssl-helper "/osixia/service/phpldapadmin/assets/apache2/ssl/$SSL_CRT_FILENAME" "/osixia/service/phpldapadmin/assets/apache2/ssl/$SSL_KEY_FILENAME" --ca-crt=/osixia/service/phpldapadmin/assets/apache2/ssl/$SSL_CA_CRT_FILENAME
12+
/sbin/ssl-helper "/container/service/phpldapadmin/assets/apache2/ssl/$SSL_CRT_FILENAME" "/container/service/phpldapadmin/assets/apache2/ssl/$SSL_KEY_FILENAME" --ca-crt=/container/service/phpldapadmin/assets/apache2/ssl/$SSL_CA_CRT_FILENAME
1313

1414
# add CA certificat config if CA cert exists
15-
if [ -e "/osixia/service/phpldapadmin/assets/apache2/ssl/$SSL_CA_CRT_FILENAME" ]; then
16-
sed -i "s/#SSLCACertificateFile/SSLCACertificateFile/g" /osixia/service/phpldapadmin/assets/apache2/phpldapadmin-ssl.conf
15+
if [ -e "/container/service/phpldapadmin/assets/apache2/ssl/$SSL_CA_CRT_FILENAME" ]; then
16+
sed -i "s/#SSLCACertificateFile/SSLCACertificateFile/g" /container/service/phpldapadmin/assets/apache2/phpldapadmin-ssl.conf
1717
fi
1818

1919
a2ensite phpldapadmin-ssl
@@ -122,20 +122,20 @@ if [ ! -e "$FIRST_START_DONE" ]; then
122122
if [ "${USE_LDAP_CLIENT_SSL,,}" == "true" ]; then
123123

124124
# check certificat and key or create it
125-
/sbin/ssl-helper "/osixia/service/phpldapadmin/assets/ssl/${LDAP_CRT_FILENAME}" "/osixia/service/phpldapadmin/assets/ssl/${LDAP_KEY_FILENAME}" --ca-crt=/osixia/service/phpldapadmin/assets/ssl/${LDAP_CA_CRT_FILENAME} --gnutls
125+
/sbin/ssl-helper "/container/service/phpldapadmin/assets/ssl/${LDAP_CRT_FILENAME}" "/container/service/phpldapadmin/assets/ssl/${LDAP_KEY_FILENAME}" --ca-crt=/container/service/phpldapadmin/assets/ssl/${LDAP_CA_CRT_FILENAME} --gnutls
126126

127127
# ldap client config
128-
sed -i "s,TLS_CACERT.*,TLS_CACERT /osixia/service/phpldapadmin/assets/ssl/${LDAP_CA_CRT_FILENAME},g" /etc/ldap/ldap.conf
128+
sed -i "s,TLS_CACERT.*,TLS_CACERT /container/service/phpldapadmin/assets/ssl/${LDAP_CA_CRT_FILENAME},g" /etc/ldap/ldap.conf
129129
echo "TLS_REQCERT $LDAP_REQCERT" >> /etc/ldap/ldap.conf
130130

131131
www_data_homedir=$( getent passwd "www-data" | cut -d: -f6 )
132132

133133
[[ -f "$www_data_homedir/.ldaprc" ]] && rm -f $www_data_homedir/.ldaprc
134134
touch $www_data_homedir/.ldaprc
135-
echo "TLS_CERT /osixia/service/phpldapadmin/assets/ssl/${LDAP_CRT_FILENAME}" >> $www_data_homedir/.ldaprc
136-
echo "TLS_KEY /osixia/service/phpldapadmin/assets/ssl/${LDAP_KEY_FILENAME}" >> $www_data_homedir/.ldaprc
135+
echo "TLS_CERT /container/service/phpldapadmin/assets/ssl/${LDAP_CRT_FILENAME}" >> $www_data_homedir/.ldaprc
136+
echo "TLS_KEY /container/service/phpldapadmin/assets/ssl/${LDAP_KEY_FILENAME}" >> $www_data_homedir/.ldaprc
137137

138-
chown www-data:www-data -R /osixia/service/phpldapadmin/assets/ssl/
138+
chown www-data:www-data -R /container/service/phpldapadmin/assets/ssl/
139139
fi
140140

141141
fi

image/service/phpldapadmin/install.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
# this script is run during the image build
33

44
# Add phpLDAPadmin virtualhosts
5-
ln -s /osixia/service/phpldapadmin/assets/apache2/phpldapadmin.conf /etc/apache2/sites-available/phpldapadmin.conf
6-
ln -s /osixia/service/phpldapadmin/assets/apache2/phpldapadmin-ssl.conf /etc/apache2/sites-available/phpldapadmin-ssl.conf
5+
ln -s /container/service/phpldapadmin/assets/apache2/phpldapadmin.conf /etc/apache2/sites-available/phpldapadmin.conf
6+
ln -s /container/service/phpldapadmin/assets/apache2/phpldapadmin-ssl.conf /etc/apache2/sites-available/phpldapadmin-ssl.conf
77

8-
cp /osixia/service/phpldapadmin/assets/config.php /var/www/phpldapadmin_bootstrap/config/config.php
9-
rm /osixia/service/phpldapadmin/assets/config.php
8+
cp /container/service/phpldapadmin/assets/config.php /var/www/phpldapadmin_bootstrap/config/config.php
9+
rm /container/service/phpldapadmin/assets/config.php
1010

11-
cat /osixia/service/phpldapadmin/assets/php5-fpm/pool.conf >> /etc/php5/fpm/pool.d/www.conf
12-
rm /osixia/service/phpldapadmin/assets/php5-fpm/pool.conf
11+
cat /container/service/phpldapadmin/assets/php5-fpm/pool.conf >> /etc/php5/fpm/pool.d/www.conf
12+
rm /container/service/phpldapadmin/assets/php5-fpm/pool.conf
1313

1414
mkdir -p /var/www/tmp
1515
chown www-data:www-data /var/www/tmp
@@ -22,7 +22,7 @@ rm -rf /var/www/html
2222
rm -rf /var/www/phpldapadmin_bootstrap/doc
2323

2424
# apply php5.5 patch
25-
patch -p1 -d /var/www/phpldapadmin_bootstrap < /osixia/service/phpldapadmin/assets/php5.5.patch
25+
patch -p1 -d /var/www/phpldapadmin_bootstrap < /container/service/phpldapadmin/assets/php5.5.patch
2626
sed -i "s/password_hash/password_hash_custom/g" /var/www/phpldapadmin_bootstrap/lib/TemplateRender.php
2727

2828
# fix php5-fpm $_SERVER['SCRIPT_NAME'] bad value with cgi.fix_pathinfo=0

0 commit comments

Comments
 (0)