-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move most envvars into scripts * Generate snake oil certificate on container build
- Loading branch information
Showing
5 changed files
with
41 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
FROM debian:7 | ||
FROM debian:jessie | ||
MAINTAINER Rafael Römhild <[email protected]> | ||
|
||
ENV DEBUG_LEVEL 256 | ||
ENV LDAP_DOMAIN planetexpress.com | ||
ENV LDAP_ADMIN_SECRET GoodNewsEveryone | ||
ENV LDAP_ORGANISATION Planet Express, Inc. | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Install slapd and requirements | ||
RUN apt-get update \ | ||
&& apt-get -y --no-install-recommends install \ | ||
slapd \ | ||
ldap-utils \ | ||
openssl \ | ||
ca-certificates \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get \ | ||
install -y --no-install-recommends \ | ||
slapd \ | ||
ldap-utils \ | ||
openssl \ | ||
ca-certificates \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENV LDAP_DEBUG_LEVEL=256 | ||
|
||
# Create TLS certificate and bootstrap directory | ||
RUN mkdir /etc/ldap/ssl /bootstrap | ||
|
||
|
@@ -33,5 +30,5 @@ VOLUME ["/etc/ldap/slapd.d", "/etc/ldap/ssl", "/var/lib/ldap", "/run/slapd"] | |
EXPOSE 389 | ||
EXPOSE 636 | ||
|
||
CMD [] | ||
ENTRYPOINT ["/bin/bash", "/run.sh"] | ||
CMD ["/bin/bash", "/run.sh"] | ||
ENTRYPOINT [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,3 @@ olcTLSCertificateKeyFile: /etc/ldap/ssl/ldap.key | |
- | ||
replace: olcTLSVerifyClient | ||
olcTLSVerifyClient: never | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,9 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
readonly LDAP_SSL_KEY="/etc/ldap/ssl/ldap.key" | ||
readonly LDAP_SSL_CERT="/etc/ldap/ssl/ldap.crt" | ||
|
||
|
||
make_snakeoil_certificate() { | ||
echo "Make snakeoil certificate for ${LDAP_DOMAIN}..." | ||
openssl req -subj "/CN=${LDAP_DOMAIN}" \ | ||
-new \ | ||
-newkey rsa:2048 \ | ||
-days 365 \ | ||
-nodes \ | ||
-x509 \ | ||
-keyout ${LDAP_SSL_KEY} \ | ||
-out ${LDAP_SSL_CERT} | ||
|
||
chmod 600 ${LDAP_SSL_KEY} | ||
} | ||
|
||
|
||
file_exist ${LDAP_SSL_CERT} \ | ||
|| make_snakeoil_certificate | ||
|
||
echo "starting slapd on port 389 and 636..." | ||
chown -R openldap:openldap /etc/ldap | ||
exec /usr/sbin/slapd -h "ldap:/// ldapi:/// ldaps:///" \ | ||
-u openldap \ | ||
-g openldap \ | ||
-d ${DEBUG_LEVEL} | ||
-d ${LDAP_DEBUG_LEVEL} |