Skip to content

Commit a9a739a

Browse files
committed
Merge branch 'hotfix-0.6.7' into stable
2 parents 17a3c3a + bde7473 commit a9a739a

File tree

20 files changed

+458
-274
lines changed

20 files changed

+458
-274
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.7
4+
- Upgrade baseimage: web-baseimage:0.1.8
5+
36
## 0.6.6
47
- Upgrade baseimage: web-baseimage:0.1.7
58
- Makefile with build no cache

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.6
2+
VERSION = 0.6.7
33

44
.PHONY: all build build-nocache test tag_latest release
55

README.md

Lines changed: 173 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,41 @@
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')
3+
[![](https://badge.imagelayers.io/osixia/phpldapadmin:latest.svg)](https://imagelayers.io/?images=osixia/phpldapadmin:latest 'Get your own badge on imagelayers.io') | Latest release: 0.6.7 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/phpldapadmin/) 
44

55
A docker image to run phpLDAPadmin.
66
> [phpldapadmin.sourceforge.net](http://phpldapadmin.sourceforge.net)
77
8+
- [Quick start](#quick-start)
9+
- [OpenLDAP & phpLDAPadmin in 1'](#openldap--phpldapadmin-in-1)
10+
- [Beginner Guide](#beginner-guide)
11+
- [Use your own phpLDAPadmin config](#use-your-own-phpldapadmin-config)
12+
- [HTTPS](#https)
13+
- [Use autogenerated certificate](#use-autogenerated-certificate)
14+
- [Use your own certificate](#use-your-own-certificate)
15+
- [Disable HTTPS](#disable-https)
16+
- [Debug](#debug)
17+
- [Environment Variables](#environment-variables)
18+
- [Set your own environment variables](#set-your-own environment-variables)
19+
- [Use command line argument](#use-command-line-argument)
20+
- [Link environment file](#link-environment-file)
21+
- [Make your own image or extend this image](#make-your-own image-or-extend-this-image)
22+
- [Advanced User Guide](#advanced-user-guide)
23+
- [Extend osixia/phpldapadmin:0.6.7 image](#extend-osixiaphpldapadmin067-image)
24+
- [Make your own phpLDAPadmin image](#make-your-own-phpldapadmin-image)
25+
- [Tests](#tests)
26+
- [Kubernetes](#kubernetes)
27+
- [Under the hood: osixia/web-baseimage](#under-the-hood-osixiaweb-baseimage)
28+
- [Changelog](#changelog)
29+
830
## Quick start
931

1032
Run a phpLDAPadmin docker image by replacing `ldap.example.com` with your ldap host or IP :
1133

12-
sudo docker run -p 443:443 \
13-
-e PHPLDAPADMIN_LDAP_HOSTS=ldap.example.com \
14-
-d osixia/phpldapadmin
15-
16-
That's it :) you can access phpLDAPadmin on **https://localhost**
17-
34+
docker run -p 6443:443 \
35+
--env PHPLDAPADMIN_LDAP_HOSTS=ldap.example.com \
36+
--detach osixia/phpldapadmin:0.6.7
1837

19-
## Examples
38+
That's it :) you can access phpLDAPadmin on [https://localhost:6443](https://localhost:6443)
2039

2140
### OpenLDAP & phpLDAPadmin in 1'
2241

@@ -25,11 +44,11 @@ Example script:
2544
#!/bin/bash -e
2645

2746
# 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.1)
47+
LDAP_CID=$(docker run --hostname ldap.example.org --detach osixia/openldap:1.1.0)
2948
LDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP_CID)
3049

3150
# 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.4)
51+
PHPLDAP_CID=$(docker run --hostname phpldapadmin.example.org --env PHPLDAPADMIN_LDAP_HOSTS=$LDAP_IP --detach osixia/phpldapadmin:0.6.7)
3352

3453
# We get phpLDAPadmin container ip
3554
PHPLDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $PHPLDAP_CID)
@@ -38,66 +57,110 @@ Example script:
3857
echo "Login DN: cn=admin,dc=example,dc=org"
3958
echo "Password: admin"
4059

60+
61+
## Beginner Guide
62+
63+
### Use your own phpLDAPadmin config
64+
This image comes with a phpLDAPadmin config.php file that can be easily customized via environment variables for a quick bootstrap,
65+
but setting your own config.php is possible. 2 options:
66+
67+
- Link your config file at run time to `/container/service/phpldapadmin/assets/config.php` :
68+
69+
docker run --volume /data/my-config.php:/container/service/phpldapadmin/assets/config.php --detach osixia/phpldapadmin:0.6.7
70+
71+
- Add your config file by extending or cloning this image, please refer to the [Advanced User Guide](#advanced-user-guide)
72+
4173
### HTTPS
4274

4375
#### Use autogenerated certificate
44-
By default HTTPS is enable, a certificate is created with the container hostname (set by -h option eg: phpldapadmin.my-compagny.com).
76+
By default HTTPS is enable, a certificate is created with the container hostname (it can be set by docker run --hostname option eg: phpldapadmin.my-company.com).
4577

46-
docker run -h phpldapadmin.my-compagny.com -d osixia/phpldapadmin
78+
docker run --hostname phpldapadmin.my-company.com --detach osixia/phpldapadmin:0.6.7
4779

4880
#### Use your own certificate
4981

50-
Add your custom certificate, private key and CA certificate in the directory **image/service/phpldapadmin/assets/apache2/certs** adjust filename in **image/env.yaml** and rebuild the image ([see manual build](#manual-build)).
51-
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/certs** and adjust there name with the following environment variables :
82+
You can set your custom certificate at run time, by mounting a directory containing those files to **/container/service/phpldapadmin/assets/apache2/certs** and adjust their name with the following environment variables:
5383

54-
docker run -v /path/to/certifates:/container/service/phpldapadmin/assets/apache2/certs \
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 \
58-
-d osixia/phpldapadmin
84+
docker run --volume /path/to/certifates:/container/service/phpldapadmin/assets/apache2/certs \
85+
--env PHPLDAPADMIN_HTTPS_CRT_FILENAME=my-cert.crt \
86+
--env PHPLDAPADMIN_HTTPS_KEY_FILENAME=my-cert.key \
87+
--env PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME=the-ca.crt \
88+
--detach osixia/phpldapadmin:0.6.7
5989

60-
Ommit the -e PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME variable for self signed certificates
90+
Other solutions are available please refer to the [Advanced User Guide](#advanced-user-guide)
6191

6292
#### Disable HTTPS
63-
Add -e PHPLDAPADMIN_HTTPS=false to the run command :
93+
Add --env PHPLDAPADMIN_HTTPS=false to the run command :
6494

65-
docker run -e PHPLDAPADMIN_HTTPS=false -d osixia/phpldapadmin
95+
docker run --env PHPLDAPADMIN_HTTPS=false --detach osixia/phpldapadmin:0.6.7
6696

67-
## Environment Variables
97+
### Debug
6898

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 `/container/environment/env.yaml`. See examples below.
99+
The container default log level is **info**.
100+
Available levels are: `none`, `error`, `warning`, `info`, `debug` and `trace`.
70101

71-
- **PHPLDAPADMIN_LDAP_HOSTS**: Set phpLDAPadmin server config. Defaults to :
102+
Example command to run the container in `debug` mode:
72103

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
104+
docker run --detach osixia/phpldapadmin:0.6.7 --loglevel debug
80105

81-
This will be converted in the phpldapadmin config.php file to :
106+
See all command line options:
82107

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');
108+
docker run osixia/phpldapadmin:0.6.7 --help
94109

95-
If you want to set this variable at docker run command convert the yaml in python :
110+
## Environment Variables
96111

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
112+
Environment variables defaults are set in **image/environment/default.yaml**
98113

99-
To convert yaml to python online :
100-
http://yaml-online-parser.appspot.com/
114+
See how to [set your own environment variables](#set-your-own-environment-variables)
115+
116+
- **PHPLDAPADMIN_LDAP_HOSTS**: Set phpLDAPadmin server config. Defaults to :
117+
118+
```yaml
119+
- ldap.example.org:
120+
- server:
121+
- tls: true
122+
- login:
123+
- bind_id: cn=admin,dc=example,dc=org
124+
- ldap2.example.org
125+
- ldap3.example.org
126+
```
127+
This will be converted in the phpldapadmin config.php file to :
128+
```php5
129+
$servers->newServer('ldap_pla');
130+
$servers->setValue('server','name','ldap.example.org');
131+
$servers->setValue('server','host','ldap.example.org');
132+
$servers->setValue('server','tls',true);
133+
$servers->setValue('login','bind_id','cn=admin,dc=example,dc=org');
134+
$servers->newServer('ldap_pla');
135+
$servers->setValue('server','name','ldap2.example.org');
136+
$servers->setValue('server','host','ldap2.example.org');
137+
$servers->newServer('ldap_pla');
138+
$servers->setValue('server','name','ldap3.example.org');
139+
$servers->setValue('server','host','ldap3.example.org');
140+
```
141+
All server configuration are available, just add the needed entries, for example:
142+
```yaml
143+
- ldap.example.org:
144+
- server:
145+
- tls: true
146+
- port: 636
147+
- force_may: array('uidNumber','gidNumber','sambaSID')
148+
- login:
149+
- bind_id: cn=admin,dc=example,dc=org
150+
- bind_pass: p0p!
151+
- auto_number:
152+
- min: 1000
153+
- ldap2.example.org
154+
- ldap3.example.org
155+
```
156+
157+
See complete list: http://phpldapadmin.sourceforge.net/wiki/index.php/LDAP_server_definitions
158+
159+
If you want to set this variable at docker run command add the tag `#PYTHON2BASH:` and convert the yaml in python:
160+
161+
docker run --env PHPLDAPADMIN_LDAP_HOSTS="#PYTHON2BASH:[{'ldap.example.org': [{'server': [{'tls': True}]},{'login': [{'bind_id': 'cn=admin,dc=example,dc=org'}]}]}, 'ldap2.example.org', 'ldap3.example.org']" --detach osixia/phpldapadmin:0.6.7
162+
163+
To convert yaml to python online: http://yaml-online-parser.appspot.com/
101164

102165
Apache :
103166
- **PHPLDAPADMIN_SERVER_ADMIN**: Server admin email. Defaults to `webmaster@example.org`
@@ -118,19 +181,49 @@ Ldap client TLS/LDAPS :
118181

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

121-
### Set environment variables at run time :
184+
Other environment variables:
185+
- **PHPLDAPADMIN_CFSSL_PREFIX**: cfssl environment variables prefix. Defaults to `phpldapadmin`, cfssl-helper first search config from PHPLDAPADMIN_CFSSL_* variables, before CFSSL_* variables.
186+
- **LDAP_CLIENT_CFSSL_PREFIX**: cfssl environment variables prefix. Defaults to `ldap`, cfssl-helper first search config from LDAP_CFSSL_* variables, before CFSSL_* variables.
187+
188+
### Set your own environment variables
189+
190+
#### Use command line argument
191+
Environment variables can be set by adding the --env argument in the command line, for example:
192+
193+
docker run --env PHPLDAPADMIN_LDAP_HOSTS="ldap.example.org" \
194+
--detach osixia/phpldapadmin:0.6.7
122195

123-
Environment variable can be set directly by adding the -e argument in the command line, for example :
196+
#### Link environment file
124197

125-
docker run -h phpldapadmin.example.org -e PHPLDAPADMIN_LDAP_HOSTS="ldap.example.org" \
126-
-d osixia/phpldapadmin
198+
For example if your environment file is in : /data/environment/my-env.yaml
127199

128-
Or by setting your own `env.yaml` file as a docker volume to `/container/environment/env.yaml`
200+
docker run --volume /data/environment/my-env.yaml:/container/environment/01-custom/env.yaml \
201+
--detach osixia/phpldapadmin:0.6.7
129202

130-
docker run -h ldap.example.org -v /data/my-env.yaml:/container/environment/env.yaml \
131-
-d osixia/openldap
203+
Take care to link your environment file to `/container/environment/XX-somedir` (with XX < 99 so they will be processed before default environment files) and not directly to `/container/environment` because this directory contains predefined baseimage environment files to fix container environment (INITRD, LANG, LANGUAGE and LC_CTYPE).
132204

133-
## Manual build
205+
#### Make your own image or extend this image
206+
207+
This is the best solution if you have a private registry. Please refer to the [Advanced User Guide](#advanced-user-guide) just below.
208+
209+
## Advanced User Guide
210+
211+
### Extend osixia/phpldapadmin:0.6.7 image
212+
213+
If you need to add your custom TLS certificate, bootstrap config or environment files the easiest way is to extends this image.
214+
215+
Dockerfile example:
216+
217+
FROM osixia/phpldapadmin:0.6.7
218+
MAINTAINER Your Name <your@name.com>
219+
220+
ADD https-certs /container/service/phpldapadmin/assets/apache2/certs
221+
ADD ldap-certs /container/service/ldap-client/assets/certs
222+
ADD my-config.php /container/service/phpldapadmin/assets/config.php
223+
ADD environment /container/environment/01-custom
224+
225+
226+
### Make your own phpLDAPadmin image
134227

135228
Clone this project :
136229

@@ -140,12 +233,14 @@ Clone this project :
140233
Adapt Makefile, set your image NAME and VERSION, for example :
141234

142235
NAME = osixia/phpldapadmin
143-
VERSION = 0.6.4
236+
VERSION = 0.6.7
144237

145238
becomes :
146239
NAME = billy-the-king/phpldapadmin
147240
VERSION = 0.1.0
148241

242+
Add your custom certificate, environment files, config.php ...
243+
149244
Build your image :
150245

151246
make build
@@ -154,7 +249,7 @@ Run your image :
154249

155250
docker run -d billy-the-king/phpldapadmin:0.1.0
156251

157-
## Tests
252+
### Tests
158253

159254
We use **Bats** (Bash Automated Testing System) to test this image:
160255

@@ -163,3 +258,22 @@ We use **Bats** (Bash Automated Testing System) to test this image:
163258
Install Bats, and in this project directory run :
164259

165260
make test
261+
262+
### Kubernetes
263+
264+
Kubernetes is an open source system for managing containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications.
265+
266+
More information:
267+
- http://kubernetes.io
268+
- https://github.com/kubernetes/kubernetes
269+
270+
A kubernetes example is available in **example/kubernetes**
271+
272+
### Under the hood: osixia/web-baseimage
273+
274+
This image is based on osixia/web-baseimage.
275+
More info: https://github.com/osixia/docker-web-baseimage
276+
277+
## Changelog
278+
279+
Please refer to: [CHANGELOG.md](CHANGELOG.md)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apiVersion: v1
2+
kind: ReplicationController
3+
metadata:
4+
name: phpldapadmin-controller
5+
labels:
6+
app: phpldapadmin
7+
spec:
8+
replicas: 1
9+
selector:
10+
app: phpldapadmin
11+
template:
12+
metadata:
13+
labels:
14+
app: phpldapadmin
15+
spec:
16+
containers:
17+
- name: phpldapadmin
18+
image: osixia/phpldapadmin:0.6.7
19+
volumeMounts:
20+
- name: phpldapadmin-certs
21+
mountPath: /container/service/phpldapadmin/assets/apache2/certs
22+
- name: ldap-client-certs
23+
mountPath: /container/service/ldap-client/assets/certs
24+
ports:
25+
- containerPort: 443
26+
env:
27+
- name: PHPLDAPADMIN_LDAP_HOSTS
28+
value: "[{'ldap.example.org': [{'server': [{'tls': 'true'}]}]}]"
29+
- name: PHPLDAPADMIN_SERVER_ADMIN
30+
value: "webmaster@example.org"
31+
- name: PHPLDAPADMIN_HTTPS
32+
value: "true"
33+
- name: PHPLDAPADMIN_HTTPS_CRT_FILENAME
34+
value: "cert.crt"
35+
- name: PHPLDAPADMIN_HTTPS_KEY_FILENAME
36+
value: "cert.key"
37+
- name: PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME
38+
value: "ca.crt"
39+
- name: PHPLDAPADMIN_LDAP_CLIENT_TLS
40+
value: "true"
41+
- name: PHPLDAPADMIN_LDAP_CLIENT_TLS_REQCERT
42+
value: "demand"
43+
- name: PHPLDAPADMIN_LDAP_CLIENT_TLS_CRT_FILENAME
44+
value: "cert.crt"
45+
- name: PHPLDAPADMIN_LDAP_CLIENT_TLS_KEY_FILENAME
46+
value: "cert.key"
47+
- name: PHPLDAPADMIN_LDAP_CLIENT_TLS_CA_CRT_FILENAME
48+
value: "ca.crt"
49+
volumes:
50+
- name: phpldapadmin-certs
51+
hostPath:
52+
path: "/data/phpldapadmin/ssl/"
53+
- name: ldap-client-certs
54+
hostPath:
55+
path: "/data/phpldapadmin/ldap-client-certs/"

0 commit comments

Comments
 (0)