Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP bug in auth.inc.php #204

Closed
simplexify opened this issue Sep 16, 2014 · 4 comments
Closed

LDAP bug in auth.inc.php #204

simplexify opened this issue Sep 16, 2014 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@simplexify
Copy link

Hi

Ran into an LDAP authentication bug in auth.inc.php when trying to set up LDAP authentication for poweradmin.

Turned out that the LDAP version was being set after the ldap_bind command, which rendered it useless.

Patch below:

--- /usr/src/poweradmin-2.1.7/inc/auth.inc.php 2014-07-05 06:59:19.000000000 +0200
+++ /usr/share/poweradmin/inc/auth.inc.php 2014-09-16 21:49:16.000000000 +0200
@@ -101,8 +101,8 @@
return;
}

  •    $ldapbind = ldap_bind($ldapconn, $ldap_binddn, $ldap_bindpw);
     ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, $ldap_proto);
    
  •    $ldapbind = ldap_bind($ldapconn, $ldap_binddn, $ldap_bindpw);
     if (!$ldapbind) {
         if (isset($_POST["authenticate"])) 
             log_error(sprintf('Failed LDAP authentication attempt from [%s] Reason: ldap_bind failed', $_SERVER['REMOTE_ADDR']));
    
@ichdasich
Copy link

Still present in 2.1.8.
Lines 105/106 just have to be swapped around.

@edmondas edmondas added the bug Something isn't working label Oct 26, 2014
@edmondas edmondas added this to the v2.1.8 milestone Oct 26, 2014
@edmondas edmondas self-assigned this Oct 26, 2014
edmondas pushed a commit that referenced this issue Oct 26, 2014
@edmondas
Copy link
Contributor

Fixed in 92441e8 commit.

@mydevice
Copy link

mydevice commented May 22, 2019

Hello,

I use poweradmin v2.1.8
When i try to login to poweradmin have this errors:

  1. Failed LDAP authentication attempt from [0.0.0.0 Reason: ldap_bind failed

  2. 2019/05/22 08:28:00 [error] 9902#0: *147757 FastCGI sent in stderr: "PHP message: PHP Warning: ldap_get_entries(): 23 is not a valid ldap result resource in /var/www/html/poweradmin/inc/plugins/auth_local/auth_local.plugin.php on line 132" while reading response header from upstream, client: 0.0.0.0, server: localhost, request: "POST /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.socket:", host: "localhost", referrer: localhost

  3. 2019/05/22 11:46:48 [error] 9898#0: *163687 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: fullname in /var/www/html/poweradmin/inc/plugins/auth_local/auth_local.plugin.php on line 177" while reading response header from upstream, client: 0.0.00, server: localhost, request: "POST /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.socket:", host: "localhost", referrer: "localhost"

  4. 2019/05/22 08:15:57 [error] 9902#0: *147597 FastCGI sent in stderr: "PHP message: PHP Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server in /var/www/html/poweradmin/inc/plugins/auth_local/auth_local.plugin.php on line 113" while reading response header from upstream, client: 0.0.00, server: localhost, request: "POST /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.socket:", host: "localhost", referrer: "localhost"

@edmondas
Copy link
Contributor

@mydevice It appears that you are using the wrong user to connect to LDAP. Visit this page for more information https://github.com/poweradmin/poweradmin/wiki/LDAP-support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants