Red Hat Satellite engineering is moving the tracking of its product development work on Satellite 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 "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. 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 "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-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 2122617 - Kerberos authentication fails for POST, PUT and DELETE api calls
Summary: Kerberos authentication fails for POST, PUT and DELETE api calls
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Authentication
Version: 6.12.0
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: 6.13.0
Assignee: Oleh Fedorenko
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks: 1264161
TreeView+ depends on / blocked
 
Reported: 2022-08-30 12:29 UTC by Vladimír Sedmík
Modified: 2023-05-03 13:21 UTC (History)
8 users (show)

Fixed In Version: foreman-3.5.0,foreman-installer-3.5.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-03 13:21:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 35473 0 Normal New Kerberos authentication fails for POST, PUT and DELETE api calls 2022-09-01 12:37:45 UTC
Red Hat Issue Tracker SAT-12594 0 None None None 2022-08-30 15:40:26 UTC
Red Hat Product Errata RHSA-2023:2097 0 None None None 2023-05-03 13:21:59 UTC

Description Vladimír Sedmík 2022-08-30 12:29:32 UTC
Description of problem:
POST, PUT and DELETE calls fail with "Unable to authenticate user" when using kerberos authentication. At the same time, GET calls pass without any issues.


Version-Release number of selected component (if applicable):
6.12.0 snap 8


How reproducible:
always


Steps to Reproduce:
1. Have a Satellite configured for Kerberos authentication.
2. Run kinit <someuser> to get ticket.
3. Call /extlogin to get session_id and store it in a cookie file:
# curl -k -c cookies.txt -u : --negotiate https://satellite.redhat.com/users/extlogin
4. Using the cookie file try GET call to some endpoint, it works:
# curl -b cookies.txt -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X GET -k https://satellite.redhat.com/api/architectures
5. Using the same cookie file try POST/PUT/DELETE call to create/update/delete an entity:
# curl -b cookies.txt -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X POST -d '{"name":"8051"}' -k https://satellite.redhat.com/api/architectures


Actual results:

It fails with this response:
{
  "error": {"message":"Unable to authenticate user "}
}

In the production log we can see:
2022-08-30T04:38:23 [I|app|0dd98e4b] Started POST "/api/architectures" for 10.11.12.13 at 2022-08-30 04:38:23 -0400
2022-08-30T04:38:23 [I|app|0dd98e4b] Processing by Api::V2::ArchitecturesController#create as JSON
2022-08-30T04:38:23 [I|app|0dd98e4b]   Parameters: {"name"=>"8051", "apiv"=>"v2", "architecture"=>{"name"=>"8051"}}
2022-08-30T04:38:23 [W|app|0dd98e4b] Can't verify CSRF token authenticity.
2022-08-30T04:38:23 [I|app|0dd98e4b]   Rendering api/v2/errors/unauthorized.json.rabl within api/v2/layouts/error_layout
2022-08-30T04:38:23 [I|app|0dd98e4b]   Rendered api/v2/errors/unauthorized.json.rabl within api/v2/layouts/error_layout (Duration: 6.9ms | Allocations: 6931)
2022-08-30T04:38:23 [I|app|0dd98e4b] Filter chain halted as :authorize rendered or redirected
2022-08-30T04:38:23 [I|app|0dd98e4b] Completed 401 Unauthorized in 14ms (Views: 11.1ms | ActiveRecord: 0.5ms | Allocations: 13914)


Expected results:
Successful authentication, entity created/updated/deleted


Additional info:
This issue impacts the hammer CLI functionality too.

Comment 1 Oleh Fedorenko 2022-09-01 12:37:45 UTC
Created redmine issue https://projects.theforeman.org/issues/35473 from this bug

Comment 2 Adam Ruzicka 2022-09-14 07:11:22 UTC
Doing the flag dance per https://issues.redhat.com/browse/SAT-10254?focusedCommentId=20931263

Comment 5 Bryan Kearney 2022-10-31 12:03:28 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35473 has been resolved.

Comment 6 Lukáš Hellebrandt 2023-03-06 17:25:08 UTC
Verified on Sat 6.13 snap 10.0.

It is now possible to call GET, POST, PUT and DELETE endpoints with correct results.

On a Satellite enrolled to AD:
# kinit foobar.rdu2.redhat.com
# curl -c cookies.txt -u : --negotiate https://$(hostname)/api/users/extlogin
# curl -b cookies.txt -H "Accept:application/json" -H "Content-Type:application/json" -X GET -k https://$(hostname)/api/architectures
<expected result, archs listed>
# curl -b cookies.txt -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X POST -d '{"name":"8051"}' -k https://satellite.redhat.com/api/architectures
# curl -b cookies.txt -H "Accept:application/json" -H "Content-Type:application/json" -X GET -k https://$(hostname)/api/architectures
<expected result, arch added>
# curl -b cookies.txt -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X PUT -d '{"name":"8051a"}' -k https://$(hostname)/api/architectures/2
# curl -b cookies.txt -H "Accept:application/json" -H "Content-Type:application/json" -X GET -k https://$(hostname)/api/architectures
<expected result, arch name changed>
# curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X DELETE -k https://$(hostname)/api/architectures/2
# curl -b cookies.txt -H "Accept:application/json" -H "Content-Type:application/json" -X GET -k https://$(hostname)/api/architectures
<expected result, arch deleted>

Comment 9 errata-xmlrpc 2023-05-03 13:21:46 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 (Important: Satellite 6.13 Release), 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/RHSA-2023:2097


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