Topic: Is there Active Directory Support?

Tracmor offers some great features and I will soon be downloading it to explore further.  One feature which is important to me is LDAP/AD integration so that I do not need to maintain separate accounts.  My question is this: how easy would it be to override the athentication mechanism to allow Tracmor to authenticate with Active Directory?  Has this been done before such that there is sample code I could just download? 

My initial thoughts were that I could hopefully provide my own implementation of the UserAccount class (and others?) which utilitize a package such as adLDAP (http://adldap.sourceforge.net/).  I haven't thought too hard about the specifics but I was hoping to get a read on how difficult it would be to work the AD integration feature into the code.  Any thoughts or suggestions?

Thanks,
Chris

Re: Is there Active Directory Support?

Chris,

We don't have any existing code for doing an LDAP/AD integration with Tracmor specifically,  but there is some code available for integrating adLDAP with Qcodo, the framework that Tracmor is built with.  Here are the relevant links:

http://qcodo.com/downloads/item.php/161
http://qcodo.com/downloads/item.php/162

I have not had the opportunity to try this myself,  but I would be very interested in your results if you do work on such an integration with Tracmor.  This is something that would be useful to have built into Tracmor,  and being an open source project we are always eager to consider code contributions from the community.

Let us know if you have any further questions and we'll do our best to help.

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Is there Active Directory Support?

Is this still the case?  I work at the State of Iowa and were looking for something open source and this is close but AD/LDAP support is a must.  We've a big PHP shop so I'm sure we can add AD/LDAP support if that's something that hasn't been done yet.  If that's the case, I just need to know if there is any objection to using some of ZF's AD/LDAP code (only the parts needed) to do this or if we have to use qcodo.  For ZF we have code already that will be easy to refactor.  qcodo is fine but will take longer.

--Tony

Re: Is there Active Directory Support?

Hi Tony,

Yes, Tracmor still lacks AD/LDAP support at this time, but we'd love to see support added for those who need it. We don't have any objection at all to making use of ZF code. From what I understand, Qcodo works quite well with ZF, and there is even a Qcodo package for it here: http://www.qcodo.com/qpm/package.php/zend_framework. However, to use that package would require a more current version of Qcodo than what Tracmor is currently based on. We are in the process of moving Tracmor to the current stable Qcodo, but this won't be done for a few more weeks. So if you wanted to get started right away you could just incorporate the ZF code as you see fit, and we could work with you to get your code merged into Tracmor officially once we finish the upgrade.

Please contact us directly at support@tracmor.com if we can provide any assistance with getting the AD/LDAP support added.

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Is there Active Directory Support?

Ok, I think we'll just stick with straight ZF and hopefully structure the code in a way to use the qcodo+ZF integration without a bunch of refactoring.

--Tony

Re: Is there Active Directory Support?

So real quick some assumptions on this implementation:

To minimize changes to existing code around users, roles, etc I'll assume that AD/LDAP user's have an account stubbed out in the database.  This means that the first time an AD/LDAP user logs in we'll authenticate them to AD and if it work we'll jam as much of the AD data as we can into the corresponding fields in the tracmor DB

So what about the basic design?  Right now you have a need for two authentication "providers"
1) Tracmoor DB
2) AD/LDAP

I'm looking at a common interface for both with the following methods:

public function authenticate();
- Exceptions: invalid username password, account locked, account disabled, password expired
- Returns valid UserAccount object if it works
- For AD/LDAP this will check to see if the username/password combo is valid in AD.  If not or account is locked or whatever an exception is thrown.  If it works a check in the DB will be made for a matching account and if not found a new one will be stubbed in, saved and returned.  If the user already had an account it will simply return the existing info.

public function changePassword();
- Exceptions: invalid username password, account disabled, bad password (e.g. too short, no lower and upper case, etc)
- Return boolean
- Self explanatory.

The two provider classes above would be instantiated by a factory pattern unless you have a preference for some other method.

Let the WTF's fly...if I could get feedback ironed out by EOD tomorrow I can get started on it next week.  Other questions:
1) Where would the interface and classes described above go in the tracmoor folder structure.
2) Where would the exceptions above go? Is there some parent qcodo or tracmor exception I should inherit from or go right after the base PHP Exception?
3) Do you want AD settings in it's own config file?

Re: Is there Active Directory Support?

I am not the best person to answer all your questions, but will provide as much info as I can. I will request one of our other engineers address any other questions.

Initial user authentication happens in login.php (btnLogin_Click) which if successful calls the static QApplication::Login method (QApplication class is currently defined in includes/prepend.inc.php, but will be moved to a new includes/QApplication.class.php file after upgrading to latest Qcodo).

There is no qcodo or tracmor exception you need to inherit from.

I suggest putting the AD settings in the includes/configuration_tracmor.inc.php file.

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Is there Active Directory Support?

jsinclair wrote:

Initial user authentication happens in login.php (btnLogin_Click) which if successful calls the static QApplication::Login method (QApplication class is currently defined in includes/prepend.inc.php, but will be moved to a new includes/QApplication.class.php file after upgrading to latest Qcodo).

Yeah, I saw that...pretty straight forward.  Just have someone get back to me on the location of files and the general idea of the factory, interface and two methods proposed and I'll go from there.

Thanks,

--Tony

Re: Is there Active Directory Support?

Tony

My name is Hunter and I'm the lead dev for Tracmor.

To answer your questions a few posts up:
#1 - the /root/includes folder would be the best place for this class
#2 - You can inherit from /includes/qcodo/_core/framework/QExceptions.class.php
#3 - I agree that you should include the AD configuration options in the tracmor config file - includes/configuration_tracmor.inc.php

Does that answer all of your questions?

-- Hunter

Re: Is there Active Directory Support?

I've about got a first iteration of this thing done.  A couple of things:
1) I see a role_id and an admin flag on the user_account table.  Can you explain the need for both?
2) Caveat, this is only confirmed with AD.  We'd need a ton more testing on different AD setups and some LDAP setups.
3) How do you want the code?  A simple patch file?
4) I have no unit tests.  I asked about that in a previous post but never got an answer so I'm not sure if you have them and, if so, where they go.

--Tony

Re: Is there Active Directory Support?

Tony, that's great news. To answer your questions:

1) The admin flag simply grants a user access to the Admin module in Tracmor. User roles control access to the other modules, including view/edit/delete privileges (which don't apply to the Admin module).
2) We can set up a test AD environment for our own testing as well.
3) For now patches work best (my email is my username at tracmor dot com). In the near future we will be switching from subversion to git (github), and contributions like this will be easier to pull into tracmor.
4) We don't have unit tests right now. The Qcodo framework now includes PHPUnit, so once we upgrade Tracmor to a current version of Qcodo, we will have that available and a place for the tests to go.

We look forward to trying out the AD support!

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Is there Active Directory Support?

Where should I send the patch file?  Just a heads-up I didn't implement change password because, best as I can tell, tracmor doesn't support self-service password changes.  Authentication works fine, though.  I have no problem adding changePassword() implementation once self-service password changes are available.

Re: Is there Active Directory Support?

Patch is here:

http://www.tonybibbs.com/tracmor_ldap.patch

--Tony

Re: Is there Active Directory Support?

Tony, thanks for the patch! We are finishing up the upgrade to the latest stable Qcodo. Once that's done we'll work on merging your changes in.

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Is there Active Directory Support?

Hi, did this ever get merged into the download? I'm currently running the 0.3.0 (current) version from the sourceforge page and would possibly be interested in creating another authentication method for tracmor, but I don't want to step on Tony's toes!

Re: Is there Active Directory Support?

This has not been merged in yet. We did complete the upgrade to a more current Qcodo, so we should be able to start working on this soon.

Out of curiosity, what new authentication method are you interested in adding?

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Is there Active Directory Support?

Actually it's an internal one, based on a seperate (CakePHP-powered) system, so it may be useful to anyone who's using the standard CakePHP authentication module on a company intranet (like us) to have single sign-on.

Did the work done for the AD integration above actually include creating common interface classes (thus making adding new authentication providers much easier)?

I suppose that I would be interested in looking at OpenID too, or perhaps OAuth, but these would take a lot of time as they'd be personal projects.

Re: Is there Active Directory Support?

Any update on LDAP support. This would be huge to me.

Re: Is there Active Directory Support?

Right now your best bet is to use Tony's patch he linked to above to add LDAP to your Tracmor installations. We have several other high priority features we're working on, so have not yet been able to dedicate any resources to merging this in.

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Is there Active Directory Support?

Hi, Would someone be able to advise me on how to intergrate this patch?

Thanks - Tom

Re: Is there Active Directory Support?

Tony, would it be possible to get a copy of your application? Im having the hardest time getting these patching in the right place.

Re: Is there Active Directory Support?

Did AD integration ever make it in? I just downloaded and setup Tracmor today, and it looks like it might be perfect for our needs, but AD integration would be super helpful.

If it hasn't been added in, I'm willing to use the patch linked to above, but I need a little help on how to apply that patch. I'm still pretty new to Linux and PHP, so I'm not entirely sure how to get that working. Any help would be appreciated. Thanks!