MyBB Community Forums

Full Version: Updated LDAP module for OpenLDAP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I had to integrate MyBB into an OpenLDAP server, but there was no real working module to do this. The closest I could find was Rukbat's mybbldap mod at http://mods.mybb.com/view/mybbldap. I made extensive modifications to this code and am uploading it here for others to play with, and/or modify.

Changes from the original include:
1) It now interfaces with OpenLDAP, in addition to Active Directory
2) It now can send authentication over TLS, instead of just in the clear.
3) It will now provision a user account, if it doesn't exist locally. The mod will query the OpenLDAP for the user's email and use it when provisioning the local account.
4) For those who want OpenLDAP only registration/authentication, there are some additional notes in the readme file, that will will make it register and authenticate only with OpenLDAP, except for previously existing local accounts, like the admin user. WARNING! This requires some minor hacks to a couple of core files, unless you can figure out a rewrite rule, instead. If you do, please update the documentation!

I mainly do Drupal development, so forgive me if I'm not coding things correctly. I have used Rukbat's original code as a guide to do my programming. Also, this is my first go at using PHP to interface with LDAP.

I have tested this code against an OpenLDAP server in the clear and also using TLS. I have tested account provisioning and and validated the password and salt to ensure they match MyBB's algorithm. I also validated that it will pull the first available email from the user's OpenLDAP account. Everything appears to work well. Give it a try and see if it works for you.
Will try this one ASAP. Thanks a lot!
Those of you who downloaded and are testing this module, can you provide some feedback as to how it is working for you? I have it working for me, but I'd like to know how well it works for others. Thanks!
(2013-09-30, 03:08 PM)jkurrle Wrote: [ -> ]Those of you who downloaded and are testing this module, can you provide some feedback as to how it is working for you? I have it working for me, but I'd like to know how well it works for others. Thanks!

Just wanted to let you know I had to change line 593 to make this plugin work with my company's Active Directory server. Instead of binding to the server via "UID=xxx" I changed it to "CN=xxx". The plugin worked fine after that. Thanks much for your work on this.
Thank you. I have just installed it to intergrate myBB with Active Directory on Windows Server 2008 R2.

I will give some feedback soon.
------------------------------------------
Update:
I got blank page affter install it. I don't know why except edited line number 593 from UID to CN as suggesstion of Jhh09. Now i'm trying to make it work.
Hello,

I try to get it to run in a 2008 R2 Domain.

When I try to Login, I get these errors:

Warning [2] ldap_bind(): Unable to bind to server: Invalid credentials - Line: 595 - File: inc/plugins/mybbldap.php PHP 5.4.7 (Linux)


File Line Function
[PHP] errorHandler->error
/inc/plugins/mybbldap.php 595 ldap_bind
/inc/plugins/mybbldap.php 456 check_ldap
/inc/class_plugins.php 101 mybbldap_check
/member.php 1132 pluginSystem->run_hooks


I really have no idea, what to do. Perhaps my settings are wrong, but is it possible that the reason for the errors is that the Linux Server hosting the MyBB-Forum is not member of the Active Directory?

I hope my english is understandable. Wink

Greetings
Does anyone know if this is going to be updated to version to work with MyBB 1.8.

Thanks
I know this mod hasn't been updated in a while, but leaving this out here in case someone else faces this too.

Thank you for the updated plugin, I have used it, successfully I might add, to connect to our corporate AD domain. Had to make a few changes (all minor, e.g. using samAccountName instead of uid, allowing for @domain.tld based logins) to make it work.

Found 1 bug when using this plugin with MyBB 1.8.x
  • Users created by this plugin had the "regdate" set to 0 in the MyBB database.
This resulted in 2 more issues:
  • Every user's registration date was shown as "Less than 1 minute ago"
  • The newest member was never being updated.
I added the following in the user array and all is working well.

"regdate" => TIME_NOW,

Thank you again for the good work!

(2015-01-22, 05:24 PM)jwaugh77 Wrote: [ -> ]Does anyone know if this is going to be updated to version to work with MyBB 1.8.

Thanks

I updated the following line:

   "compatibility" => "16*"

to

   "compatibility" => "18*"

and with minor edits (mostly because of our AD setup here), it works flawlessly with 1.8. YMMV
Important Notice

For those who stumble upon this thread in search of an LDAP module, I have rounded up all code and created an official plugin from it.

MyBB LDAP Authentication: https://community.mybb.com/mods.php?acti...w&pid=1043
(2017-09-21, 09:18 PM)mvreijn Wrote: [ -> ]Important Notice

For those who stumble upon this thread in search of an LDAP module, I have rounded up all code and created an official plugin from it.

MyBB LDAP Authentication: https://community.mybb.com/mods.php?acti...w&pid=1043


Hello,

I wanty to use it, but when I paste the file in inc/plugins/, I got an error


SQL Error: 0 - ERREUR: la colonne « mybbldap_ldapserver » n'existe pas LINE 1: SELECT * FROM mybb_settings WHERE name="mybbldap_ldapserver" ^
Query: SELECT * FROM mybb_settings WHERE name="mybbldap_ldapserver"


Do you know why ?
Pages: 1 2