You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2016/09/25 21:41:13 UTC

svn commit: r1762240 - in /directory/buildtools/docker/openldap: ./ Dockerfile README.md slapd-config.ldif slapd-data.ldif

Author: seelmann
Date: Sun Sep 25 21:41:13 2016
New Revision: 1762240

URL: http://svn.apache.org/viewvc?rev=1762240&view=rev
Log:
Add basic Dockerfile with OpenLDAP

Added:
    directory/buildtools/docker/openldap/
    directory/buildtools/docker/openldap/Dockerfile
    directory/buildtools/docker/openldap/README.md
    directory/buildtools/docker/openldap/slapd-config.ldif
    directory/buildtools/docker/openldap/slapd-data.ldif

Added: directory/buildtools/docker/openldap/Dockerfile
URL: http://svn.apache.org/viewvc/directory/buildtools/docker/openldap/Dockerfile?rev=1762240&view=auto
==============================================================================
--- directory/buildtools/docker/openldap/Dockerfile (added)
+++ directory/buildtools/docker/openldap/Dockerfile Sun Sep 25 21:41:13 2016
@@ -0,0 +1,47 @@
+#
+#   Licensed to the Apache Software Foundation (ASF) under one 
+#   or more contributor license agreements.  See the NOTICE file
+#   distributed with this work for additional information
+#   regarding copyright ownership.  The ASF licenses this file
+#   to you under the Apache License, Version 2.0 (the
+#   "License"); you may not use this file except in compliance
+#   with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
+#   KIND, either express or implied.  See the License for the 
+#   specific language governing permissions and limitations
+#   under the License.
+#
+
+FROM alpine
+
+RUN apk add --no-cache openldap openldap-back-hdb openldap-clients openssl
+
+ADD slapd-config.ldif slapd-data.ldif /tmp/
+
+# Generate a self-signed SSL certificate
+RUN openssl req -newkey rsa:4096 -sha512 -x509 -days 3650 -nodes \
+    -subj "/C=NA/ST=NA/L=NA/O=NA/CN=example.com" \
+    -out /etc/ssl/certs/ldap.pem -keyout /etc/ssl/private/ldap.pem && \
+    chown root:ldap /etc/ssl/private/ldap.pem && \
+    chmod 640 /etc/ssl/private/ldap.pem
+
+# Inject configuration
+RUN mkdir /etc/openldap/slapd.d && \
+    slapadd -d -1 -F /etc/openldap/slapd.d -n 0 -l /tmp/slapd-config.ldif
+
+# Inject data
+RUN slapadd -d 1 -F /etc/openldap/slapd.d -l /tmp/slapd-data.ldif
+
+# Fix permissions
+RUN chown -R ldap:ldap /var/lib/openldap && \
+    chown -R ldap:ldap /etc/openldap/slapd.d
+
+EXPOSE 389 636
+
+CMD /usr/sbin/slapd -d 256 -u ldap -g ldap -F /etc/openldap/slapd.d -h "ldap:/// ldaps:///"
+

Added: directory/buildtools/docker/openldap/README.md
URL: http://svn.apache.org/viewvc/directory/buildtools/docker/openldap/README.md?rev=1762240&view=auto
==============================================================================
--- directory/buildtools/docker/openldap/README.md (added)
+++ directory/buildtools/docker/openldap/README.md Sun Sep 25 21:41:13 2016
@@ -0,0 +1,37 @@
+> Licensed to the Apache Software Foundation (ASF) under one
+> or more contributor license agreements.  See the NOTICE file
+> distributed with this work for additional information
+> regarding copyright ownership.  The ASF licenses this file
+> to you under the Apache License, Version 2.0 (the
+> "License"); you may not use this file except in compliance
+> with the License.  You may obtain a copy of the License at
+>
+>    http://www.apache.org/licenses/LICENSE-2.0
+>
+> Unless required by applicable law or agreed to in writing,
+> software distributed under the License is distributed on an
+> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+> KIND, either express or implied.  See the License for the
+> specific language governing permissions and limitations
+> under the License.
+
+
+# About
+
+A docker image to run OpenLDAP.
+
+
+## Build image
+
+    docker build -t apachedirectory/openldap .
+
+
+## Publish image
+
+    docker push apachedirectory/openldap
+
+
+## Usage
+
+    docker run -d -p 389:389 -p 636:636 apachedirectory/openldap
+

Added: directory/buildtools/docker/openldap/slapd-config.ldif
URL: http://svn.apache.org/viewvc/directory/buildtools/docker/openldap/slapd-config.ldif?rev=1762240&view=auto
==============================================================================
--- directory/buildtools/docker/openldap/slapd-config.ldif (added)
+++ directory/buildtools/docker/openldap/slapd-config.ldif Sun Sep 25 21:41:13 2016
@@ -0,0 +1,34 @@
+dn: cn=config
+objectClass: olcGlobal
+cn: config
+olcArgsFile: /var/lib/openldap/run/slapd.args
+olcPidFile: /var/lib/openldap/run/slapd.pid
+olcTLSCACertificateFile: /etc/ssl/certs/ldap.pem
+olcTLSCertificateFile: /etc/ssl/certs/ldap.pem
+olcTLSCertificateKeyFile: /etc/ssl/private/ldap.pem
+
+dn: cn=schema,cn=config
+objectClass: olcSchemaConfig
+cn: schema
+
+include: file:///etc/openldap/schema/core.ldif
+
+include: file:///etc/openldap/schema/cosine.ldif
+
+include: file:///etc/openldap/schema/inetorgperson.ldif
+
+dn: olcDatabase=frontend,cn=config
+objectClass: olcDatabaseConfig
+objectClass: olcFrontendConfig
+olcDatabase: frontend
+
+dn: olcDatabase=mdb,cn=config
+objectClass: olcDatabaseConfig
+objectClass: olcMdbConfig
+olcDatabase: mdb
+olcSuffix: dc=example,dc=com
+olcRootDN: cn=admin,dc=example,dc=com
+olcRootPW: secret
+olcDbDirectory: /var/lib/openldap/openldap-data
+olcDbIndex: objectClass eq
+

Added: directory/buildtools/docker/openldap/slapd-data.ldif
URL: http://svn.apache.org/viewvc/directory/buildtools/docker/openldap/slapd-data.ldif?rev=1762240&view=auto
==============================================================================
--- directory/buildtools/docker/openldap/slapd-data.ldif (added)
+++ directory/buildtools/docker/openldap/slapd-data.ldif Sun Sep 25 21:41:13 2016
@@ -0,0 +1,5 @@
+dn: dc=example,dc=com
+objectclass: domain
+objectclass: top
+dc: example
+