From 30504afd6c37142df52391252e239b0e64a42b6e Mon Sep 17 00:00:00 2001 From: okasion Date: Mon, 8 Dec 2025 10:09:49 -0300 Subject: [PATCH] Added phpLDAPadmin autoinstallation --- entrypoint.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index f9b6a64..3ed9b39 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -202,6 +202,7 @@ update-ca-certificates --fresh >/dev/null 2>&1 || true echo "--> Starting Apache + PHP (background)" /usr/sbin/apache2ctl -D FOREGROUND & APACHE_PID=$! +sleep 5 # HTTPS setup — using the real LDAP certificates echo "--> Configuring Apache for HTTPS with real certificates" @@ -222,6 +223,50 @@ sed -i -E "s|^\s*SSLCertificateKeyFile\s+.*|SSLCertificateKeyFile ${APACHE_KEY_F # Reload Apache gracefully (updates config without killing) apache2ctl graceful >/dev/null 2>&1 +sleep 5 + +# ────────────────────────────── +# phpLDAPadmin — auto-installed, no rebuild, works forever +# ────────────────────────────── +echo "--> Installing phpLDAPadmin" + +# Only install once — use a flag file +if [ ! -f "/var/www/html/phpldapadmin-installed" ]; then + cd /var/www/html + + # Download and extract (direct tarball, no git needed) + wget -q -O phpldapadmin.tgz \ + https://github.com/leenooks/phpLDAPadmin/archive/refs/tags/1.2.6.7.tar.gz + tar xzf phpldapadmin.tgz + mv phpLDAPadmin-1.2.6.7 phpldapadmin + rm phpldapadmin.tgz + + # Copy config and apply minimal working settings + cp phpldapadmin/config/config.php.example phpldapadmin/config/config.php + +cat > phpldapadmin/config/config.php <newServer('ldap_pla'); +\$servers->setValue('server','name','Local OpenLDAP'); +\$servers->setValue('server','host','127.0.0.1'); +\$servers->setValue('server','port',389); +\$servers->setValue('server','base',array('${LDAP_BASE_DN}')); +\$servers->setValue('server','tls',true); +\$servers->setValue('login','auth_type','session'); +\$servers->setValue('login','bind_id','cn=admin,${LDAP_BASE_DN}'); +\$servers->setValue('login','bind_pass','admin'); +?> +EOF + + # Mark as installed + touch /var/www/html/phpldapadmin-installed + + echo "--> phpLDAPadmin installed → https://localhost/phpldapadmin" +else + echo "--> phpLDAPadmin already installed" +fi # Victory message echo "--> ldapdock ready — OpenLDAP + Apache + PHP running"