Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dockerfile for pass-through autentication
FROM phusion/baseimage:0.9.8
MAINTAINER Iván Corrales Solera <developer@wesovi.com>
EXPOSE 389
ENV HOME /root
ENV LDAP_ORGANISATION Wesovi Labs
ENV LDAP_DOMAIN wesovilabs.com
ENV LDAP_BASE dc=wesovilabs,dc=com
ENV LDAP_ROOTPASS s3cr3t
ENV LDAP_LOG_LEVEL 256
# Disable SSH
RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh
# Use baseimage-docker's init system.
# Configure apt
RUN echo 'deb http://us.archive.ubuntu.com/ubuntu/ precise universe' >> /etc/apt/sources.list
RUN apt-get -y update
# Install slapd
RUN LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y slapd
RUN mkdir /etc/service/slapd
ADD slapd.sh /etc/service/slapd/run
RUN chmod +x /etc/service/slapd/run
# To store the data outside the container, mount /var/lib/ldap as a data volume
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# vim:ts=8:noet:
RUN apt-get update
RUN apt-get install -y sasl2-bin libsasl2-modules ldap-utils
ADD slapd.conf /usr/lib64/sasl2/slapd.conf
ADD saslauthd.conf /etc/saslauthd.conf
ADD saslauthd /etc/default/saslauthd
ADD ldap.conf /etc/openldap/ldap.conf
RUN chmod 777 /etc/default/saslauthd
RUN chmod 777 /var/run/saslauthd
RUN adduser openldap sasl
RUN usermod -a -G sasl openldap
ADD ldif/structure.ldif /var/data/structure.ldif
ENTRYPOINT "/etc/service/slapd/run"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment