Skip to content

Commit

Permalink
Merge branch 'hotfix-1.2.5' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandGouny committed Aug 16, 2019
2 parents f27f706 + 5e10294 commit 5a3bd46
Show file tree
Hide file tree
Showing 13 changed files with 232 additions and 86 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.2.5] - 2019-08-16
## Added
- Support for docker secrets #325. Thanks to @anagno !
- Add DISABLE_CHOWN environment variable #240
- pqChecker lib to check passwords strength with ppolicy pwdCheckModule

### Fixed
- Fix of incorrectly positioned 'log-helper debug' command #327. Thanks to @turcan !
- Fix domain dn #341. Thanks to @obourdon !

## [1.2.4] - 2019-03-14
### Fixed
- Excessive RAM usage on 1.2.2, increased 10x from 1.2.1 #242
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = osixia/openldap
VERSION = 1.2.4
VERSION = 1.2.5

.PHONY: build build-nocache test tag-latest push push-latest release git-tag-version

Expand Down
123 changes: 68 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,48 @@
![Docker Stars](https://img.shields.io/docker/stars/osixia/openldap.svg)
![](https://images.microbadger.com/badges/image/osixia/openldap.svg)

Latest release: 1.2.4 - OpenLDAP 2.4.47 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/openldap/) 
Latest release: 1.2.5 - OpenLDAP 2.4.47 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/openldap/) 

**A docker image to run OpenLDAP.**

> OpenLDAP website : [www.openldap.org](http://www.openldap.org/)

- [osixia/openldap](#osixiaopenldap)
- [Contributing](#contributing)
- [Quick Start](#quick-start)
- [Beginner Guide](#beginner-guide)
- [Create new ldap server](#create-new-ldap-server)
- [Data persistence](#data-persistence)
- [Edit your server configuration](#edit-your-server-configuration)
- [Seed ldap database with ldif](#seed-ldap-database-with-ldif)
- [Use an existing ldap database](#use-an-existing-ldap-database)
- [Backup](#backup)
- [Administrate your ldap server](#administrate-your-ldap-server)
- [TLS](#tls)
- [Use auto-generated certificate](#use-auto-generated-certificate)
- [Use your own certificate](#use-your-own-certificate)
- [Disable TLS](#disable-tls)
- [Multi master replication](#multi-master-replication)
- [Fix docker mounted file problems](#fix-docker-mounted-file-problems)
- [Debug](#debug)
- [Environment Variables](#environment-variables)
- [Default.yaml](#defaultyaml)
- [Default.startup.yaml](#defaultstartupyaml)
- [Set your own environment variables](#set-your-own-environment-variables)
- [Use command line argument](#use-command-line-argument)
- [Link environment file](#link-environment-file)
- [Make your own image or extend this image](#make-your-own-image-or-extend-this-image)
- [Advanced User Guide](#advanced-user-guide)
- [Extend osixia/openldap:1.2.4 image](#extend-osixiaopenldap124-image)
- [Make your own openldap image](#make-your-own-openldap-image)
- [Tests](#tests)
- [Kubernetes](#kubernetes)
- [Under the hood: osixia/light-baseimage](#under-the-hood-osixialight-baseimage)
- [Security](#security)
- [Known security issues](#known-security-issues)
- [Changelog](#changelog)
- [Contributing](#Contributing)
- [Quick Start](#Quick-Start)
- [Beginner Guide](#Beginner-Guide)
- [Create new ldap server](#Create-new-ldap-server)
- [Data persistence](#Data-persistence)
- [Edit your server configuration](#Edit-your-server-configuration)
- [Seed ldap database with ldif](#Seed-ldap-database-with-ldif)
- [Use an existing ldap database](#Use-an-existing-ldap-database)
- [Backup](#Backup)
- [Administrate your ldap server](#Administrate-your-ldap-server)
- [TLS](#TLS)
- [Use auto-generated certificate](#Use-auto-generated-certificate)
- [Use your own certificate](#Use-your-own-certificate)
- [Disable TLS](#Disable-TLS)
- [Multi master replication](#Multi-master-replication)
- [Fix docker mounted file problems](#Fix-docker-mounted-file-problems)
- [Debug](#Debug)
- [Environment Variables](#Environment-Variables)
- [Default.yaml](#Defaultyaml)
- [Default.startup.yaml](#Defaultstartupyaml)
- [Set your own environment variables](#Set-your-own-environment-variables)
- [Use command line argument](#Use-command-line-argument)
- [Link environment file](#Link-environment-file)
- [Docker Secrets](#Docker-Secrets)
- [Make your own image or extend this image](#Make-your-own-image-or-extend-this-image)
- [Advanced User Guide](#Advanced-User-Guide)
- [Extend osixia/openldap:1.2.5 image](#Extend-osixiaopenldap125-dev-image)
- [Make your own openldap image](#Make-your-own-openldap-image)
- [Tests](#Tests)
- [Kubernetes](#Kubernetes)
- [Under the hood: osixia/light-baseimage](#Under-the-hood-osixialight-baseimage)
- [Security](#Security)
- [Known security issues](#Known-security-issues)
- [Changelog](#Changelog)

## Contributing

Expand All @@ -57,11 +58,11 @@ If you find this image useful here's how you can help:
## Quick Start
Run OpenLDAP docker image:

docker run --name my-openldap-container --detach osixia/openldap:1.2.4
docker run --name my-openldap-container --detach osixia/openldap:1.2.5

Do not forget to add the port mapping for both port 389 and 636 if you wish to access the ldap server from another machine.

docker run -p 389:389 -p 636:636 --name my-openldap-container --detach osixia/openldap:1.2.4
docker run -p 389:389 -p 636:636 --name my-openldap-container --detach osixia/openldap:1.2.5

Either command starts a new container with OpenLDAP running inside. Let's make the first search in our LDAP container:

Expand Down Expand Up @@ -97,7 +98,7 @@ It will create an empty ldap for the company **Example Inc.** and the domain **e
By default the admin has the password **admin**. All those default settings can be changed at the docker command line, for example:

docker run --env LDAP_ORGANISATION="My Company" --env LDAP_DOMAIN="my-company.com" \
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.2.4
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.2.5

#### Data persistence

Expand Down Expand Up @@ -148,12 +149,12 @@ argument to entrypoint if you don't want to overwrite them.
# single file example:
docker run \
--volume ./bootstrap.ldif:/container/service/slapd/assets/config/bootstrap/ldif/50-bootstrap.ldif \
osixia/openldap:1.2.4 --copy-service
osixia/openldap:1.2.5 --copy-service

#directory example:
docker run \
--volume ./ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom \
osixia/openldap:1.2.4 --copy-service
osixia/openldap:1.2.5 --copy-service

### Use an existing ldap database

Expand All @@ -164,7 +165,7 @@ simply mount this directories as a volume to `/var/lib/ldap` and `/etc/ldap/slap

docker run --volume /data/slapd/database:/var/lib/ldap \
--volume /data/slapd/config:/etc/ldap/slapd.d \
--detach osixia/openldap:1.2.4
--detach osixia/openldap:1.2.5

You can also use data volume containers. Please refer to:
> [https://docs.docker.com/engine/tutorials/dockervolumes/](https://docs.docker.com/engine/tutorials/dockervolumes/)
Expand All @@ -184,7 +185,7 @@ If you are looking for a simple solution to administrate your ldap server you ca
#### Use auto-generated certificate
By default, TLS is already configured and enabled, certificate is created using container hostname (it can be set by docker run --hostname option eg: ldap.example.org).

docker run --hostname ldap.my-company.com --detach osixia/openldap:1.2.4
docker run --hostname ldap.my-company.com --detach osixia/openldap:1.2.5

#### Use your own certificate

Expand All @@ -194,24 +195,24 @@ You can set your custom certificate at run time, by mounting a directory contain
--env LDAP_TLS_CRT_FILENAME=my-ldap.crt \
--env LDAP_TLS_KEY_FILENAME=my-ldap.key \
--env LDAP_TLS_CA_CRT_FILENAME=the-ca.crt \
--detach osixia/openldap:1.2.4
--detach osixia/openldap:1.2.5

Other solutions are available please refer to the [Advanced User Guide](#advanced-user-guide)

#### Disable TLS
Add --env LDAP_TLS=false to the run command:

docker run --env LDAP_TLS=false --detach osixia/openldap:1.2.4
docker run --env LDAP_TLS=false --detach osixia/openldap:1.2.5

### Multi master replication
Quick example, with the default config.

#Create the first ldap server, save the container id in LDAP_CID and get its IP:
LDAP_CID=$(docker run --hostname ldap.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.2.4)
LDAP_CID=$(docker run --hostname ldap.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.2.5)
LDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP_CID)

#Create the second ldap server, save the container id in LDAP2_CID and get its IP:
LDAP2_CID=$(docker run --hostname ldap2.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.2.4)
LDAP2_CID=$(docker run --hostname ldap2.example.org --env LDAP_REPLICATION=true --detach osixia/openldap:1.2.5)
LDAP2_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $LDAP2_CID)

#Add the pair "ip hostname" to /etc/hosts on each containers,
Expand Down Expand Up @@ -247,7 +248,7 @@ You may have some problems with mounted files on some systems. The startup scrip

To fix that run the container with `--copy-service` argument :

docker run [your options] osixia/openldap:1.2.4 --copy-service
docker run [your options] osixia/openldap:1.2.5 --copy-service

### Debug

Expand All @@ -256,11 +257,11 @@ Available levels are: `none`, `error`, `warning`, `info`, `debug` and `trace`.

Example command to run the container in `debug` mode:

docker run --detach osixia/openldap:1.2.4 --loglevel debug
docker run --detach osixia/openldap:1.2.5 --loglevel debug

See all command line options:

docker run osixia/openldap:1.2.4 --help
docker run osixia/openldap:1.2.5 --help


## Environment Variables
Expand Down Expand Up @@ -326,7 +327,7 @@ Replication options:

If you want to set this variable at docker run command add the tag `#PYTHON2BASH:` and convert the yaml in python:

docker run --env LDAP_REPLICATION_HOSTS="#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']" --detach osixia/openldap:1.2.4
docker run --env LDAP_REPLICATION_HOSTS="#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']" --detach osixia/openldap:1.2.5

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

Expand All @@ -338,6 +339,7 @@ Other environment variables:
- **LDAP_REMOVE_CONFIG_AFTER_SETUP**: delete config folder after setup. Defaults to `true`
- **LDAP_SSL_HELPER_PREFIX**: ssl-helper environment variables prefix. Defaults to `ldap`, ssl-helper first search config from LDAP_SSL_HELPER_* variables, before SSL_HELPER_* variables.
- **HOSTNAME**: set the hostname of the running openldap server. Defaults to whatever docker creates.
- **DISABLE_CHOWN**: do not perform any chown to fix file ownership. Defaults to `false`


### Set your own environment variables
Expand All @@ -346,7 +348,7 @@ Other environment variables:
Environment variables can be set by adding the --env argument in the command line, for example:

docker run --env LDAP_ORGANISATION="My company" --env LDAP_DOMAIN="my-company.com" \
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.2.4
--env LDAP_ADMIN_PASSWORD="JonSn0w" --detach osixia/openldap:1.2.5

Be aware that environment variable added in command line will be available at any time
in the container. In this example if someone manage to open a terminal in this container
Expand All @@ -357,28 +359,39 @@ he will be able to read the admin password in clear text from environment variab
For example if your environment files **my-env.yaml** and **my-env.startup.yaml** are in /data/ldap/environment

docker run --volume /data/ldap/environment:/container/environment/01-custom \
--detach osixia/openldap:1.2.4
--detach osixia/openldap:1.2.5

Take care to link your environment files folder 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).

Note: the container will try to delete the **\*.startup.yaml** file after the end of startup files so the file will also be deleted on the docker host. To prevent that : use --volume /data/ldap/environment:/container/environment/01-custom**:ro** or set all variables in **\*.yaml** file and don't use **\*.startup.yaml**:

docker run --volume /data/ldap/environment/my-env.yaml:/container/environment/01-custom/env.yaml \
--detach osixia/openldap:1.2.4
--detach osixia/openldap:1.2.5

#### Docker Secrets

As an alternative to passing sensitive information via environmental variables, _FILE may be appended to the listed variables, causing
the startup.sh script to load the values for those values from files presented in the container. This is particular usefull for loading
passwords using the [Docker secrets](https://docs.docker.com/engine/swarm/secrets/) mechanism. For example:

docker run --env LDAP_ORGANISATION="My company" --env LDAP_DOMAIN="my-company.com" \
--env LDAP_ADMIN_PASSWORD_FILE=/run/secrets/authentication_admin_pw --detach osixia/openldap:1.2.4

Currently this is only supported for LDAP_ADMIN_PASSWORD, LDAP_CONFIG_PASSWORD, LDAP_READONLY_USER_PASSWORD

#### Make your own image or extend this image

This is the best solution if you have a private registry. Please refer to the [Advanced User Guide](#advanced-user-guide) just below.

## Advanced User Guide

### Extend osixia/openldap:1.2.4 image
### Extend osixia/openldap:1.2.5 image

If you need to add your custom TLS certificate, bootstrap config or environment files the easiest way is to extends this image.

Dockerfile example:

FROM osixia/openldap:1.2.4
FROM osixia/openldap:1.2.5
MAINTAINER Your Name <[email protected]>

ADD bootstrap /container/service/slapd/assets/config/bootstrap
Expand Down Expand Up @@ -420,7 +433,7 @@ Run your image:

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

> [https://github.com/sstephenson/bats](https://github.com/sstephenson/bats)
> [https://github.com/bats-core/bats-core](https://github.com/bats-core/bats-core)
Install Bats, and in this project directory run:

Expand Down
2 changes: 1 addition & 1 deletion example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '2'
services:
openldap:
image: osixia/openldap:1.2.4
image: osixia/openldap:1.2.5
container_name: openldap
environment:
LDAP_LOG_LEVEL: "256"
Expand Down
2 changes: 1 addition & 1 deletion example/extend-osixia-openldap/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM osixia/openldap:1.2.4
FROM osixia/openldap:1.2.5
MAINTAINER Your Name <[email protected]>

ADD bootstrap /container/service/slapd/assets/config/bootstrap
Expand Down
2 changes: 1 addition & 1 deletion example/kubernetes/simple/ldap-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
spec:
containers:
- name: ldap
image: osixia/openldap:1.2.4
image: osixia/openldap:1.2.5
volumeMounts:
- name: ldap-data
mountPath: /var/lib/ldap
Expand Down
2 changes: 1 addition & 1 deletion example/kubernetes/using-secrets/gce-statefullset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
spec:
containers:
- name: azaldap
image: osixia/openldap:1.2.4
image: osixia/openldap:1.2.5
imagePullPolicy: IfNotPresent
#command: ["/bin/bash","-c","while [ 1 = 1 ] ; do sleep 1; date; done"]
ports:
Expand Down
2 changes: 1 addition & 1 deletion example/kubernetes/using-secrets/ldap-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
spec:
containers:
- name: ldap
image: osixia/openldap:1.2.4
image: osixia/openldap:1.2.5
args: ["--copy-service"]
volumeMounts:
- name: ldap-data
Expand Down
32 changes: 21 additions & 11 deletions image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ FROM osixia/light-baseimage:1.1.2
ARG LDAP_OPENLDAP_GID
ARG LDAP_OPENLDAP_UID

ARG PQCHECKER_VERSION=2.0.0
ARG PQCHECKER_MD5=c005ce596e97d13e39485e711dcbc7e1

# Add openldap user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
# If explicit uid or gid is given, use it.
RUN if [ -z "${LDAP_OPENLDAP_GID}" ]; then groupadd -r openldap; else groupadd -r -g ${LDAP_OPENLDAP_GID} openldap; fi \
Expand All @@ -18,17 +21,24 @@ RUN echo "deb http://ftp.debian.org/debian stretch-backports main" >> /etc/apt/s
#  https://github.com/osixia/docker-light-baseimage/blob/stable/image/service-available/:ssl-tools/download.sh
RUN echo "path-include /usr/share/doc/krb5*" >> /etc/dpkg/dpkg.cfg.d/docker && apt-get -y update \
&& /container/tool/add-service-available :ssl-tools \
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get -t stretch-backports install -y --no-install-recommends \
ldap-utils \
libsasl2-modules \
libsasl2-modules-db \
libsasl2-modules-gssapi-mit \
libsasl2-modules-ldap \
libsasl2-modules-otp \
libsasl2-modules-sql \
openssl \
slapd \
krb5-kdc-ldap \
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get -t stretch-backports install -y --no-install-recommends \
ca-certificates \
curl \
ldap-utils \
libsasl2-modules \
libsasl2-modules-db \
libsasl2-modules-gssapi-mit \
libsasl2-modules-ldap \
libsasl2-modules-otp \
libsasl2-modules-sql \
openssl \
slapd \
krb5-kdc-ldap \
&& curl -o pqchecker.deb -SL http://www.meddeb.net/pub/pqchecker/deb/8/pqchecker_${PQCHECKER_VERSION}_amd64.deb \
&& echo "${PQCHECKER_MD5} *pqchecker.deb" | md5sum -c - \
&& dpkg -i pqchecker.deb \
&& rm pqchecker.deb \
&& apt-get remove -y --purge --auto-remove curl ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Expand Down
5 changes: 4 additions & 1 deletion image/environment/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@
LDAP_LOG_LEVEL: 256

# Ulimit
LDAP_NOFILE: 1024
LDAP_NOFILE: 1024

# Do not perform any chown to fix file ownership
DISABLE_CHOWN: false
Loading

0 comments on commit 5a3bd46

Please sign in to comment.