Skip to content

Commit 6e05f51

Browse files
committed
Merge branch 'hotfix-0.6.2' into stable
2 parents 3154079 + 4cd5f5d commit 6e05f51

File tree

8 files changed

+47
-35
lines changed

8 files changed

+47
-35
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 0.6.2
4+
- Better way to add custom config
5+
36
## 0.6.1
47
- Upgrade baseimage: osixia/web-baseimage:0.1.1
58
- Rename environment variables

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.6.1
2+
VERSION = 0.6.2
33

44
.PHONY: all build test tag_latest release
55

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Example script:
2929
LDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP_CID)
3030

3131
# Run phpLDAPadmin and set ldap host to ldap ip
32-
PHPLDAP_CID=$(docker run -h phpldapadmin.example.org -e PHPLDAPADMIN_LDAP_HOSTS=$LDAP_IP -d osixia/phpldapadmin:0.6.1)
32+
PHPLDAP_CID=$(docker run -h phpldapadmin.example.org -e PHPLDAPADMIN_LDAP_HOSTS=$LDAP_IP -d osixia/phpldapadmin:0.6.2)
3333

3434
# We get phpLDAPadmin container ip
3535
PHPLDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $PHPLDAP_CID)
@@ -99,16 +99,16 @@ Environement variables defaults are set in **image/env.yaml**. You can modify en
9999
To convert yaml to python online :
100100
http://yaml-online-parser.appspot.com/
101101

102-
Apache config :
102+
Apache :
103103
- **PHPLDAPADMIN_SERVER_ADMIN**: Server admin email. Defaults to `webmaster@example.org`
104104

105-
PHPLDAPADMIN_HTTPS options :
105+
HTTPS :
106106
- **PHPLDAPADMIN_HTTPS**: Use apache ssl config. Defaults to `true`
107107
- **PHPLDAPADMIN_HTTPS_CRT_FILENAME**: Apache ssl certificate filename. Defaults to `phpldapadmin.crt`
108108
- **PHPLDAPADMIN_HTTPS_KEY_FILENAME**: Apache ssl certificate private key filename. Defaults to `phpldapadmin.key`
109109
- **PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME**: Apache ssl CA certificate filename. Defaults to `ca.crt`
110110

111-
Ldap client TLS/LDAPS options :
111+
Ldap client TLS/LDAPS :
112112

113113
- **PHPLDAPADMIN_LDAP_CLIENT_TLS**: Enable ldap client tls config, ldap serveur certificate check and set client certificate. Defaults to `true`
114114
- **PHPLDAPADMIN_LDAP_CLIENT_TLS_REQCERT**: Set ldap.conf TLS_REQCERT. Defaults to `demand`
@@ -140,7 +140,7 @@ Clone this project :
140140
Adapt Makefile, set your image NAME and VERSION, for example :
141141

142142
NAME = osixia/phpldapadmin
143-
VERSION = 0.6.0
143+
VERSION = 0.6.2
144144

145145
becomes :
146146
NAME = billy-the-king/phpldapadmin

image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM osixia/web-baseimage:0.1.1
1+
FROM osixia/web-baseimage:0.1.2
22
MAINTAINER Bertrand Gouny <bertrand.gouny@osixia.net>
33

44
# phpLDAPadmin version
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add your custom config.php file here or mount one at docker run to /container/service/phpldapadmin/assets/config.php

image/service/phpldapadmin/assets/config.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/*
2929
* Autogenerated value will be automatically added by phpldapadmin/container-start.sh
3030
*/
31-
$config->custom->session['blowfish'] = '{{ PHPMYADMIN_CONFIG_BLOWFISH }}';
31+
$config->custom->session['blowfish'] = '{{ PHPLDAPADMIN_CONFIG_BLOWFISH }}';
3232

3333

3434
/*********************************************
@@ -63,5 +63,6 @@
6363
$servers = new Datastore();
6464

6565
/*
66-
* Autogenerated servers will come here
66+
* Autogenerated servers variables will come here
6767
*/
68+
{{ PHPLDAPADMIN_SERVERS }}

image/service/phpldapadmin/container-start.sh

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,21 @@ if [ ! -e "$FIRST_START_DONE" ]; then
2727
cp -R /var/www/phpldapadmin_bootstrap/* /var/www/phpldapadmin
2828
rm -rf /var/www/phpldapadmin_bootstrap
2929

30+
echo "link /container/service/phpldapadmin/assets/config.php to /var/www/phpldapadmin/config/config.php"
31+
ln -s /container/service/phpldapadmin/assets/config.php /var/www/phpldapadmin/config/config.php
32+
3033
get_salt() {
3134
salt=$(</dev/urandom tr -dc '1324567890#<>,()*.^@$% =-_~;:/{}[]+!`azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN' | head -c64 | tr -d '\\')
3235
}
3336

3437
# phpLDAPadmin cookie secret
3538
get_salt
36-
sed -i "s|{{ PHPMYADMIN_CONFIG_BLOWFISH }}|${salt}|g" /var/www/phpldapadmin/config/config.php
39+
sed -i "s|{{ PHPLDAPADMIN_CONFIG_BLOWFISH }}|${salt}|g" /var/www/phpldapadmin/config/config.php
40+
41+
append_to_servers() {
42+
TO_APPEND=$1
43+
sed -i "s|{{ PHPLDAPADMIN_SERVERS }}|${TO_APPEND}\n{{ PHPLDAPADMIN_SERVERS }}|g" /var/www/phpldapadmin/config/config.php
44+
}
3745

3846
print_by_php_type() {
3947

@@ -81,12 +89,12 @@ if [ ! -e "$FIRST_START_DONE" ]; then
8189
# the value contain a not empty variable
8290
elif [ -n "${!value}" ]; then
8391
local php_value=$(print_by_php_type ${!value})
84-
echo "\$servers->setValue($to_print'$key',$php_value);" >> /var/www/phpldapadmin/config/config.php
92+
append_to_servers "\$servers->setValue($to_print'$key',$php_value);"
8593

8694
# it's just a not empty value
8795
elif [ -n "$value" ]; then
8896
local php_value=$(print_by_php_type $value)
89-
echo "\$servers->setValue($to_print'$key',$php_value);" >> /var/www/phpldapadmin/config/config.php
97+
append_to_servers "\$servers->setValue($to_print'$key',$php_value);"
9098
fi
9199
}
92100

@@ -98,46 +106,48 @@ if [ ! -e "$FIRST_START_DONE" ]; then
98106
# host var contain a variable name, we access to the variable value and cast it to a table
99107
infos=(${!host})
100108

101-
echo "\$servers->newServer('ldap_pla');" >> /var/www/phpldapadmin/config/config.php
109+
append_to_servers "\$servers->newServer('ldap_pla');"
102110

103111
# it's a table of infos
104112
if [ "${#infos[@]}" -gt "1" ]; then
105-
echo "\$servers->setValue('server','name','${!infos[0]}');" >> /var/www/phpldapadmin/config/config.php
106-
echo "\$servers->setValue('server','host','${!infos[0]}');" >> /var/www/phpldapadmin/config/config.php
113+
append_to_servers "\$servers->setValue('server','name','${!infos[0]}');"
114+
append_to_servers "\$servers->setValue('server','host','${!infos[0]}');"
107115
host_infos "" ${infos[1]}
108116

109117
# it's just a host name
110118
# stored in a variable
111119
elif [ -n "${!host}" ]; then
112-
echo "\$servers->setValue('server','name','${!host}');" >> /var/www/phpldapadmin/config/config.php
113-
echo "\$servers->setValue('server','host','${!host}');" >> /var/www/phpldapadmin/config/config.php
120+
append_to_servers "\$servers->setValue('server','name','${!host}');"
121+
append_to_servers "\$servers->setValue('server','host','${!host}');"
114122

115123
# directly
116124
else
117-
echo "\$servers->setValue('server','name','${host}');" >> /var/www/phpldapadmin/config/config.php
118-
echo "\$servers->setValue('server','host','${host}');" >> /var/www/phpldapadmin/config/config.php
125+
append_to_servers "\$servers->setValue('server','name','${host}');"
126+
append_to_servers "\$servers->setValue('server','host','${host}');"
119127
fi
120128
done
121129

122-
if [ "${PHPLDAPADMIN_LDAP_CLIENT_TLS,,}" == "true" ]; then
130+
sed -i "/{{ PHPLDAPADMIN_SERVERS }}/d" /var/www/phpldapadmin/config/config.php
123131

124-
# check certificat and key or create it
125-
/sbin/ssl-helper "/container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_CRT_FILENAME}" "/container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_KEY_FILENAME}" --ca-crt=/container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_CA_CRT_FILENAME} --gnutls
132+
fi
126133

127-
# ldap client config
128-
sed -i "s,TLS_CACERT.*,TLS_CACERT /container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_CA_CRT_FILENAME},g" /etc/ldap/ldap.conf
129-
echo "TLS_REQCERT $PHPLDAPADMIN_LDAP_CLIENT_TLS_REQCERT" >> /etc/ldap/ldap.conf
134+
if [ "${PHPLDAPADMIN_LDAP_CLIENT_TLS,,}" == "true" ]; then
130135

131-
www_data_homedir=$( getent passwd "www-data" | cut -d: -f6 )
136+
# check certificat and key or create it
137+
/sbin/ssl-helper "/container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_CRT_FILENAME}" "/container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_KEY_FILENAME}" --ca-crt=/container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_CA_CRT_FILENAME} --gnutls
132138

133-
[[ -f "$www_data_homedir/.ldaprc" ]] && rm -f $www_data_homedir/.ldaprc
134-
touch $www_data_homedir/.ldaprc
135-
echo "TLS_CERT /container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_CRT_FILENAME}" >> $www_data_homedir/.ldaprc
136-
echo "TLS_KEY /container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_KEY_FILENAME}" >> $www_data_homedir/.ldaprc
139+
# ldap client config
140+
sed -i "s,TLS_CACERT.*,TLS_CACERT /container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_CA_CRT_FILENAME},g" /etc/ldap/ldap.conf
141+
echo "TLS_REQCERT $PHPLDAPADMIN_LDAP_CLIENT_TLS_REQCERT" >> /etc/ldap/ldap.conf
137142

138-
chown www-data:www-data -R /container/service/phpldapadmin/assets/ldap-client/certs/
139-
fi
143+
www_data_homedir=$( getent passwd "www-data" | cut -d: -f6 )
144+
145+
[[ -f "$www_data_homedir/.ldaprc" ]] && rm -f $www_data_homedir/.ldaprc
146+
touch $www_data_homedir/.ldaprc
147+
echo "TLS_CERT /container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_CRT_FILENAME}" >> $www_data_homedir/.ldaprc
148+
echo "TLS_KEY /container/service/phpldapadmin/assets/ldap-client/certs/${PHPLDAPADMIN_LDAP_CLIENT_TLS_KEY_FILENAME}" >> $www_data_homedir/.ldaprc
140149

150+
chown www-data:www-data -R /container/service/phpldapadmin/assets/ldap-client/certs/
141151
fi
142152

143153
# fix file permission

image/service/phpldapadmin/install.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
ln -s /container/service/phpldapadmin/assets/apache2/phpldapadmin.conf /etc/apache2/sites-available/phpldapadmin.conf
66
ln -s /container/service/phpldapadmin/assets/apache2/phpldapadmin-ssl.conf /etc/apache2/sites-available/phpldapadmin-ssl.conf
77

8-
cp /container/service/phpldapadmin/assets/config.php /var/www/phpldapadmin_bootstrap/config/config.php
9-
rm /container/service/phpldapadmin/assets/config.php
10-
118
cat /container/service/phpldapadmin/assets/php5-fpm/pool.conf >> /etc/php5/fpm/pool.d/www.conf
129
rm /container/service/phpldapadmin/assets/php5-fpm/pool.conf
1310

0 commit comments

Comments
 (0)