Login to any Drupal site using credentials stored in Active Directory, OpenLDAP and other LDAP servers when the AD or LDAP does not have a public IP address. In other words, this module is best utilized if the LDAP Server is not directly accessible from your Drupal site. There are two parts to this module - One part sits on the Drupal site and the other sits on your DMZ.

Benefits

  • The LDAP is privately accessible, hence it remains under your control and is more secure.
  • No need to have the PHP LDAP extension enabled, hence better usability
  • Simple configuration
  • Multiple LDAP Configurations can be stored for multiple customers of a Drupal-based Cloud Service Provider and mapping to the users can be done on the basis of the domain name.

How this works:

How it works

1) User tries to login into the Drupal site. The request is handled by the module and forwarded to miniOrange.
2) miniOrange forwards the request to the Gateway, which resides on the DMZ. It has access to your LDAP since it resides in the same intranet.
3) The Gateway authenticates against the LDAP.
5) Success/Failure response is forwarded to miniOrange.
5) miniOrange forwards the appropriate response to the Drupal site. In case of a successful response, the user is logged in. If the user does not exist, the user gets created in Drupal.

Project Link: https://www.drupal.org/sandbox/gauravsood91/2556275
Git Clone:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/gauravsood91/2556275.git miniorange_ldap_ad_login

Manual Reviews of other projects:

https://www.drupal.org/node/2629594#comment-10669738
https://www.drupal.org/node/2578447#comment-10669728
https://www.drupal.org/node/2570465#comment-10669742

https://www.drupal.org/node/2629388#comment-10651670
https://www.drupal.org/node/2625476#comment-10618602
https://www.drupal.org/node/2622676#comment-10618628
https://www.drupal.org/node/2623014#comment-10618638

https://www.drupal.org/node/2545934#comment-10273369
https://www.drupal.org/node/2560149#comment-10274615
https://www.drupal.org/node/2561267#comment-10312947
https://www.drupal.org/node/2592439#comment-10544594

Please review the same and post bugs.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

Assigned: gauravsood91 » Unassigned
PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxgauravsood912556275git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

Title: [D7] miniOrange LDAP/AD Login » [D7] miniOrange Active Directory/LDAP Module
Issue summary: View changes
gauravsood91’s picture

Issue summary: View changes
FileSize
13.38 KB
gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

Title: [D7] miniOrange Active Directory/LDAP Module » [D7] miniOrange Active Directory/LDAP Module for Cloud Service Providers
Issue summary: View changes
FileSize
22.41 KB
gauravsood91’s picture

FileSize
22.16 KB
gauravsood91’s picture

FileSize
22.16 KB
gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

Status: Needs work » Needs review
kalpeshhiran’s picture

Hello.

I reviewed you module. I found few warning there. Is there any specific reason to use raw posted inputs instead of values?

Everything else looks great.

FILE: /var/www/drupal-7-pareview/pareview_temp/miniorange_ldap.module
---------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
---------------------------------------------------------------------------
84 | WARNING | Do not use the raw $form_state['input'], use
| | $form_state['values'] instead where possible
85 | WARNING | Do not use the raw $form_state['input'], use
| | $form_state['values'] instead where possible
86 | WARNING | Do not use the raw $form_state['input'], use
| | $form_state['values'] instead where possible
---------------------------------------------------------------------
gauravsood91’s picture

Hi,

Thanks for reviewing. The reason I am using the raw posted inputs is that the sanitized input is available after the block mentioned. It is the default login of Drupal which I am modifying.

Is this something that I urgently need to fix?

Thanks,
Gaurav

gauravsood91’s picture

Issue summary: View changes
kvij_10’s picture

Hey,

I reviewed the module.I ran the automated test and apart from using $form['input'] instead of $form['values'], it seems to be fine.

Thanks.

kvij_10’s picture

Assigned: Unassigned » kvij_10
kvij_10’s picture

Assigned: kvij_10 » Unassigned
Status: Needs review » Reviewed & tested by the community
gauravsood91’s picture

Issue summary: View changes
kvij_10’s picture

Hi,

I reviewed your module manually.Below are some of the points which your module follows.

Individual user account
Yes: Follows guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements
Coding style & Drupal API usage
Yes: It follows code and API guidelines.

Thanks.

gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

I have fixed the code to use $form['values'] and removed references to $form['input']

gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

gauravsood91’s picture

Priority: Normal » Major
gauravsood91’s picture

This module has been in RTBC for a few weeks. I think I have completed all steps mentioned in https://www.drupal.org/node/1011698 . Is there anything I am missing?

gauravsood91’s picture

Issue summary: View changes
klausi’s picture

Priority: Major » Normal
Status: Reviewed & tested by the community » Needs work
Issue tags: -PAreview: review bonus +PAreview: security
FileSize
1.85 KB

Review of the 7.x-1.x branch (commit d44e735):

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. "variable_get('miniorange_ldap_customer_id', '');": variables defined by your module need to be deleted in hook_uninstall().
  2. miniorange_ldap_user_login(): drupal_set_message() is used wrong, the second parameter should be 'status', right?
  3. "if ($ldap_login_enabled != 0 and $ldap_login_enabled != FALSE) {": you could use "!empty()" instead.
  4. miniorange_ldap_form_user_login_alter(): do not completely replace all the validation callbacks in #validate. That means no additional login module that wants to do some validation will run. You shoud just insert your callback in the #validate list and remove the one from core.
  5. miniorange_ldap_login_validate(): doc block is wrong, this is not a hook. See https://www.drupal.org/coding-standards/docs#forms
  6. miniorange_ldap_login_validate(): why do you call user_load_by_name() twice here, you can just assign a variable the first time?
  7. miniorange_ldap_login_validate(): flood protection is missing to prevent brute force attacks where an attacker tries an infinite number of name/password combinations. See user_login_authenticate_validate() in core on how to use the flood protection system. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.
  8. class MiniorangeLdapConfig: why is this class no registered in the info file for auto loading? See https://www.drupal.org/node/542202#files
  9. MiniorangeLdapConfig: why do you call exit(0) here? That will completely break the workflow for users and show a white screen of death? And you are leaking curl error information to the user here by printing it, use watchdog() instead for logging errors.
  10. miniorange_ldap_login_validate(): error handling is missing here, what if you don't get valid JSON here? Then "$response->statusCode == 'SUCCESS'" will throw PHP warnings?

Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

gauravsood91’s picture

Thanks for pointing the code issues out. I will fix these and upload again asap.

gauravsood91’s picture

I have fixed the issues. Settings status as "Needs Review"

gauravsood91’s picture

Status: Needs work » Needs review
gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

Issue tags: -PAreview: security +PAReview: security PAReview: review bonus
kalpeshhiran’s picture

Hello,

I have done manual review for your project and I can see all issues pointed by klausi have been fixed.

Automatic Review

http://pareview.sh/pareview/httpgitdrupalorgsandboxgauravsood912556275git looks good,
though no automated test cases written

Manual Review

Individual user account
Yes
No duplication
Yes
Master Branch
Yes
Licensing
Yes
3rd party assets/code
Yes
README.txt/README.md
Yes
Code long/complex enough for review
Yes
Secure code
Yes
Coding style & Drupal API usage
Yes

This review uses the Project Application Review Template.

Looks good to me. Moving it to RTBC

kalpeshhiran’s picture

Status: Needs review » Reviewed & tested by the community
gauravsood91’s picture

Issue tags: -PAReview: security PAReview: review bonus +PAreview: review bonus, +PAreview: security
gauravsood91’s picture

Issue summary: View changes
ItangSanjana’s picture

No automated test cases were found, good.

Individual user account
Yes: Follows guidelines for individual user accounts.

No duplication
Yes: Does not cause module duplication and/or fragmentation.

Master Branch
Yes: Follows the guidelines for master branch.

Licensing
Yes: Follows the licensing requirements.

3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.

README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.

Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.

Secure code
Yes: Meets the security requirements

Coding style & Drupal API usage
Yes: It follows code and API guidelines.

klausi’s picture

Status: Reviewed & tested by the community » Needs work

manual review:

  1. miniorange_ldap_login_validate(): why are there 3 identical calls to user_load_by_name() when the result is already in the $account variable?
  2. miniorange_ldap_login_validate(): why did you change the code from core with the flood protection? I think the comments were helpful and also the filter for blocked users in the query seems like a good idea?
  3. miniorange_ldap_login_validate(): why the hard-coded administrator role here? That role will not exist on every Drupal site? Please add a comment why this is necessary.
  4. includes/customer_ldap_config.php: why do you call module_load_include() here just to include files containing classes? Just add the files to the info file, as already said. See https://www.drupal.org/node/542202#files . Then remove the module_laod_include() calls everywhere.
  5. includes/customer_setup.php: do not echo errors directly to the page as that can leak private information to the end user. watchdog() should be enough, right? Make sure that all echo and print calls for errors are removed from your code base and turned into useful watchdog() messages instead.
  6. "watchdog('miniorange_ldap_curl_error', 'cURL Request Not Sent');": that is not helpful at all. You should pass the exact error message from curl to the log, so that the admin knows what went wrong. Also, the first parameter should be the module name, i.e. 'miniorange_ldap'.

The leaking of error information directly to HTML with print statements is a blocker right now.

gauravsood91’s picture

I have made the changes required. The hardcoded admin role was unnecessary and have removed it. It was thought of at one point in time but then realised that it wasn't needed but the code remained. I have removed that and have fixed the remaining issues which have been pointed out, including the errors being printed to html.

Any other blockers for this module?

gauravsood91’s picture

Status: Needs work » Needs review
gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

Issue summary: View changes
gauravsood91’s picture

Issue summary: View changes
kalpeshhiran’s picture

I have done manual review for the project and also tested for the issues pointed by klausi and I can see all of them are fixed.

Everything looks good. Moving it to RTBC

kalpeshhiran’s picture

Status: Needs review » Reviewed & tested by the community
klausi’s picture

Status: Reviewed & tested by the community » Needs work

manual review:
"watchdog('miniorange_ldap', curl_error($ch));": the first parameter of watchdog() should be a translatable message with placeholders for dynamic variables. It is important that those dynamic variables get sanitized with the correct placeholder, make sure to read https://www.drupal.org/node/28984 again.

gauravsood91’s picture

I have made the change regarding watchdog messages. Setting it back to 'Needs Review'.

gauravsood91’s picture

Status: Needs work » Needs review
kalpeshhiran’s picture

I have reviewed change for watchdog function and it looks good . Moving it to RTBC

klausi’s picture

Assigned: Unassigned » er.pushpinderrana
Status: Needs review » Reviewed & tested by the community

manual review:

  1. "watchdog('miniorange_ldap', "cURL Error: %error", array('%error' => curl_error($curl)));": you are always using the same log message, so it is hard to track down where the actual problem occurred. A better message would be "User authentication failed: %error" or "configuration settings could not be retrieved: %error".
  2. '#markup' => '<h3>Enter Gateway URL</h3>',: all user facing text must run through t() for translation. Make sure to check all your strings, for example also in miniorange_ldap_gateway_setup().
  3. miniorange_ldap_customer_setup(): doc block is wrong, this is not a hook but a form constructor callback. See https://www.drupal.org/coding-standards/docs#forms
  4. miniorange_ldap_customer_setup(): do not print the variables unsanitized to HTML. They come from a third party source, so they should be sanitized before printing. Make sure to read https://www.drupal.org/node/28984 again. I think this is not a security blocker because you are already trusting the third party miniOrange service with your user logins. You probably trust them to not send you XSS content, but this is still an attack vector that should be eliminated.

Although you should definitely fix those issues they are not critical application blockers, otherwise looks RTBC to me.

Assigning to er.pushpinderrana as he might have time to take a final look at this.

gauravsood91’s picture

Thanks for the review Klausi. I'll definitely fix those issues as well. I'll try for more concrete information passed to the watchdog calls tracking cURL or JSON errors. I am thinking of logging the file/method combination so as to provide the admin the source of the error.

klausi’s picture

Assigned: er.pushpinderrana » Unassigned
Status: Reviewed & tested by the community » Fixed

OK, since @kalpeshhiran confirmed the RTBC already ...

Thanks for your contribution, @gauravsood91!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

gauravsood91’s picture

Thanks :D

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.