Skip to content

Commit 84b402b

Browse files
committed
rename variables
1 parent a9f63fe commit 84b402b

File tree

7 files changed

+53
-53
lines changed

7 files changed

+53
-53
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33
## 0.6.1
4-
- Rename environment variable
4+
- Rename environment variables
55

66
## 0.6.0
77
- Use new baseimage: osixia/light-baseimage

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A docker image to run phpLDAPadmin.
1010
Run a phpLDAPadmin docker image by replacing `ldap.example.com` with your ldap host or IP :
1111

1212
sudo docker run -p 443:443 \
13-
-e LDAP_HOSTS=ldap.example.com \
13+
-e PHPLDAPADMIN_LDAP_HOSTS=ldap.example.com \
1414
-d osixia/phpldapadmin
1515

1616
That's it :) you can access phpLDAPadmin on **https://localhost**
@@ -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 LDAP_HOSTS=$LDAP_IP -d osixia/phpldapadmin:0.6.0)
32+
PHPLDAP_CID=$(docker run -h phpldapadmin.example.org -e PHPLDAPADMIN_LDAP_HOSTS=$LDAP_IP -d osixia/phpldapadmin:0.6.0)
3333

3434
# We get phpLDAPadmin container ip
3535
PHPLDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $PHPLDAP_CID)
@@ -52,23 +52,23 @@ Add your custom certificate, private key and CA certificate in the directory **i
5252
Or you can set your custom certificate at run time, by mouting your a directory containing thoses files to **/container/service/phpldapadmin/assets/apache2/certs** and adjust there name with the following environment variables :
5353

5454
docker run -v /path/to/certifates:/container/service/phpldapadmin/assets/apache2/certs \
55-
-e HTTPS_CRT_FILENAME=my-phpldapadmin.crt \
56-
-e HTTPS_KEY_FILENAME=my-phpldapadmin.key \
57-
-e HTTPS_CA_CRT_FILENAME=the-ca.crt \
55+
-e PHPLDAPADMIN_HTTPS_CRT_FILENAME=my-phpldapadmin.crt \
56+
-e PHPLDAPADMIN_HTTPS_KEY_FILENAME=my-phpldapadmin.key \
57+
-e PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME=the-ca.crt \
5858
-d osixia/phpldapadmin
5959

60-
Ommit the -e HTTPS_CA_CRT_FILENAME variable for self signed certificates
60+
Ommit the -e PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME variable for self signed certificates
6161

62-
#### Disable HTTPS
63-
Add -e HTTPS=false to the run command :
62+
#### Disable PHPLDAPADMIN_HTTPS
63+
Add -e PHPLDAPADMIN_HTTPS=false to the run command :
6464

65-
docker run -e HTTPS=false -d osixia/phpldapadmin
65+
docker run -e PHPLDAPADMIN_HTTPS=false -d osixia/phpldapadmin
6666

6767
## Environment Variables
6868

6969
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.
7070

71-
- **LDAP_HOSTS**: Set phpLDAPadmin server config. Defaults to :
71+
- **PHPLDAPADMIN_LDAP_HOSTS**: Set phpLDAPadmin server config. Defaults to :
7272

7373
- ldap.example.org:
7474
- server:
@@ -94,35 +94,35 @@ Environement variables defaults are set in **image/env.yaml**. You can modify en
9494

9595
If you want to set this variable at docker run command convert the yaml in python :
9696

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
97+
docker run -e PHPLDAPADMIN_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
9898

9999
To convert yaml to python online :
100100
http://yaml-online-parser.appspot.com/
101101

102102
Apache config :
103-
- **SERVER_ADMIN**: Server admin email. Defaults to `webmaster@example.org`
103+
- **PHPLDAPADMIN_SERVER_ADMIN**: Server admin email. Defaults to `webmaster@example.org`
104104

105-
HTTPS options :
106-
- **HTTPS**: Use apache ssl config. Defaults to `true`
107-
- **HTTPS_CRT_FILENAME**: Apache ssl certificate filename. Defaults to `phpldapadmin.crt`
108-
- **HTTPS_KEY_FILENAME**: Apache ssl certificate private key filename. Defaults to `phpldapadmin.key`
109-
- **HTTPS_CA_CRT_FILENAME**: Apache ssl CA certificate filename. Defaults to `ca.crt`
105+
PHPLDAPADMIN_HTTPS options :
106+
- **PHPLDAPADMIN_HTTPS**: Use apache ssl config. Defaults to `true`
107+
- **PHPLDAPADMIN_HTTPS_CRT_FILENAME**: Apache ssl certificate filename. Defaults to `phpldapadmin.crt`
108+
- **PHPLDAPADMIN_HTTPS_KEY_FILENAME**: Apache ssl certificate private key filename. Defaults to `phpldapadmin.key`
109+
- **PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME**: Apache ssl CA certificate filename. Defaults to `ca.crt`
110110

111111
Ldap client TLS/LDAPS options :
112112

113-
- **LDAP_CLIENT_USE_TLS**: Enable ldap client tls config, ldap serveur certificate check and set client certificate. Defaults to `true`
114-
- **LDAP_CLIENT_TLS_REQCERT**: Set ldap.conf TLS_REQCERT. Defaults to `demand`
115-
- **LDAP_CLIENT_TLS_CA_CRT_FILENAME**: Set ldap.conf TLS_CACERT to /container/service/phpldapadmin/ssl/$LDAP_CLIENT_TLS_CA_CRT_FILENAME. Defaults to `ldap-ca.crt`
116-
- **LDAP_CLIENT_TLS_CRT_FILENAME**: Set .ldaprc TLS_CERT to /container/service/phpldapadmin/ssl/$LDAP_CLIENT_TLS_CRT_FILENAME. Defaults to `ldap-client.crt`
117-
- **LDAP_CLIENT_TLS_KEY_FILENAME**: Set .ldaprc TLS_KEY to /container/service/phpldapadmin/ssl/$LDAP_CLIENT_TLS_KEY_FILENAME. Defaults to `ldap-client.key`
113+
- **PHPLDAPADMIN_LDAP_CLIENT_TLS**: Enable ldap client tls config, ldap serveur certificate check and set client certificate. Defaults to `true`
114+
- **PHPLDAPADMIN_LDAP_CLIENT_TLS_REQCERT**: Set ldap.conf TLS_REQCERT. Defaults to `demand`
115+
- **PHPLDAPADMIN_LDAP_CLIENT_TLS_CA_CRT_FILENAME**: Set ldap.conf TLS_CACERT to /container/service/phpldapadmin/ssl/$PHPLDAPADMIN_LDAP_CLIENT_TLS_CA_CRT_FILENAME. Defaults to `ldap-ca.crt`
116+
- **PHPLDAPADMIN_LDAP_CLIENT_TLS_CRT_FILENAME**: Set .ldaprc TLS_CERT to /container/service/phpldapadmin/ssl/$PHPLDAPADMIN_LDAP_CLIENT_TLS_CRT_FILENAME. Defaults to `ldap-client.crt`
117+
- **PHPLDAPADMIN_LDAP_CLIENT_TLS_KEY_FILENAME**: Set .ldaprc TLS_KEY to /container/service/phpldapadmin/ssl/$PHPLDAPADMIN_LDAP_CLIENT_TLS_KEY_FILENAME. Defaults to `ldap-client.key`
118118

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

121121
### Set environment variables at run time :
122122

123123
Environment variable can be set directly by adding the -e argument in the command line, for example :
124124

125-
docker run -h phpldapadmin.example.org -e LDAP_HOSTS="ldap.example.org" \
125+
docker run -h phpldapadmin.example.org -e PHPLDAPADMIN_LDAP_HOSTS="ldap.example.org" \
126126
-d osixia/phpldapadmin
127127

128128
Or by setting your own `env.yaml` file as a docker volume to `/etc/env.yaml`

image/env.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LDAP_HOSTS:
1+
PHPLDAPADMIN_LDAP_HOSTS:
22
- ldap.example.org:
33
- server:
44
- tls: true
@@ -8,22 +8,22 @@ LDAP_HOSTS:
88
- ldap3.example.org
99

1010
# Apache
11-
SERVER_ADMIN: webmaster@example.org
11+
PHPLDAPADMIN_SERVER_ADMIN: webmaster@example.org
1212

1313
# Self signed certificat will be generated
14-
# if HTTPS is set to true and no certificat and key are provided.
14+
# if PHPLDAPADMIN_HTTPS is set to true and no certificat and key are provided.
1515

1616
# To use your custom certificat and key 2 options :
1717
# - add them in service/phpldapadmin/assets/apache2/certs and build the image
1818
# - or during docker run mount a data volume with thoses files to /container/service/phpldapadmin/assets/apache2/certs
19-
HTTPS: true
20-
HTTPS_CRT_FILENAME: phpldapadmin.crt
21-
HTTPS_KEY_FILENAME: phpldapadmin.key
22-
HTTPS_CA_CRT_FILENAME: ca.crt
19+
PHPLDAPADMIN_HTTPS: true
20+
PHPLDAPADMIN_HTTPS_CRT_FILENAME: phpldapadmin.crt
21+
PHPLDAPADMIN_HTTPS_KEY_FILENAME: phpldapadmin.key
22+
PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME: ca.crt
2323

2424
# LDAP client tls config
25-
LDAP_CLIENT_USE_TLS: true
26-
LDAP_CLIENT_TLS_REQCERT: demand
27-
LDAP_CLIENT_TLS_CA_CRT_FILENAME: ldap-ca.crt
28-
LDAP_CLIENT_TLS_CRT_FILENAME: ldap-client.crt
29-
LDAP_CLIENT_TLS_KEY_FILENAME: ldap-client.key
25+
PHPLDAPADMIN_LDAP_CLIENT_TLS: true
26+
PHPLDAPADMIN_LDAP_CLIENT_TLS_REQCERT: demand
27+
PHPLDAPADMIN_LDAP_CLIENT_TLS_CA_CRT_FILENAME: ldap-ca.crt
28+
PHPLDAPADMIN_LDAP_CLIENT_TLS_CRT_FILENAME: ldap-client.crt
29+
PHPLDAPADMIN_LDAP_CLIENT_TLS_KEY_FILENAME: ldap-client.key

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<VirtualHost _default_:443>
88

99
ServerName ${HOSTNAME}
10-
ServerAdmin ${SERVER_ADMIN}
10+
ServerAdmin ${PHPLDAPADMIN_SERVER_ADMIN}
1111
ServerPath /phpldapadmin
1212

1313
DocumentRoot /var/www/phpldapadmin/htdocs
@@ -17,9 +17,9 @@
1717

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

20-
SSLCertificateFile /container/service/phpldapadmin/assets/apache2/certs/${HTTPS_CRT_FILENAME}
21-
SSLCertificateKeyFile /container/service/phpldapadmin/assets/apache2/certs/${HTTPS_KEY_FILENAME}
22-
#SSLCACertificateFile /container/service/phpldapadmin/assets/apache2/certs/${HTTPS_CA_CRT_FILENAME}
20+
SSLCertificateFile /container/service/phpldapadmin/assets/apache2/certs/${PHPLDAPADMIN_HTTPS_CRT_FILENAME}
21+
SSLCertificateKeyFile /container/service/phpldapadmin/assets/apache2/certs/${PHPLDAPADMIN_HTTPS_KEY_FILENAME}
22+
#SSLCACertificateFile /container/service/phpldapadmin/assets/apache2/certs/${PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME}
2323

2424
<Directory /var/www/phpldapadmin/htdocs >
2525
Require all granted

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<VirtualHost *:80>
22

33
ServerName ${HOSTNAME}
4-
ServerAdmin ${SERVER_ADMIN}
4+
ServerAdmin ${PHPLDAPADMIN_SERVER_ADMIN}
55
ServerPath /phpldapadmin
66

77
DocumentRoot /var/www/phpldapadmin/htdocs

image/service/phpldapadmin/container-start.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ FIRST_START_DONE="/etc/docker-phpldapadmin-first-start-done"
66
if [ ! -e "$FIRST_START_DONE" ]; then
77

88
# create phpLDAPadmin vhost
9-
if [ "${HTTPS,,}" == "true" ]; then
9+
if [ "${PHPLDAPADMIN_HTTPS,,}" == "true" ]; then
1010

1111
# check certificat and key or create it
12-
/sbin/ssl-helper "/container/service/phpldapadmin/assets/apache2/certs/$HTTPS_CRT_FILENAME" "/container/service/phpldapadmin/assets/apache2/certs/$HTTPS_KEY_FILENAME" --ca-crt=/container/service/phpldapadmin/assets/apache2/certs/$HTTPS_CA_CRT_FILENAME
12+
/sbin/ssl-helper "/container/service/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_CRT_FILENAME" "/container/service/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_KEY_FILENAME" --ca-crt=/container/service/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME
1313

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

@@ -91,8 +91,8 @@ if [ ! -e "$FIRST_START_DONE" ]; then
9191
}
9292

9393
# phpLDAPadmin config
94-
LDAP_HOSTS=($LDAP_HOSTS)
95-
for host in "${LDAP_HOSTS[@]}"
94+
PHPLDAPADMIN_LDAP_HOSTS=($PHPLDAPADMIN_LDAP_HOSTS)
95+
for host in "${PHPLDAPADMIN_LDAP_HOSTS[@]}"
9696
do
9797

9898
#host var contain a variable name, we access to the variable value and cast it to a table
@@ -119,21 +119,21 @@ if [ ! -e "$FIRST_START_DONE" ]; then
119119
fi
120120
done
121121

122-
if [ "${LDAP_CLIENT_USE_TLS,,}" == "true" ]; then
122+
if [ "${PHPLDAPADMIN_LDAP_CLIENT_TLS,,}" == "true" ]; then
123123

124124
# check certificat and key or create it
125-
/sbin/ssl-helper "/container/service/phpldapadmin/assets/ldap-client/certs/${LDAP_CLIENT_TLS_CRT_FILENAME}" "/container/service/phpldapadmin/assets/ldap-client/certs/${LDAP_CLIENT_TLS_KEY_FILENAME}" --ca-crt=/container/service/phpldapadmin/assets/ldap-client/certs/${LDAP_CLIENT_TLS_CA_CRT_FILENAME} --gnutls
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
126126

127127
# ldap client config
128-
sed -i "s,TLS_CACERT.*,TLS_CACERT /container/service/phpldapadmin/assets/ldap-client/certs/${LDAP_CLIENT_TLS_CA_CRT_FILENAME},g" /etc/ldap/ldap.conf
129-
echo "TLS_REQCERT $LDAP_CLIENT_TLS_REQCERT" >> /etc/ldap/ldap.conf
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
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 /container/service/phpldapadmin/assets/ldap-client/certs/${LDAP_CLIENT_TLS_CRT_FILENAME}" >> $www_data_homedir/.ldaprc
136-
echo "TLS_KEY /container/service/phpldapadmin/assets/ldap-client/certs/${LDAP_CLIENT_TLS_KEY_FILENAME}" >> $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
137137

138138
chown www-data:www-data -R /container/service/phpldapadmin/assets/ldap-client/certs/
139139
fi

test/test.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ load test_helper
3333
LDAP_IP=$(get_container_ip_by_cid $LDAP_CID)
3434

3535
# we start the wordpress container and set DB_HOSTS
36-
run_image -e LDAP_HOSTS=$LDAP_IP
36+
run_image -e PHPLDAPADMIN_LDAP_HOSTS=$LDAP_IP
3737

3838
# wait openldap
3939
wait_service_by_cid $LDAP_CID slapd

0 commit comments

Comments
 (0)