From 1a7a15a587b50edfab7a39e43e08e9bedc90b1d6 Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Mon, 4 Apr 2016 17:34:46 -0700 Subject: [PATCH] add slapd Signed-off-by: Jess Frazelle --- slapd/Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ slapd/start.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 slapd/Dockerfile create mode 100755 slapd/start.sh diff --git a/slapd/Dockerfile b/slapd/Dockerfile new file mode 100644 index 0000000..3cb4e8d --- /dev/null +++ b/slapd/Dockerfile @@ -0,0 +1,40 @@ +# Run slapd in a docker container +# +# - `LDAP_DOMAIN` sets the LDAP root domain. (e.g. if you provide `foo.bar.com` +# here, the root of your directory will be `dc=foo,dc=bar,dc=com`) +# - `LDAP_ORGANIZATION` sets the human-readable name for your organization (e.g. +# `Acme Widgets Inc.`) +# - `LDAP_ROOTPASS` sets the LDAP admin user password (i.e. the password for +# `cn=admin,dc=example,dc=com` if your domain was `example.com`) +# +# How to start the container: +# +# docker run -v /data/ldap:/var/lib/ldap \ +# -e LDAP_DOMAIN=authy.auth.co \ +# -e LDAP_ORGANISATION="E Corp" \ +# -e LDAP_ROOTPASS=fsociety \ +# -d jess/slapd +# +# You can load an LDIF file (to set up your directory) like so: +# +# ldapadd -h localhost -p -c -x \ +# -D cn=admin,dc=mycorp,dc=com -W -f data.ldif +# +# Be aware that by default the LDAP port is accessible from anywhere if the \ +# host firewall is unconfigured. +# +FROM debian:jessie +MAINTAINER Jessica Frazelle + +RUN apt-get update && LC_ALL=C DEBIAN_FRONTEND=noninteractive \ + apt-get install -y \ + slapd \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* + +# Just some default values for fun! +ENV LDAP_ROOTPASS=fsociety LDAP_ORGANIZATION="E CORP" LDAP_DOMAIN=mr.robot.com + +COPY start.sh /start.sh + +ENTRYPOINT [ "/start.sh" ] diff --git a/slapd/start.sh b/slapd/start.sh new file mode 100755 index 0000000..5a6a78d --- /dev/null +++ b/slapd/start.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -e + +: LDAP_ROOTPASS=${LDAP_ROOTPASS} +: LDAP_DOMAIN=${LDAP_DOMAIN} +: LDAP_ORGANIZATION=${LDAP_ORGANIZATION} + +if [ ! -e /var/lib/ldap/docker_bootstrapped ]; then + echo "configuring slapd for first run" + + cat <