After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 756495 - Fix kerberos renewal feature
Fix kerberos renewal feature
Status: RESOLVED FIXED
Product: gnome-online-accounts
Classification: Core
Component: Kerberos
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Online Accounts maintainer(s)
GNOME Online Accounts maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-10-13 12:52 UTC by Ray Strode [halfline]
Modified: 2016-04-11 15:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
identity: don't ignore almost all renewal requests (3.32 KB, patch)
2015-10-13 12:52 UTC, Ray Strode [halfline]
committed Details | Review
identity: consider ticket start time when calculating renewal time (23.03 KB, patch)
2015-10-13 12:52 UTC, Ray Strode [halfline]
none Details | Review
identity: rework how renewal time is calculated (28.46 KB, patch)
2016-03-14 16:08 UTC, Ray Strode [halfline]
none Details | Review
identity: rework how renewal time is calculated (28.13 KB, patch)
2016-03-15 19:43 UTC, Ray Strode [halfline]
none Details | Review
identity: don't reverify identity when doing update (9.75 KB, patch)
2016-03-30 19:34 UTC, Ray Strode [halfline]
committed Details | Review
identity: don't reset alarm if time unchanged (6.78 KB, patch)
2016-03-30 19:34 UTC, Ray Strode [halfline]
committed Details | Review
identity: rework how renewal time is calculated (30.24 KB, patch)
2016-03-30 19:34 UTC, Ray Strode [halfline]
committed Details | Review

Description Ray Strode [halfline] 2015-10-13 12:52:39 UTC
Some KDCs allow renewal of the kerberos ticket granting ticket,
just by asking for a renewal, without having to resubmit a password
(within defined limits).

the gnome-online-accounts kerberos code tries to support that, when
available, but fails in most cases due to a couple of bugs in the
code.

These patches get things working.
Comment 1 Ray Strode [halfline] 2015-10-13 12:52:44 UTC
Created attachment 313177 [details] [review]
identity: don't ignore almost all renewal requests

There's a bug in the code where we ignore all renewal requests for
objects we already know about.

This means we'll only ever honor renewal requests that happen almost
immediately after start up.

This commit fixes the bug, so the only renewal requests that aren't
honored, are those that have been specifically disabled by the user.
This was clearly the original intention of the buggy code.
Comment 2 Ray Strode [halfline] 2015-10-13 12:52:48 UTC
Created attachment 313178 [details] [review]
identity: consider ticket start time when calculating renewal time

Right now we try to renew the kerberos ticket at the midpoint between
when we first set up the renewal alarm and when the ticket expires.

Unfortunately, this doesn't work for kernel keyring based kerberos
tickets, since the alarms are reset on a regular interval (as part
of the polling process to check for updates, since kernel keyring
doesn't have changed notification). Since the alarms are reset
regularly, the midpoint converges toward the end of the ticket
lifetime.

Instead, we should consider the ticket start time, which remains
constant.  This commit tracks the ticket start time, and changes
the code renewal alarm to use the mid point between the start time
and expiration time of the ticket.
Comment 3 Luf 2015-10-14 07:59:04 UTC
Cool I wrote very similar patch yesterday and I wanted to file a bug report today :) Thanks for taking care of this.

I see two points:
1) credentials->times.starttime = credentials->times.authtime or at least use authtime as failback: http://web.mit.edu/kerberos/krb5-current/doc/appldev/refs/types/krb5_ticket_times.html#krb5_ticket_times (this mentions starttime is optional)
2) you should take into account also renew_till from credentials->times
Comment 4 Ray Strode [halfline] 2016-03-14 16:08:19 UTC
Created attachment 323890 [details] [review]
identity: rework how renewal time is calculated

Right now we try to renew the kerberos ticket at the midpoint between
when we first set up the renewal alarm and when the ticket expires.

Unfortunately, this doesn't work for kernel keyring based kerberos
tickets, since the alarms are reset on a regular interval (as part
of the polling process to check for updates, since kernel keyring
doesn't have changed notification). Since the alarms are reset
regularly, the midpoint converges toward the end of the ticket
lifetime.

Instead, we should consider the ticket start time, which remains
constant.  This commit tracks the ticket start time, and changes
the code renewal alarm to use the mid point between the start time
and renewal time of the ticket.
Comment 5 Ray Strode [halfline] 2016-03-14 16:09:16 UTC
Comment on attachment 313177 [details] [review]
identity: don't ignore almost all renewal requests

(pushing the first patch now, since it's small, and non-controversial)

Attachment 313177 [details] pushed as 09e1103 - identity: don't ignore almost all renewal requests
Comment 6 Ray Strode [halfline] 2016-03-14 16:13:40 UTC
Thanks Luf,  attachment 323890 [details] [review] incorporates your feedback.  I still need to some testing of it.
Comment 7 Debarshi Ray 2016-03-15 19:08:24 UTC
Review of attachment 323890 [details] [review]:

Submodule alert! This hunk is spurious:

diff --git a/telepathy-account-widgets b/telepathy-account-widgets
index eea6395..b838c54 160000
--- a/telepathy-account-widgets
+++ b/telepathy-account-widgets
@@ -1 +1 @@
-Subproject commit eea639500689a9d9cb52a22fd4788e735002acac
+Subproject commit b838c54c673165a9d948b18f21580a0ca94f8cd5
Comment 8 Ray Strode [halfline] 2016-03-15 19:14:23 UTC
eek, hate that.
Comment 9 Ray Strode [halfline] 2016-03-15 19:43:07 UTC
Created attachment 324042 [details] [review]
identity: rework how renewal time is calculated

Right now we try to renew the kerberos ticket at the midpoint between
when we first set up the renewal alarm and when the ticket expires.

Unfortunately, this doesn't work for kernel keyring based kerberos
tickets, since the alarms are reset on a regular interval (as part
of the polling process to check for updates, since kernel keyring
doesn't have changed notification). Since the alarms are reset
regularly, the midpoint converges toward the end of the ticket
lifetime.

Instead, we should consider the ticket start time, which remains
constant.  This commit tracks the ticket start time, and changes
the code renewal alarm to use the mid point between the start time
and renewal time of the ticket.
Comment 10 Ray Strode [halfline] 2016-03-29 20:18:36 UTC
Comment on attachment 324042 [details] [review]
identity: rework how renewal time is calculated

after doing some testing on this, i've discovered it needs some more work.
Comment 11 Ray Strode [halfline] 2016-03-30 19:33:31 UTC
So the scoop is that renew_till doesn't help us figure out a good time to renew.  The renew_till time will always, of course, be after the expiration date of the ticket, so the expiration time is all we need to look at to figure out a renewal time.  Knowing if the renew_till time is 0 or not, though, will tell use whether we should even bother trying to renew, so it's useful for that (though I guess we could have looked at the flags on the ticket too).

Will post an updated patch and push in the next day or too unless Luf or rishi want to give it a review.
Comment 12 Ray Strode [halfline] 2016-03-30 19:34:25 UTC
Created attachment 325044 [details] [review]
identity: don't reverify identity when doing update

At the moment, the way we refresh an identity is by creating a
new, fresh, transient identity, and then update the existing identity
instance with the state of the transient instance.

When the fresh identity is instantiated we validate its credentials,
and then immediately afterward, when the identity state is transferred
we revalidate the credentials, which is needless double work.

This commit changes goa_kerberos_identity_update to stop validiating
the credentials of the source identity, and instead just copy the
state over wholesale.
Comment 13 Ray Strode [halfline] 2016-03-30 19:34:35 UTC
Created attachment 325045 [details] [review]
identity: don't reset alarm if time unchanged

Right now we always reset the expiration alarm, any time
there is an update.

This commit changes the code to reset the alarm only if
the update resulted in the expiration time changing.
Comment 14 Ray Strode [halfline] 2016-03-30 19:34:44 UTC
Created attachment 325046 [details] [review]
identity: rework how renewal time is calculated

Right now we try to renew the kerberos ticket at the midpoint between
when we first set up the renewal alarm and when the ticket expires.

Unfortunately, this doesn't work for kernel keyring based kerberos
tickets, since the alarms are reset on a regular interval (as part
of the polling process to check for updates, since kernel keyring
doesn't have changed notification). Since the alarms are reset
regularly, the midpoint converges toward the end of the ticket
lifetime.

Instead, we should consider the ticket start time, which remains
constant.  This commit tracks the ticket start time, and changes
the code renewal alarm to use the mid point between the start time
and expiration time of the ticket. We also now only set a renewal
alarm if there's a valid renewal lifetime.
Comment 15 Ray Strode [halfline] 2016-04-11 15:47:29 UTC
Attachment 325044 [details] pushed as 1db6741 - identity: don't reverify identity when doing update
Attachment 325045 [details] pushed as 770732c - identity: don't reset alarm if time unchanged
Attachment 325046 [details] pushed as 684f588 - identity: rework how renewal time is calculated