Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible Tower LDAP member_attr error #652

Merged
merged 2 commits into from
Oct 13, 2021
Merged

Conversation

MAHDTech
Copy link
Contributor

@MAHDTech MAHDTech commented Oct 5, 2021

What does this PR do?

Removes the member_attr field from the template (which is added by default) by only specifying name_attr.

How should this be tested?

Run Ansible role

Is there a relevant Issue open for this?

N/A

Other Relevant info, PRs, etc.

The error received without this is as follows.

lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]: 2021-10-05 08:23:31,474 WARNING  awx.conf.settings The current value "{'name_attr': 'cn', 'member_attr': 'member'}" for setting "AUTH_LDAP_GROUP_TYPE_PARAMS" is invalid.
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]: Traceback (most recent call last):
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]:   File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/conf/settings.py", line 419, in _get_local
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]:     return field.run_validation(value)
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]:   File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/rest_framework/fields.py", line 568, in run_validation
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]:     value = self.to_internal_value(data)
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]:   File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/sso/fields.py", line 510, in to_internal_value
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]:     self.fail('invalid_keys', invalid_keys=keys_display)
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]:   File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/rest_framework/fields.py", line 641, in fail
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]:     raise ValidationError(message_string, code=key)
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]: rest_framework.exceptions.ValidationError: [ErrorDetail(string='Invalid key(s): "member_attr".', code='invalid_keys')]
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]: 2021-10-05 08:23:31,745 INFO     awx.api.authentication User admin performed a PUT to /api/v2/settings/ldap/ through the API
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]: 2021-10-05 08:23:31,838 WARNING  awx.main.wsbroadcast Adding {'ansible-tower-6999b4886f-9htqp'} to websocket broadcast list
lodestar-ansible-tower/ansible-tower-68cc697696-4xl6f[ansible-tower-web]: 2021-10-05 08:23:31,846 DEBUG    awx.main.wsbroadcast Connection from ansible-tower-68cc697696-4xl6f to 10.217.1.64 attempt number 0.

There are several documented workarounds and fixes, and some of the tests I completed results in errors such as;

# GroupOfNames OR MemberDNGroupType when member_attr field is included
lodestar-ansible-tower/ansible-tower-55b98b4594-kqmt9[ansible-tower-web]: 2021-10-12 04:47:52,209 DEBUG    django_auth_ldap uid=developer,cn=users,cn=accounts,dc=apps-crc,dc=testing is not a member of cn=lodestar-mgmt-users,cn=groups,cn=accounts,dc=apps-crc,dc=testing
lodestar-ansible-tower/ansible-tower-55b98b4594-kqmt9[ansible-tower-web]: 2021-10-12 04:47:52,209 DEBUG    django_auth_ldap Authentication failed for developer: user does not satisfy AUTH_LDAP_REQUIRE_GROUP

Removal of the member_attr field in conjunction with using GroupOfNamesType was the only pair that both allowed login and no errors appeared in the logs when tested with with FreeIPA v4.6.8

Other

People to notify

cc: @redhat-cop/infra-ansible

@MAHDTech MAHDTech marked this pull request as ready for review October 12, 2021 05:00
Copy link
Contributor

@oybed oybed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@oybed oybed merged commit 8113966 into redhat-cop:main Oct 13, 2021
jfilipcz pushed a commit to jfilipcz/infra-ansible that referenced this pull request Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants