From b9e4bd6b73951f6c308c1a31b927af930d0948c5 Mon Sep 17 00:00:00 2001 From: Eduardo Santos Date: Thu, 11 Feb 2021 14:25:38 -0300 Subject: [PATCH] Add OpenLDAP to manila-docker-container This patch adds an OpenLDAP server and some LDAP utilities to the manila-docker-container Docker image. It modifies the Dockerfile so it installs the ``slapd`` and ``ldap-utils`` packages, calls the slapd.sh shell script, which configures slapd, and makes the container start slapd automatically when run. Change-Id: I56995cff4457a2cbfbf42a86ee45c75a259f41e5 --- data/docker/Dockerfile | 6 ++++- data/docker/slapd.sh | 50 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100755 data/docker/slapd.sh diff --git a/data/docker/Dockerfile b/data/docker/Dockerfile index d7f7f6e..bc068ea 100644 --- a/data/docker/Dockerfile +++ b/data/docker/Dockerfile @@ -1,6 +1,6 @@ FROM phusion/baseimage:0.9.18 -EXPOSE 111 2049 60934 43440 55392 53559 875 +EXPOSE 111 2049 60934 43440 55392 53559 875 389 636 CMD ["/sbin/my_init"] @@ -17,6 +17,7 @@ RUN apt-get update && apt-get install -y \ doxygen \ flex \ git-core \ + ldap-utils \ libcephfs-dev \ libdbus-1-dev \ libgssglue-dev \ @@ -28,6 +29,7 @@ RUN apt-get update && apt-get install -y \ portmap \ python-dbus \ samba \ + slapd \ smbclient \ uuid-dev &&\ mkdir -p /shares &&\ @@ -56,6 +58,7 @@ RUN apt-get update && apt-get install -y \ mkdir -p /etc/service/ganesha &&\ mkdir -p /etc/service/samba &&\ mkdir -p /etc/service/dbus &&\ + mkdir -p /etc/service/slapd &&\ apt-get purge -y \ bison \ build-essential \ @@ -92,3 +95,4 @@ ADD rpcbind.sh /etc/service/rpcbind/run ADD ganesha.sh /etc/service/ganesha/run ADD ganesha.conf /etc/ganesha/ganesha.conf ADD samba.sh /etc/service/samba/run +ADD slapd.sh /etc/service/slapd/run diff --git a/data/docker/slapd.sh b/data/docker/slapd.sh new file mode 100755 index 0000000..59f12d1 --- /dev/null +++ b/data/docker/slapd.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# Preseed slapd options to debconf. +cat << EOF | debconf-set-selections +slapd slapd/internal/adminpw password admin +slapd slapd/domain string example.com +slapd shared/organization string "Example, Inc." +slapd slapd/internal/generated_adminpw password admin +slapd slapd/internal/adminpw password admin +slapd slapd/password2 password admin +slapd slapd/password1 password admin +slapd slapd/dump_database_destdir string /var/backups/slapd-VERSION +slapd slapd/purge_database boolean true +slapd slapd/move_old_database boolean true +slapd slapd/allow_ldap_v2 boolean false +slapd slapd/no_configuration boolean false +slapd slapd/dump_database select when needed +EOF +dpkg-reconfigure -f noninteractive slapd + +# Start OpenLDAP. +/usr/sbin/slapd + +# Add cn=Administrator and cn=Guest entries. +ldapadd -x -H ldap://localhost:389 -D cn=admin,dc=example,dc=com -w admin << \ +EOF +dn: cn=Administrator,dc=example,dc=com +objectClass: top +objectClass: account +objectClass: posixAccount +objectClass: shadowAccount +cn: Administrator +uid: Administrator +uidNumber: 1024 +gidNumber: 1024 +homeDirectory: /home/Administrator +userPassword: Administrator + +dn: cn=Guest,dc=example,dc=com +objectClass: top +objectClass: account +objectClass: posixAccount +objectClass: shadowAccount +cn: Guest +uid: Guest +uidNumber: 2048 +gidNumber: 2048 +homeDirectory: /home/Guest +userPassword: Guest +EOF