Cannot use trusts with fernet tokens

Bug #1524849 reported by Kairat Kushaev
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Boris Bobrov

Bug Description

Master, devstack (installed today).
1. Enable fernet tokens in Keystone
2. Add the following lib to glance/common/ folder:
http://paste.openstack.org/show/481480/
3. Replace upload method in glance/api/v2/image_data.py with the following:
http://paste.openstack.org/show/481489/
NOTE: it is just example of the code to demonstrate that fernet tokens can't work well with trusts.
4. Restart glance
5. Try to upload any image.
You will get the following error when deleting the trust: http://paste.openstack.org/show/481493/
When you try to upload big image that requires more than hour (or reduce token expiration)
you will get the following: http://paste.openstack.org/show/481492/
Apparently, refreshed token rejected by keystone-middleware.

I faced with the issue when implementing trusts for Glance but it seems that Heat and other services have the same troubles.
UUID tokens works as expected.

Tags: fernet
summary: - Cannot delete trust when using fernet tokens
+ Cannot use trusts with fernet tokens
Brant Knudson (blk-u)
tags: added: fernet
Revision history for this message
Lance Bragstad (lbragstad) wrote :

Kairat,

Are you able to post the output from the keystone server logs (preferably with debug and verbose set to true)?

Revision history for this message
Alexander Makarov (amakarov) wrote :

Looks like trustee cannot delete the trust using Fernet token.

Revision history for this message
Kairat Kushaev (kkushaev) wrote :

http://paste.openstack.org/show/481505/ - here is "key" screen output
http://paste.openstack.org/show/481506/ - key-access
Please let me know if you need something else.

Revision history for this message
Kairat Kushaev (kkushaev) wrote :
Revision history for this message
Kairat Kushaev (kkushaev) wrote :

FYI, looks like Sahara, Murano, Heat is broken with the same error.
If you turn on fernets and execute some long-running operation then 503 error is raised by keystone middleware.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/257478

Changed in keystone:
assignee: nobody → Boris Bobrov (bbobrov)
status: New → In Progress
Revision history for this message
Boris Bobrov (bbobrov) wrote :

This happens only when impersonate=True

Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Medium
Changed in keystone:
milestone: none → mitaka-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/257478
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=c885eeed341fd2ebca8d7c0bec0c51b00df2f28e
Submitter: Jenkins
Branch: master

commit c885eeed341fd2ebca8d7c0bec0c51b00df2f28e
Author: Boris Bobrov <email address hidden>
Date: Mon Dec 14 19:42:43 2015 +0300

    Verify that user is trustee only on issuing token

    get_token_data is used to gather various data for token. One of the
    checks it does is verifying that the authenticated user is a trustee.
    Before Fernet, it was used during token issuing.

    Impersonation in trusts substitutes information about user in token,
    so instead of trustee, trustor is stored in token.

    With Fernet tokens, get_token_data is used during token validation.
    In case of impersonation, user_id, stored in Fernet token, is id of
    the trustor, but the check described needs this id to be id of the
    trustee.

    Move the check to happen only on token issuing.

    Change-Id: I7c02cc6a1dbfe4e28d390960ac85d4574759b1a8
    Closes-Bug: 1524849

Changed in keystone:
status: In Progress → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/keystone 9.0.0.0b2

This issue was fixed in the openstack/keystone 9.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.