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

[PR #5903/ea5cbe25 backport][stable-6] Redfish: Removed basic auth header when performing a GET on the service root and POST to the session collection #5924

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Jan 30, 2023

This is a backport of PR #5903 as merged into main (ea5cbe2).

SUMMARY

Redfish services do not expect authorization headers when performing a POST to the session collection. The expectation is credentials are in the request body. While the specification is silent on how services behave when authorization headers are present in this request, the guidance for clients is to not provide the header.

The change here removes the authorization header on two conditions:

  • When performing a GET on the service root (/redfish/v1/): this is an unauthenticated resource and is used for discovery prior to logging into the system.
  • When performing a POST on the session collection (/redfish/v1/SessionService/Sessions).

Fix #5886

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

redfish_utils

ADDITIONAL INFORMATION

On some systems, using the Redfish command "CreateSessions" will result in an error (as shown in #5886).

Before:

fatal: [localhost]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "msg": "HTTP Error 415 on POST request to 'https://<REDACTED>/redfish/v1/SessionService/Sessions', extended message: 'A general error has occurred. See Resolution for information on how to resolve the error.'"}

After:

ok: [localhost] => {
    "redfish_results": {
        "ansible_facts": {
            "discovered_interpreter_python": "/usr/bin/python3"
        },
        "changed": true,
        "failed": false,
        "msg": "Action was successful",
        "return_values": {},
        "session": {
            "token": "66de70083fccd78fcbd200d9341473b7",
            "uri": "/redfish/v1/SessionService/Sessions/70"
        }
    }
}

…ce root and POST to the session collection (#5903)

* Redfish: Removed basic auth header when performing a GET on the service root and POST to the session collection

* Update changelogs/fragments/5886-redfish-correct-basic-auth-usage-on-session-creation.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit ea5cbe2)
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added backport bug This issue/PR relates to a bug module_utils module_utils new_contributor Help guide this first time contributor plugins plugin (any type) labels Jan 30, 2023
@felixfontein felixfontein merged commit 3c5c3a0 into stable-6 Jan 30, 2023
@felixfontein felixfontein deleted the patchback/backports/stable-6/ea5cbe2553716192c9a15f93532c286d1ddec1d1/pr-5903 branch January 30, 2023 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module_utils module_utils new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants