Skip to content

Instantly share code, notes, and snippets.

@xcJeroen
Created September 25, 2014 13:23
Show Gist options
  • Save xcJeroen/3e2b2f2eebdfcb85cef0 to your computer and use it in GitHub Desktop.
Save xcJeroen/3e2b2f2eebdfcb85cef0 to your computer and use it in GitHub Desktop.
FROM base/archlinux
RUN echo "installing openldap" \
&& sed 's/^CheckSpace/# CheckSpace/g' -i /etc/pacman.conf \
&& pacman -Syyu --noconfirm \
&& sed 's/^# CheckSpace/CheckSpace/g' -i /etc/pacman.conf \
&& pacman -S --noconfirm openldap
RUN echo "configuring openldap" \
&& sed -i 's/^suffix.*/suffix\t"dc=example,dc=org"/' /etc/openldap/slapd.conf \
&& sed -i 's/^rootdn.*/rootdn\t"cn=root,dc=example,dc=org"/' /etc/openldap/slapd.conf \
&& sed -i 's/^rootpw.*/rootpw\tsecret/' /etc/openldap/slapd.conf \
&& echo "index cn eq" >> /etc/openldap/slapd.conf \
&& echo "index dc eq" >> /etc/openldap/slapd.conf \
&& mkdir /run/openldap/ \
&& chown ldap:ldap /run/openldap/ \
&& cp /etc/openldap/DB_CONFIG.example /var/lib/openldap/openldap-data/DB_CONFIG \
&& chown ldap:ldap /var/lib/openldap/openldap-data/DB_CONFIG \
&& sed -i 's/^set_cachesize.*/set_cachesize 0 10485760 1/' /var/lib/openldap/openldap-data/DB_CONFIG \
&& sed -i '/^database/ a cachesize\t100' /etc/openldap/slapd.conf \
&& (slapd & (sleep 1 && pkill slapd)) \
&& slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d/ \
&& chown -R ldap:ldap /etc/openldap/slapd.d/
EXPOSE 389
CMD ["/usr/bin/slapd", "-d", "1"]
#! /bin/sh --
set -e
echo "installing openldap"
sed 's/^CheckSpace/# CheckSpace/g' -i /etc/pacman.conf
pacman -Syyu --noconfirm
sed 's/^# CheckSpace/CheckSpace/g' -i /etc/pacman.conf
pacman -S --noconfirm openldap
echo "configuring openldap"
sed -i 's/^suffix.*/suffix\t"dc=example,dc=org"/' /etc/openldap/slapd.conf
sed -i 's/^rootdn.*/rootdn\t"cn=root,dc=example,dc=org"/' /etc/openldap/slapd.conf
sed -i 's/^rootpw.*/rootpw\tsecret/' /etc/openldap/slapd.conf
echo "index cn eq" >> /etc/openldap/slapd.conf
echo "index dc eq" >> /etc/openldap/slapd.conf
mkdir /run/openldap/
chown ldap:ldap /run/openldap/
cp /etc/openldap/DB_CONFIG.example /var/lib/openldap/openldap-data/DB_CONFIG
chown ldap:ldap /var/lib/openldap/openldap-data/DB_CONFIG
sed -i 's/^set_cachesize.*/set_cachesize 0 10485760 1/' /var/lib/openldap/openldap-data/DB_CONFIG
sed -i '/^database/ a cachesize\t100' /etc/openldap/slapd.conf
(slapd & (sleep 1 && pkill slapd))
slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d/
chown -R ldap:ldap /etc/openldap/slapd.d/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment