Bug 1441527

Summary: Error 500 when LDAP Group filter returns no response
Product: Red Hat Satellite Reporter: Marcel Gazdík <mgazdik>
Component: LDAPAssignee: Daniel Lobato Garcia <dlobatog>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.8CC: jcallaha
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-30 14:50:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marcel Gazdík 2017-04-12 07:49:41 UTC
Description of problem:
  When the LDAP Group base DN is set, it may happen that there is no group associated with the user, or the DN might be set wrong and the result is same -> no associated group found. This is correct and expected behavior, but, satellite doesn't react properly in a sense, that it generates error 500 with source back trace. 

Version-Release number of selected component (if applicable):
6.2

How reproducible:
Add LDAP authentication and set Group base DN to something semantically incorrect, save, and try to login with some LDAP user.


Actual results:
  Back trace with Error 500

Expected results:
  1) **DISPUTABLE** Allow login when there is no User group associated - aka behave the same way like the Group base DN have had been empty.

  2) Block all login attempts with proper message that no group was found. Perhaps with additional information in the logs what filter was used without a need of turning on LDAP debug mode.

Additional info:
  The actual error is in ldap fluff module where there is not being check if the search result is not nil

NoMethodError
undefined method `each' for nil:NilClass
/opt/theforeman/tfm/root/usr/share/gems/gems/ldap_fluff-0.4.5/lib/ldap_fluff/posix_member_service.rb:22:in `find_user_groups'
.
.
.


~~~
21:    @ldap.search(:filter => Net::LDAP::Filter.eq('memberuid', uid),
22:                 :base => @group_base).each do |entry|
~~~

Comment 3 Daniel Lobato Garcia 2017-06-21 08:33:35 UTC
I will take this as "validate BaseDN" before allowing to save it. The 500 is ugly for sure, but yeah it's an unexpected error. Cloning to Redmine...

Comment 4 Daniel Lobato Garcia 2017-06-21 08:35:26 UTC
Created redmine issue http://projects.theforeman.org/issues/20069 from this bug

Comment 5 Bryan Kearney 2018-11-01 14:44:44 UTC
The Satellite Team is attempting to provide an accurate backlog of bugzilla requests which we feel will be resolved in the next few releases. We do not believe this bugzilla will meet that criteria, and have plans to close it out in 1 month. This is  not a reflection on the validity of the request, but a reflection of the many priorities for the product. If you have any concerns about this, feel free to contact Rich Jerrido or Bryan Kearney or your account team. If we do not hear from you, we will close this bug out. Thank you.

Comment 6 Bryan Kearney 2018-11-30 14:50:40 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Rich Jerrido or Bryan Kearney. Thank you.