odd keystone behavior when X-Auth-Token ends with carriage return
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Identity (keystone) |
Invalid
|
Low
|
Gage Hugo | ||
keystonemiddleware |
Fix Released
|
Undecided
|
Matthew Edmonds |
Bug Description
I had to root cause a very odd problem today, where a user complained that they had a token that worked with neutron but didn't work with keystone. E.g. they could list networks, but couldn't list projects. I thought there must be some mistake, but I was finally able to reproduce it and they were correct. Here's a script that shows the problem:
OPENSTACK=
AUTH_FILE=
TOKEN=`curl -s -1 -k -i -X POST https:/
echo 'neutron:'; curl -1 -k -X GET https:/
echo 'keystone:'; curl -1 -k -X GET https:/
With debug=True and insecure_debug=True and default_
neutron:
{"networks": []}
keystone:
{"error": {"message": "auth_context did not decode anything useful (Disable insecure_debug mode to suppress these details.)", "code": 401, "title": "Unauthorized"}}
I was finally able to figure out why... the awk command used to parse the token out of the X-Subject-Token header was leaving a \r on the end of the $TOKEN value, and apparently that's handled fine when you make the request to neutron (and presumably any non-keystone service), but not when you are talking to keystone directly. That makes some sense, since keystone has to do its own token validation differently.
Changing the following line in the script above (adding the gsub to trim the \r) fixed the issue:
TOKEN=`curl -s -1 -k -i -X POST https:/
We should fix this to be consistent with non-keystone token validation, to save someone else the trouble debugging this if nothing else. Keystone was doing weird things, where the debug logs would show that the context knew the user and roles, but had no token... leaving one to wonder how it figured out the user and roles if it didn't have a token?!? Not a good user experience for someone trying to write a script to our APIs.
Changed in keystone: | |
assignee: | nobody → Jaewoo Park (aselius) |
Changed in keystone: | |
assignee: | Jaewoo Park (aselius) → Kelly Hall (kaerie) |
Changed in keystone: | |
assignee: | Kelly Hall (kaerie) → Aaron Thomas (aaron25mt) |
Changed in keystone: | |
assignee: | Aaron Thomas (aaron25mt) → nobody |
Changed in keystone: | |
assignee: | nobody → Kelly Hall (kaerie) |
Changed in keystone: | |
assignee: | Kelly Hall (kaerie) → Gage Hugo (gagehugo) |
Changed in keystonemiddleware: | |
status: | New → In Progress |
Changed in keystonemiddleware: | |
assignee: | nobody → Matthew Edmonds (edmondsw) |
Sounds like the fix here is to scrub the X-Subject-Token header manually within keystone?