-
Notifications
You must be signed in to change notification settings - Fork 370
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
All Set-Cookie responses incorrectly assumed to be auth cookies #438
Comments
Thanks for reporting this issue with the detailed information, we'll investigate it and try to provide a fix. |
Thanks, that solves the authentication problem. However, the fix does not take the Set-Cookie from the middleware into consideration. Any non-auth-cookies in |
@bendikro we would request you to use the latest Python SDK and let us know if it resolves the issue. |
Hi Version 1.7.0 gives TypeError due to this change: https://github.com/splunk/splunk-sdk-python/pull/463/files#diff-701b42a0245cf832be44eb595d99bef52b3afca77ae631caa24643ed1ea6c4f3R547 Btw, why would you be calling |
@bendikro we would request you to use the latest Python SDK release. We have fixed the code for TypeError and also considered your suggestion in the fix. Please let us know if it resolves your issue. Thanks! |
Seems to be working now with version 1.7.1. Thanks! |
In short:
splunklib expects any Set-Cookie to be an auth cookie from Splunk. This is a problem when authenticating with a bearer token.
When hosting Splunk behind a load balancer like F5, which sets its own Set-Cookie in the response for connection persistence (stickiness), the Set-Cookie in the response from F5 will be included in the request headers instead of the splunk bearer token due to the logic in splunklib/binding.py#L520
When authenticating with user/pass, this makes sense, since Splunk API responds with a Set-Cookie for the session token (
splunkd_8089
). With a bearer token, Splunk does not respond with a session token, however the _auth_headers function seems to expect any Set-Cookie to be a session token.The result is that, with bearer token authentication, requests to the Splunk API after the initial request will fail with "Request failed: Session is not logged in"
To Reproduce
splunklib.client.Service
with bearer token authenticationExpected behavior
Authentication should work
Workaround
By passing the splunk token header manually, splunklib will include both the stickiness cookie as well as the splunk token in the requests.
Splunk:
SDK:
The text was updated successfully, but these errors were encountered: