RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1967325 - API returns the misleading error "Insufficient Access" if run as non-admin
Summary: API returns the misleading error "Insufficient Access" if run as non-admin
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: ipa
Version: 8.3
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: beta
: ---
Assignee: Thomas Woerner
QA Contact: ipa-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-02 21:16 UTC by Maria
Modified: 2024-10-01 18:27 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 18:29:22 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FREEIPA-7281 0 None None None 2021-11-09 18:32:26 UTC
Red Hat Product Errata RHBA-2021:4230 0 None None None 2021-11-09 18:29:43 UTC

Description Maria 2021-06-02 21:16:30 UTC
Description of problem:

Given:
We have created a user in RedHat IDM "enrollment-user"
We have granted that user the Role "IT Specialist" which has the Priviledge "Host Administrators"

When:
We authenticate as enrollment-user using RedHat IDM api with curl and send payload using the "host_del" api method to attempt to delete a host

Then:
We get an error "Insufficient access"
Full response - {"result": null, "error": {"code": 2100, "message": "Insufficient access: ", "data": {"info": ""}, "name": "ACIError"}, "id": 0, "principal": "enrollment-user.COM", "version": "4.8.7"}

Problem:
If you try to host_del for a host that does not exist, the API returns the misleading error "Insufficient Access" if run as non-admin, but if you run as admin for a non-existing host, the correct response is returned indicating that host as "failed" to remove, example response:
{ "method": "host_del", "params": [ [ "system04.org.com" ], { "continue": true, "version": 2.235 } ], "id": 0 }
{"result": {"result": {"failed": ["system04.org.com"]}, "value": [], "summary": "Deleted host \"\""}, "error": null, "id": 0, "principal": "admin.COM", "version": "4.8.7"}

It seems like this is not an access problem, it's just an API response messaging problem.  So, from my API usage perspective, I'm able to do what I need to do using non-admin user, but I am unable to distinguish between access problems and invalid host problems.  I will work around that for now by assuming any Insufficient Access error could also mean the host was already cleaned up.  Let me know if you want any more information, but at this point I'd say I would just suggest to the product team that the response messaging be improved in this case as a fix some time in the future.

Comment 4 Rob Crittenden 2021-06-03 01:14:39 UTC
The current code only does an existence check if the host value is not a fqdn, otherwise it effectively defers the check until later.

Deleting a host is a complex task. It also needs to delete any services associated with the host, search for an revoke any certificates for the services, or itself, update the DNS records, and finally delete the host. It is one of these sub-tasks that is failing and raising the ACI error.

In this case though the host simply isn't there so this can probably be short-circuited in the pre_callback. I don't think there would be any side-effects to doing so and could actually save in computing time even though in some cases the queried entry would be unused.

Comment 6 Antonio Torres 2021-06-15 11:54:46 UTC
Upstream ticket: https://pagure.io/freeipa/issue/8884
PR: https://github.com/freeipa/freeipa/pull/5838

Comment 15 anuja 2021-07-30 07:39:38 UTC
Test 

(A) test-result.txt.gz

(1) xmlrpc test (TestCRUD::test_update_shortname)
============================= test session starts ==============================
platform linux -- Python 3.6.8, pytest-3.10.1, py-1.10.0, pluggy-0.13.1 -- /usr/libexec/platform-python
cachedir: /home/cloud-user/.pytest_cache
metadata: {'Python': '3.6.8', 'Platform': 'Linux-4.18.0-324.el8.x86_64-x86_64-with-redhat-8.5-Ootpa', 'Packages': {'pytest': '3.10.1', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins': {'metadata': '1.11.0', 'html': '1.22.1', 'multihost': '3.0', 'sourceorder': '0.5'}}
rootdir: /usr/lib/python3.6/site-packages/ipatests, inifile:
plugins: metadata-1.11.0, html-1.22.1, multihost-3.0, sourceorder-0.5
collecting ... collected 2463 items / 12 deselected

test_xmlrpc/test_host_plugin.py::TestCRUD::test_update_shortname PASSED  [ 45%]

(B) runner.log 
2021-07-30T06:59:30+0000 TASK [List installed IPA packages version] *************************************
2021-07-30T06:59:30+0000 ok: [master.testrelm.test] => (item=ipa-server) => 
2021-07-30T06:59:30+0000   msg:
2021-07-30T06:59:30+0000   - arch: x86_64
2021-07-30T06:59:30+0000     epoch: null
2021-07-30T06:59:30+0000     name: ipa-server
2021-07-30T06:59:30+0000     release: 4.module+el8.5.0+11912+1b4496cf
2021-07-30T06:59:30+0000     source: rpm
2021-07-30T06:59:30+0000     version: 4.9.6

Comment 18 errata-xmlrpc 2021-11-09 18:29:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (ipa bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4230


Note You need to log in before you can comment on or make changes to this bug.