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
changes/42/775242/3
Eduardo Santos 2 years ago
parent d6220444fd
commit b9e4bd6b73

@ -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

@ -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
Loading…
Cancel
Save