[Satellite 6] Login to satellite with LDAP user fails with error "Oops, we're sorry but something went wrong / undefined method `each' for nil:NilClass"
Environment
- Red Hat Satellite 6 or Proxy 6.1/6.2
- LDAP
Issue
- When trying to login satellite webui with LDAP user it fails with error:
Oops, we're sorry but something went wrong
undefined method `each' for nil:NilClass
If you feel this is an error with Satellite 6 itself, please open a new issue with Satellite ticketing system, You would probably need to attach the Full trace and relevant log entries.
NoMethodError
undefined method `each' for nil:NilClass
app/models/auth_sources/auth_source_ldap.rb:103:in `update_usergroups'
app/models/user.rb:197:in `block in try_to_login'
app/models/concerns/foreman/thread_session.rb:73:in `as'
app/models/concerns/foreman/thread_session.rb:79:in `as_anonymous_admin'
app/models/user.rb:191:in `try_to_login'
app/controllers/users_controller.rb:71:in `login'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'
Resolution
- Possible issue between the LDAP settings in Satellite 6.x and the LDAP server. Confirm that the Satellite LDAP groups and the groups on LDAP server match each other.
- Check attribute on LDAP server whether it have reached limit.
For more KB articles/solutions related to Red Hat Satellite 6.x Authentication Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Authentication Issues
Root Cause
- LDAP server was not functioning properly due to an attribute that had reached limit.
Diagnostic Steps
- Entries seen in
/var/log/foreman/production.logfile on satellite server:
16-03-28 10:07:30 [I] Completed 200 OK in 17ms (Views: 4.0ms | ActiveRecord: 0.0ms)
2016-03-28 10:07:30 [I] Processing by Katello::Api::Rhsm::CandlepinProxiesController#get as JSON
2016-03-28 10:07:30 [I] Parameters: {"id"=>"xxxxx-f0d3-486c-92eb-xxxxxxx"}
2016-03-28 10:07:30 [I] Processing by UsersController#login as HTML
2016-03-28 10:07:30 [I] Rendered users/login.html.erb within layouts/login (2.1ms)
2016-03-28 10:07:30 [I] Rendered layouts/base.html.erb (1.3ms)
2016-03-28 10:07:30 [I] Completed 200 OK in 6ms (Views: 4.5ms | ActiveRecord: 0.0ms)
2016-03-28 10:07:30 [I] Completed 200 OK in 40ms (Views: 0.2ms | ActiveRecord: 0.0ms)
2016-03-28 10:07:30 [I] Processing by Katello::Api::Rhsm::CandlepinProxiesController#get as JSON
2016-03-28 10:07:30 [I] Parameters: {"id"=>"xxxxx-f0d3-486c-92eb-xxxxxxx"}
2016-03-28 10:07:30 [I] Completed 200 OK in 51ms (Views: 0.2ms | ActiveRecord: 0.0ms)
2016-03-28 10:07:33 [I] Processing by UsersController#login as HTML
2016-03-28 10:07:33 [I] Parameters: {"utf8"=>"✓", "authenticity_token"=>"RpPRqC7taJKxii1HEFiskfoDRNTHA24kGmMDP695lpdavE=", "login"=>{"login"=>"user1", "password"=>"[FILTERED]"}, "commit"=>"Login"}
2016-03-28 10:07:33 [I] Expire fragment views/tabs_and_title_records-19 (0.1ms)
2016-03-28 10:07:34 [W] Operation FAILED: undefined method `each' for nil:NilClass
2016-03-28 10:07:34 [I] Rendered common/500.html.erb within layouts/application (4.1ms)
2016-03-28 10:07:34 [I] Rendered layouts/base.html.erb (1.2ms)
2016-03-28 10:07:34 [I] Completed 500 Internal Server Error in 405ms (Views: 7.1ms | ActiveRecord: 3.4ms)
- Debug level logs:
logger.debug "Updating user groups for user #{login}"
internal = User.find_by_login(login).external_usergroups.map(&:name)
external = ldap_con.group_list(login) # this list may return all groups in lowercase
(internal | external).each do |name|
begin
SBR
Product(s)
Components
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.