From 8dc358ded5d610b9378675d62c13c162e64fdee3 Mon Sep 17 00:00:00 2001 From: Marisa Date: Thu, 18 Dec 2025 09:24:35 -0500 Subject: [PATCH] Added phplogin.php --- entrypoint.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index c27c3aa..e1d95fa 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -37,7 +37,8 @@ slapd -h "ldap:/// ldapi:///" -u openldap -g openldap & SLAPD_PID=$! sleep 8 -# Full tree with root entry +# Full tree with root and users entries +echo "--> Creating base.ldif with root and user entries" cat > /tmp/base.ldif < Creating phplogin.php with full users support" +cat > /var/www/html/phplogin.php <<'EOF' +Login successful! Welcome admin (full privileges)

"; + } + // Second: if not admin, try regular user + elseif (@ldap_bind($ldap, "uid={$username},ou=People,{$base_dn}", $password)) { + $msg = "

Login successful! Welcome {$username}

"; + } + else { + $msg = "

Invalid credentials

"; + } + } else { + $msg = "

StartTLS failed

"; + } + ldap_close($ldap); + } else { + $msg = "

Could not connect to LDAP server

"; + } + } else { + $msg = "

Please fill both fields

"; + } +} +?> + + + + ldapdock LDAP login + + + +

ldapdock login

+

Server base DN:

+ +
+ + + +
+
+
+ Test accounts:
+ Regular user: marisa / password: MarisaNewPass2025
+ Admin user: admin / password: admin +
+ + +EOF + ADMIN_DN="cn=admin,${LDAP_BASE_DN}" ADMIN_PW="admin" @@ -272,6 +360,7 @@ fi echo "--> ldapdock ready — OpenLDAP + Apache + PHP running" echo " → LDAP: 389/636" echo " → PHPinfo: https://localhost/info.php" +echo " → PHPlogin test: https://localhost/phplogin.php" echo " → Shell: /bin/bash" echo " → Exit with CTRL+D or 'exit' command"