Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/Dockerfile.php.template
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
2 changes: 1 addition & 1 deletion docker/Dockerfile.php71
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
2 changes: 1 addition & 1 deletion docker/Dockerfile.php72
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
2 changes: 1 addition & 1 deletion docker/Dockerfile.php73
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
2 changes: 1 addition & 1 deletion docker/Dockerfile.php74
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
2 changes: 1 addition & 1 deletion docker/Dockerfile.php80
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
2 changes: 1 addition & 1 deletion docker/Dockerfile.php81
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
29 changes: 1 addition & 28 deletions docker/bin/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,34 +226,7 @@ configure_ldap() {
return 0
fi

timeout 5 bash -c 'until echo > /dev/tcp/ldap/389; do sleep 0.5; done' 2>/dev/null
if [ $? -eq 0 ]; then
output "LDAP server available"
export LDAP_USER_FILTER="(|(objectclass=inetOrgPerson))"

OCC app:enable user_ldap
OCC ldap:create-empty-config
OCC ldap:set-config s01 ldapAgentName "cn=admin,dc=planetexpress,dc=com"
OCC ldap:set-config s01 ldapAgentPassword "admin"
OCC ldap:set-config s01 ldapAttributesForUserSearch "sn;givenname"
OCC ldap:set-config s01 ldapBase "dc=planetexpress,dc=com"
OCC ldap:set-config s01 ldapEmailAttribute "mail"
OCC ldap:set-config s01 ldapExpertUsernameAttr "uid"
OCC ldap:set-config s01 ldapGroupDisplayName "description"
OCC ldap:set-config s01 ldapGroupFilter '(|(objectclass=groupOfNames))'
OCC ldap:set-config s01 ldapGroupFilterObjectclass 'groupOfNames'
OCC ldap:set-config s01 ldapGroupMemberAssocAttr 'member'
OCC ldap:set-config s01 ldapHost 'ldap'
OCC ldap:set-config s01 ldapLoginFilter "(&$LDAP_USER_FILTER(uid=%uid))"
OCC ldap:set-config s01 ldapLoginFilterMode '1'
OCC ldap:set-config s01 ldapLoginFilterUsername '1'
OCC ldap:set-config s01 ldapPort '389'
OCC ldap:set-config s01 ldapTLS '0'
OCC ldap:set-config s01 ldapUserDisplayName 'cn'
OCC ldap:set-config s01 ldapUserFilter "$LDAP_USER_FILTER"
OCC ldap:set-config s01 ldapUserFilterMode "1"
OCC ldap:set-config s01 ldapConfigurationActive "1"
fi
configure-ldap.sh
}

configure_oidc() {
Expand Down
43 changes: 43 additions & 0 deletions docker/bin/configure-ldap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# Configure the user_ldap app against the bundled `ldap` service.
#
# Reused in two places:
# - docker/bin/bootstrap.sh, during the install/bootstrap phase
# - on demand against a running container:
# docker compose exec <container> configure-ldap.sh
#
# Relies on the in-container `occ` wrapper (/usr/local/bin/occ) and the
# WEBROOT env var, both provided by the image.

# Wait for the ldap server to accept connections before configuring.
timeout 5 bash -c 'until echo > /dev/tcp/ldap/389; do sleep 0.5; done' 2>/dev/null
if [ $? -ne 0 ]; then
echo "LDAP server (ldap:389) not available; skipping LDAP configuration"
exit 0
fi

echo "LDAP server available"
LDAP_USER_FILTER="(|(objectclass=inetOrgPerson))"

occ app:enable user_ldap
occ ldap:create-empty-config
occ ldap:set-config s01 ldapAgentName "cn=admin,dc=planetexpress,dc=com"
occ ldap:set-config s01 ldapAgentPassword "admin"
occ ldap:set-config s01 ldapAttributesForUserSearch "sn;givenname"
occ ldap:set-config s01 ldapBase "dc=planetexpress,dc=com"
occ ldap:set-config s01 ldapEmailAttribute "mail"
occ ldap:set-config s01 ldapExpertUsernameAttr "uid"
occ ldap:set-config s01 ldapGroupDisplayName "description"
occ ldap:set-config s01 ldapGroupFilter '(|(objectclass=groupOfNames))'
occ ldap:set-config s01 ldapGroupFilterObjectclass 'groupOfNames'
occ ldap:set-config s01 ldapGroupMemberAssocAttr 'member'
occ ldap:set-config s01 ldapHost 'ldap'
occ ldap:set-config s01 ldapLoginFilter "(&$LDAP_USER_FILTER(uid=%uid))"
occ ldap:set-config s01 ldapLoginFilterMode '1'
occ ldap:set-config s01 ldapLoginFilterUsername '1'
occ ldap:set-config s01 ldapPort '389'
occ ldap:set-config s01 ldapTLS '0'
occ ldap:set-config s01 ldapUserDisplayName 'cn'
occ ldap:set-config s01 ldapUserFilter "$LDAP_USER_FILTER"
occ ldap:set-config s01 ldapUserFilterMode "1"
occ ldap:set-config s01 ldapConfigurationActive "1"
2 changes: 1 addition & 1 deletion docker/php82/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
2 changes: 1 addition & 1 deletion docker/php83/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
2 changes: 1 addition & 1 deletion docker/php84/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
2 changes: 1 addition & 1 deletion docker/php85/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ CMD ["apache2-foreground"]

ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
ADD bin/bootstrap.sh bin/occ bin/configure-ldap.sh /usr/local/bin/
20 changes: 20 additions & 0 deletions scripts/enable-ldap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -e
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
# shellcheck source=example.env
source "${SCRIPT_DIR}/../.env"
# shellcheck source=scripts/functions.sh
source "${SCRIPT_DIR}/functions.sh"

if [ -z "$1" ]
then
echo "Usage $0 CONTAINER"
exit 1
fi

CONTAINER=$1

echo "Configuring LDAP on $CONTAINER"
docker_compose up -d ldap ldapadmin
docker_compose exec "$CONTAINER" configure-ldap.sh
Loading