contrib/openldap: add a OpenLDAP container for testing
This commit is contained in:
7
contrib/openldap/scripts/download.sh
Executable file
7
contrib/openldap/scripts/download.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
# USAGE: scripts/download.sh
|
||||
|
||||
wget -O /tmp/openldap-2.4.44.tgz ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.44.tgz
|
||||
sha512sum -c scripts/openldap-2.4.44.tgz.sha512
|
||||
mv /tmp/openldap-2.4.44.tgz assets/openldap-2.4.44.tgz
|
||||
tar -zxvf assets/openldap-2.4.44.tgz -C assets
|
53
contrib/openldap/scripts/entrypoint.sh
Executable file
53
contrib/openldap/scripts/entrypoint.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Provide sane defaults for these values.
|
||||
DOMAIN=${LDAP_DOMAIN:-"dc=example,dc=com"}
|
||||
ROOT_CN=${LDAP_ROOT_CN:-"cn=Manager"}
|
||||
ROOT_PW=${LDAP_ROOT_PW:-"secret"}
|
||||
LOG_LEVEL=${LDAP_LOG_LEVEL:-"any"}
|
||||
|
||||
ROOT_DN="$ROOT_CN,$DOMAIN"
|
||||
|
||||
cat <<EOF > /usr/local/etc/openldap/slapd.ldif
|
||||
# Global config
|
||||
dn: cn=config
|
||||
objectClass: olcGlobal
|
||||
cn: config
|
||||
|
||||
# Schema definition
|
||||
dn: cn=schema,cn=config
|
||||
objectClass: olcSchemaConfig
|
||||
cn: schema
|
||||
|
||||
include: file:///usr/local/etc/openldap/schema/core.ldif
|
||||
|
||||
# Default frontend configuration.
|
||||
dn: olcDatabase=frontend,cn=config
|
||||
objectClass: olcDatabaseConfig
|
||||
objectClass: olcFrontendConfig
|
||||
olcDatabase: frontend
|
||||
|
||||
# Template in RootDN values and RootPW.
|
||||
dn: olcDatabase=mdb,cn=config
|
||||
objectClass: olcDatabaseConfig
|
||||
objectClass: olcMdbConfig
|
||||
olcDatabase: mdb
|
||||
OlcDbMaxSize: 1073741824
|
||||
olcSuffix: $DOMAIN
|
||||
olcRootDN: $ROOT_DN
|
||||
olcRootPW: $ROOT_PW
|
||||
olcDbDirectory: /usr/local/var/openldap-data
|
||||
olcDbIndex: objectClass eq
|
||||
EOF
|
||||
|
||||
mkdir -p /usr/local/etc/cn=config
|
||||
|
||||
/usr/local/sbin/slapadd \
|
||||
-n 0 \
|
||||
-F /usr/local/etc/cn=config \
|
||||
-l /usr/local/etc/openldap/slapd.ldif
|
||||
|
||||
# Begin slapd with `-d` so it attaches rather than running it as a daemon process.
|
||||
/usr/local/libexec/slapd \
|
||||
-d $LOG_LEVEL \
|
||||
-F /usr/local/etc/cn=config
|
2
contrib/openldap/scripts/openldap-2.4.44.tgz.sha512
Normal file
2
contrib/openldap/scripts/openldap-2.4.44.tgz.sha512
Normal file
@@ -0,0 +1,2 @@
|
||||
# Computed
|
||||
132eb81798f59a364c9246d08697e1c7ebb6c2c3b983f786b14ec0233df09696cbad33a1f35f3076348b5efb77665a076ab854a24122c31e8b58310b7c7fd136 /tmp/openldap-2.4.44.tgz
|
Reference in New Issue
Block a user