Nova does not ensure a valid token is available if snapshot process exceeds token lifetime

Bug #1366911 reported by Micheal Jones
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
Undecided
Unassigned
OpenStack Compute (nova)
Invalid
Undecided
Unassigned

Bug Description

Recently we encountered the following issue due to the change in Icehouse for the default lifetime of a token before it expires. It's now 1 hour, while previously it was 8.

If a snapshot process takes longer than an hour, when it goes to the next phase it will fail with a 401 Unauthorized error because it has an invalid token.

In our specific example the following would take place:

1. User would set a snapshot to begin and a token would be associated with this request.
2. Snapshot would be created, compression time would take about 55 minutes. Enough to just push the snapshotting of this instance over the 60 minute mark.
3. Upon Image Upload ("Uploading image data for image" in the logs) Nova would then return a 401 Unauthorized error stating "This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required."

Icehouse 2014.1.2, KVM as the hypervisor.

The workaround is to specify a longer token timeout - however limits the ability to set short token expirations.

A possible solution may be to get a new/refresh the token if the time has exceeded the timeout.

Changed in nova:
assignee: nobody → Nikolay Starodubtsev (starodubcevna)
Revision history for this message
Nikolay Starodubtsev (starodubcevna) wrote :

This bug should be moved to glance or keystone, it's not nova problem

affects: nova → keystone
Revision history for this message
Micheal Jones (micheal-s) wrote :

For what it's worth I filed this against Nova as it's Nova making the calls (and in charge of the snapshot process) - as the issue is created before the image is even sent to Glance because of the expired token. In my example it's only when it's time to sent the finished image to Glance that the expired token issue is revealed.

Revision history for this message
Nikolay Starodubtsev (starodubcevna) wrote :

Micheal,
You can configure token lifetime in /etc/keystone/keystone.conf. Take a look at [token] section parameter expiration. If it works, please close this bug.

Revision history for this message
Micheal Jones (micheal-s) wrote :

That's the workaround we are currently using (we set it back to the Havana default of 8 hours) - but that does not fix the issue of the snapshot being uploaded with an expired token. It also makes it impossible to use shorter lived tokens from a security standpoint.

Revision history for this message
Micheal Jones (micheal-s) wrote :

Should have read "fix the issue of snapshotting failing because of an expired token" instead of "fix the issue of the snapshot being uploaded with an expired token".

Revision history for this message
Nikolay Starodubtsev (starodubcevna) wrote :

My idea is to use trust instead of token for the image upload. Need to make some discovery in this direction, when I'll update the bug description.

affects: keystone → nova
Changed in glance:
assignee: nobody → Nikolay Starodubtsev (starodubcevna)
Revision history for this message
Micheal Jones (micheal-s) wrote : Re: [Bug 1366911] Nova does not ensure a valid token is available if snapshot process exceeds token lifetime

Much appreciated!

On Sep 9, 2014, at 9:17, Nikolay Starodubtsev <email address hidden> wrote:

> My idea is to use trust instead of token for the image upload. Need to
> make some discovery in this direction, when I'll update the bug
> description.
>
> ** Project changed: keystone => nova
>
> ** Also affects: glance
> Importance: Undecided
> Status: New
>
> ** Changed in: glance
> Assignee: (unassigned) => Nikolay Starodubtsev (starodubcevna)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1366911
>
> Title:
> Nova does not ensure a valid token is available if snapshot process
> exceeds token lifetime
>
> Status in OpenStack Image Registry and Delivery Service (Glance):
> New
> Status in OpenStack Compute (Nova):
> New
>
> Bug description:
> Recently we encountered the following issue due to the change in
> Icehouse for the default lifetime of a token before it expires. It's
> now 1 hour, while previously it was 8.
>
> If a snapshot process takes longer than an hour, when it goes to the
> next phase it will fail with a 401 Unauthorized error because it has
> an invalid token.
>
> In our specific example the following would take place:
>
> 1. User would set a snapshot to begin and a token would be associated with this request.
> 2. Snapshot would be created, compression time would take about 55 minutes. Enough to just push the snapshotting of this instance over the 60 minute mark.
> 3. Upon Image Upload ("Uploading image data for image" in the logs) Nova would then return a 401 Unauthorized error stating "This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required."
>
> Icehouse 2014.1.2, KVM as the hypervisor.
>
> The workaround is to specify a longer token timeout - however limits
> the ability to set short token expirations.
>
> A possible solution may be to get a new/refresh the token if the time
> has exceeded the timeout.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/glance/+bug/1366911/+subscriptions

Revision history for this message
Sean Dague (sdague) wrote :

I think the real issue here is that they clients need to revalidate tokens, which they don't, so in this case it's really a glanceclient bug.

Changed in nova:
status: New → Invalid
Revision history for this message
Nikolay Starodubtsev (starodubcevna) wrote :

Thx, Sean! You should be right.

Changed in python-glanceclient:
assignee: nobody → Cindy Pallares (cindy-pallaresq)
status: New → Confirmed
no longer affects: glance
Changed in nova:
assignee: Nikolay Starodubtsev (starodubcevna) → nobody
Revision history for this message
Micheal Jones (micheal-s) wrote :

sdague: Should this then also be a Horizon bug?

Changed in python-glanceclient:
assignee: Cindy Pallares (cindy-pallaresq) → nobody
Revision history for this message
Ian Cordasco (icordasc) wrote :

This should be addressed with the availability of trusts in keystone. I believe glanceclient supports the usage of trusts now so this should be fixed.

Changed in python-glanceclient:
status: Confirmed → Fix Released
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.