Closed (outdated)
Project:
Lightweight Directory Access Protocol
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
15 Dec 2011 at 05:15 UTC
Updated:
11 Mar 2016 at 03:24 UTC
Jump to comment: Most recent
Comments
Comment #1
johnbarclay commentedHere are the moodle docs on this: http://docs.moodle.org/22/en/NTLM_authentication It should be the same. I added some notes at: #1371478: LDAP SSO which are basically the readme. Please add to them as you set this up.
I found the following interesting also, but not as direct:
http://moodle.org/mod/forum/discuss.php?d=145171
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/I...
Comment #2
scoff commentedI guess the Moodle stuff isn't very helpful.
They have a separate php file for that and we only have an URL.
This article looks closer to the subject but I'm not that much of a windows guy.
http://support.microsoft.com/kb/326020/en-us?fr=1
Thanks anyway!
Comment #3
johnbarclay commentedso in drupal, the equivalent to to the auth/ldap/ntlmsso_magic.php file would be the path [drupal root]/user/login/sso. Since there is no actual directory, you have to figure out a way to apply sso to only that path. Seems like you could create a virtual directory, but its fuzzy to me.
In IIS 7, you just add something like the following to applicationHost.config, but in IIS6, the metabase isn't stored in a text file.
to the auth/ldap/ntlmsso_magic.php file
user/login/sso
Comment #4
scoff commentedin my case the path is [drupal_root]/?q=user/login/sso or [drupal_root]/index.php?q=user/login/sso
I know that iis7 allows for the url rewrites and more easy to configure in general, but I have to deal with iis6.
Comment #5
scoff commentedWell, this code doesn't work in IIS 7 with URL Rewrite. is only good for a real file or folder and doesn't respect the rewrite rules or query string.
I wonder is there a way to make a separate php file to simulate index.php with q=user/login/sso? Sounds easy, I guess I should try.
Comment #6
scoff commentedOk here's to get it (somewhat) working. IIS7, PHP as FastCGI, Drupal 7.10, latest LDAP dev with some hacks.
First of all, looks like you don't have to authenticate user on /user/login/sso itself, any page will do. Just ask for authentication on any page and then redirect to sso. Web server keeps setting $_SERVER['REMOTE_USER'] on every consequent request.
1. Make a copy of index.php and add these 2 lines after bootstrap.
I was trying to rely on automated sso setting by removing the cookies, but current function ldap_sso_boot() does not work at all.
2. Modify ldap_sso.module. Looks like IIS sets the variable in form 'DOMAIN\user', not 'user@domain'.
3. Secure you copy of index.php by removing Anonymous auth from it in web.config
4. Point your browser to your index copy. If you're not logged in to Drupal, it should authenticate you (windows auth) and redirect to user/login/sso, which will do the rest.
It's obviously not the best way but it's working. I couldn't test it without entering windows login/password so far, but I hope it doesnt matter how the needed variable was set.
I'm not familiar with patching etc, but someone could add another ldapImplementation for IIS. The only difference so far is how ssoRemoteUserStripDomainName should work. It would be best to check $remote_user for '@' or '\' and explode it accordingly.
Thanks for the module!
Comment #7
johnbarclay commentedgreat. thanks for figuring this out and writing it up. 1. and 2. can be worked into the module.
It looks like 1. would not let anyone see anonymous pages so would only be appropriate for an intranet. Is that correct?
I think part 1. can be accomplished either with hook_boot in ldap_sso or with a new file in the module called ldap_sso/sso_magic.php.
Comment #8
scoff commentedno, 1. is for anon users who want to login (to post or comment), it's the only file/url which requires authentication (windows auth on, anon auth off), main index.php and all the other files are available for everybody as configured in drupal permissions (anon auth on).
It would be great to make 1. in hook_boot alone (or even wouldn't be important in case of non-automatic authentication), but I still don't know how to configure IIS to authenticate on url access instead of file access. We still need IIS to ask user for windows authentication and set the variable. Here's the code (IIS specific, I believe), but I haven't tested it.
Comment #9
johnbarclay commentedTo have a directory behind windows authentication, create a virtual directory inside of drupal with pointing to an empty directory above drupal root. In applicationHost.config you will end up with:
Comment #10
scoff commentedHow is this different to just create a folder named 'sso' (which is created in you example) and protect it exactly the same way? What it has to do with Drupal? I really don't understand.
Comment #11
scoff commentedI can confirm that code at #8 works as it should, so there's no need to configure IIS to ask for user credentials.
Pasting this code into ldap_sso.module → ldap_sso_user_login_sso() after if ($enabled == TRUE) will log you in to Drupal or ask for windows password if you navigate to /user/login/sso.
Again, it's tested on IIS7 (both anon and win authentication turned on), PHP 5.2 as FastCGI, I dont have a chance to check if it works on IIS6/php-isapi/etc.
I think custom module with another hook_menu (user/login/iisauth for example) with this code and redirect to user/login/sso will do the trick. Not sure if it's worth to be in ldap_sso, not untill there's a separate "implementation" for IIS.
Comment #12
jrsinclair commentedCould item 2 of #6 be incorporated into the module? I have successfully used it to configure ldap_sso with IIS. I'm happy to roll a patch if that helps. Otherwise I will have to keep re-patching every time a module update comes out.
Comment #13
johnbarclay commentedThis is in 7.x-1.x-dev already, see #1491244: Authentication/SSO: Strip domain name for IIS. This is a documentation thread, so in lieue of a patch, a read through and update to http://drupal.org/node/1371478 would be appreciated.
Comment #14
larowlanno update for > 12 months - closing