![]() |
LDAP Authentication
I've been using Vbulletin for a few years, and have had some great modifications from this community, so having had to recently integrate Vbulletin with LDAP for my University discussion boards I decided to release this as a modification. This is my present to the community :).
Description: LDAP authentication for Vbulletin. How it works: This does not modify Vbulletin files or Vbulletin login code in anyway. We simple stick some script infront of the login process so we can validate against LDAP. Below is a breakdown of what this thing does:
The requirements are based on the system we use. It may / may not work with other Vbulletin versions:
This LDAP integration script currently requires you to have an LDAP field with the users password stored as MD5. From my understanding, CRYPT is the default password storage for LDAP so some of you may not have an MD5 field in LDAP with the users password encrypted as MD5. It would be possible to modify the script to check against CRYPT, but it would also require a template edit as the login form converts the password field "onSubmit" to MD5. I did not do this because we already have the MD5 in LDAP as we use it on a number of different system already, and I did not want to change VB templates. Also, I was unable to find documentation on doing a script / releasing a modification, so in future if someone could explain to me or change the script slightly to allow editing of LDAP configuration file within ADMIN CP interface, that would be great. This would also mean not having to upload a file into the includes folder. I'm sure there will be something I havent thought of, or will make it easier if this script had this and that, so feel free to post your ideas, and suggestions on improving this modification. Important Info: Hack is provided free of charge (but if you really want to get rid of money PM me ;) ). I make no guarantee it will work on your system, but it does on mine with 15,000 users :). Version:
|
This has been requested for ages, you may find yourself crowned as a king for this. =p
|
Cheers!
/me clicks install |
maybe usefull to explain what LDAP means?
Maybe I will install it, when I know what it is :D |
Quote:
|
Nice work. Although I have no use for it. I've seen much call for it in the past.
|
Quote:
From Wikipedia, the free encyclopedia (Redirected from LDAP) Jump to: navigation, search The Lightweight Directory Access Protocol, or LDAP (IPA: [ˈɛl d?p]), is an application protocol for querying and modifying directory services running over TCP/IP. A directory is a set of information with similar attributes organized in a logical and hierarchical manner. The most common example is the telephone directory, which consists of a series of names (either of a person or organization) organized alphabetically, with an address and phone number attached. An LDAP directory often reflects various political, geographic, and/or organizational boundaries, depending on the model chosen. LDAP deployments today tend to use Domain Name System (DNS) names for structuring the topmost levels of the hierarchy. Deeper inside the directory might appear entries representing people, organizational units, printers, documents, groups of people or anything else which represents a given tree entry (or multiple entries). Its current version is LDAPv3. LDAPv3 is specified in a series of IETF Standard Track RFCs as detailed in RFC 4510. Quote:
|
Just for my own satisfaction
can you give an example or two as to what this would be used for please? |
Just for my own satisfaction
can you give an example or two as to what this would be used for please? |
As said above... It is one of those things that if you don't know what it does, you don't need it.
|
Quote:
|
Its one of them things, if you dont use it you dont need it as said above but....
Best example I can give is of my work..... we use LDAP to authenticate users accross different services we offer on campus - logging into computers, access programs, databases, and web sites. On the web for example our CMS, Blackboard, Campus Pipeline, Intranet and now VBulletin all authenticate against LDAP. This allows us to give out 1 username and password to every staff and student to access any service we offer; we can restrict access via LDAP as well. There's a bit more to it than that. You've got to have someone to populate LDAP, or some program to automatically insert / update records i.e. our finance department enter a new staff member onto the pay roll system, and in an overnight job LDAP is synchronised with it, creating new usernames if neccessary or expire accounts if someone has left. Its our "yellow pages" of staff and students. Benefit to us is 1 username and password to access all our services. Less maintenance. Also in time it will allow us to roll out "single sign on". Sign into a computer on the network, and then you are automatically logged into our web sites or Vbulletin when you go to that site. No need for cookies. You may have heard of Active Directory which is similar. Does that make sense? :s :) |
Actually that makes PERFECT sense as to the definition of the acronym. thank you very much for answering. Now you will get ALLOT less questions
|
I notice that you are using mysql_num_rows() - you should update that to the equivelent vb database class call. :)
|
True!! Fixed , thanks for pointing that out :D
(attachment updated) |
Wow this is great news man. I was thinking of using vb at my work for our IT department for internal knowledgebase but refrained due to the whole seperate login issues but now that LDAP is supported this is very cool.
Thanks |
thanks m8 will have a look at this :)
|
Let me know how you get on. ..... :)
I've updated the attachment so the download is now a product, not just a plugin. Did this so people can do version checking. Not edited any code. |
Is there any possibility of attaching some screenshots?
Thanks |
Quote:
|
Hi, Zemic:
Brilliant bit, thanks (for those of us desperately trying to integrate VB with a CMS)...may I ask what Directory Server you are using? Red Hat, or Sun, or...? I note you mentioned Active Directory as something you are clearly NOT using. Did you write your own directory server? Second, do I take it from your explanation that your hack authenticates but does not populate the directory? Thanks, Iceboxer |
Quote:
You could integrate the code with pretty much anything i.e. a CMS. Just change the bit of code that speaks to VB to talk to your CMS. Making a connection to LDAP, authenticating etc. is standard PHP/LDAP code, nothing fancy. Read through the plugin code. I've commented on every bit of the login process. We are on SUN systems, with the look of bringing in Active Directory during this year (not my idea! those upstairs ;) ). I didnt write the directory server and im not responsible for any part of the LDAP system. Leave the headache of that to the system admins :), but I know we have extra fields over a standard "installation" of LDAP i.e. MD5. As mentioned earlier.......Ideally this script would authenticate against CRYPT, but without changing Vb code it wont. *I THINK* most establishments that use ldap will have the password stored in MD5 as well as crypt anyway, so this is probably not as big of an issue as I think it is, but I point it out incase someone scratches their heads for hours trying to figure out why this script might not work with their system. I can post some extra CRYPT instructions if neccessary. My hack does not change anything in LDAP. I assume that LDAP is always correct. We have other tools to change password in LDAP so this was not needed. If you want to though, you could add a bit of code so that when the user changes his/her password in Vbulletin it would update LDAP, but here, I've removed the link to "Change Password" from USER CP in Vbulletin just incase the users get confused; we have another website/tool for users to manage their computer account. |
Zemic:
Thanks again. I'm struggling to "get" the LDAP concept - not so much in straight-up validation, LDIF, etc., but in populating the Directory db in an automatic fashion and in figuring out how to make this work regardless of which (VB, my CMS, etc.) program is used for user registration - which from your earlier posts, isn't a problem with which you've had to concern yourself. :-) I'm slogging through some tutorials on LDAP now, and hopefully I can figure this out. :erm: However, that being said, it's a GREAT help to those of us out here trying to create fully integrated sites to have this Add-on from you, and I just wanted to express my gratitude...it's made my day to see this here. Thx, Iceboxer |
No problem, if its useful for someone other than me then thats made my day :D. I've not populated LDAP myself before so dont think I could be of any help. We have other (mainly payroll) type software / system to do that automatically, as well as perl scripts which can be run on a server - code written "in-house" by other people so cannot share im afraid.
Let me know how you get on. :up: |
i am sorry to say, but as long as i have to use md5 in ldap so the hashes match, this thing is not really useful. most of the time, people want to use an existing ldap directory, where 99% of the time another password mechanism is used (crypt, sha1). i stick with the plugin from www.sartori.at
|
Like I said in a previous post, this could be modified to work with CRYPT. All that is required is changing the VBulletin login form (template) so it doesnt MD5 the password as soon as you hit enter ( I would need to look into possibility of this breaking something else) or leave the MD5 thing, and pass plain text password, or crypt the password on submit. A simple template edit would do this.
Give me a couple of days to fit this in around work and I'll do it. Cant see what that script at the above URL does any different to mine. If you've got the code to share, or could give me a hint, I'm sure I could add something into mine to do the same. Could save people 100euro's :) |
yes i do have the code, because i bought this plugin. but to be honest, i will not share the code. it would not be fair towards the developer. selling php code is always pain in the ass and a developer who sells his piece of code trusts his customers.
|
Fair enough :).
If anyone has feature requests, just reply to the topic or PM me. |
Zemic,
You have no idea what this means for me at this moment.. If I can get this to function I'll be a happy, happy man. I'm getting this... when I attempt to login with a known user in our LDAP system. Code:
Fatal error: Call to undefined function: ldap_connect() in D:\Intranet\links\forum\global.php(356) : eval()'d code on line 25 |
Hello !
To me, that looks like your running PHP in a Windows environment, and it doesnt support LDAP. I've just downloaded my code again from here just incase I'd done a little mistake in the code after a recent update, but deffo havent. To remove the Product / Plugin you'll need to edit your config.php file to disable plugins. I'll have a search on the forums for the variable to put into your config.php now, because I cant remember off the top of my head.... |
Here it is. Stick this in your config.php
Quote:
http://www.vbulletin.com/docs/html/disable_plugins p.s. I'm still working on the a slight tweak for this modification to work with CRYPT as I said I would do a couple of weeks ago. I should get time to complete it this week.:) |
Fantastic... thank you sir. I'm back in.
|
malcolmx gives out his ldap authentication now for free. it has this feature.
|
Quote:
|
<a href="https://vborg.vbsupport.ru/showthread.php?p=1258715" target="_blank">https://vborg.vbsupport.ru/showthread.php?p=1258715</a>
|
I'm modifying this code to authenticate against something different, but I was looking through the code for this plugin and found a possible error.
In the section where it tries to update the VB database's user password, it seems to MD5 a password that's already MD5'd: Code:
It may be my lack of understanding as to how VB holds passwords, but wouldn't you MD5 the plain text password, not something that's already been hashed? If so, would $vbulletin->GPC['vb_login_password'] still be available to do this? And if $vbulletin->GPC['vb_login_password'] is still available, you could use it to replace $_POST[vb_login_md5password] Thx. Chris. |
Hello,
Its been a few months since I've been on here. In June I moved jobs and have gone from an institution using UNIX UNIX UNIX, to MICROSOFT MICROSOFT MICROSOFT so no LDAP server for me to play around with, and therefore havent been able to develop this any more since release. Good news MalcolmX decided to release his version for free after I spent hours figuring this thing out!! I've not tried his version but its good to give people choice :). Anyway.... ckm, yes it is correct. Vbulletin re-hashes the MD5 with a "salt" key. Its like an extra layer of protection. Salt is just a random 3 digit character made up when a new user is created. Its then used to encrypt the password. Does that make sense? I'll try and get LDAP up and running somewhere so I can develop this a bit further. It works as is but I could add a few extra neat touches. :) |
Our LDAP tree does not include an MD5 password hash field - or at least not one that is viewable with an anonymous bind. So I simply modified the IF that does the password hash comparison with an IF that does a bind with the user's name and password.
PHP Code:
|
Brill :up:
|
I had to make another brief modification.
Many of our users do not have a 'uid', but everyone has a 'cn'. So initially I changed the code just to look for "cn=" rather than "uid=". But I realize that may not be very flexible, so I eventually added a variable to ldapconfig.php called $ldapuid which can be set to "uid", "cn", or what-have-you. A quick change to one line in ldap_authentication.php uses the variable. PHP Code:
|
All times are GMT. The time now is 05:20 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|