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 646185 - Need to click "Unlock" to change timezone while I'm allowed to do it
Need to click "Unlock" to change timezone while I'm allowed to do it
Status: RESOLVED OBSOLETE
Product: gnome-control-center
Classification: Core
Component: Date and Time
3.14.x
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-03-30 05:30 UTC by Vincent Untz
Modified: 2021-06-09 16:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
datetime: Allow changing timezone without auth if action is allowed (3.58 KB, patch)
2012-03-12 14:34 UTC, Vincent Untz
rejected Details | Review
unlock timezone widget automatically if allowed by policy (3.50 KB, patch)
2013-04-20 15:40 UTC, Michael Catanzaro
none Details | Review
common: Ship a PolicyKit rule for the datetime panel (1.21 KB, patch)
2013-08-17 10:32 UTC, Kalev Lember
committed Details | Review
datetime: Allow changing the timezone if polkit says so (5.11 KB, patch)
2013-10-09 21:29 UTC, Bastien Nocera
reviewed Details | Review
datetime: Allow changing the timezone if polkit says so (5.19 KB, patch)
2013-10-10 00:54 UTC, Bastien Nocera
needs-work Details | Review
datetime: Allow changing the timezone if polkit says so (5.11 KB, patch)
2013-12-17 03:05 UTC, Michael Catanzaro
needs-work Details | Review
Patch rebased on current master d71f705d7 (4.84 KB, patch)
2018-01-18 15:25 UTC, Dominique Leuenberger
none Details | Review
datetime: Allow changing the timezone if polkit says so (5.21 KB, patch)
2018-01-23 15:15 UTC, Dominique Leuenberger
none Details | Review
datetime: Allow changing the timezone if polkit says so (5.24 KB, patch)
2018-01-26 13:12 UTC, Georges Basile Stavracas Neto
committed Details | Review

Description Vincent Untz 2011-03-30 05:30:32 UTC
My polkit configuration allows me to change my timezone without a password.

But the date & time panel apparently apparently only checks whether I can change the time or not without authentication to decide what is doable in the panel.

We should only add a check on whether changing the timezone without authentication is possible or not, to decide whether the timezone-related widgets are sensitive or not.
Comment 1 Matthias Clasen 2011-03-30 05:32:25 UTC
The design of the locked down panels is such that we can really only have a single privilege governing the entire content of the panel...
Comment 2 Vincent Untz 2011-03-30 05:43:49 UTC
(In reply to comment #1)
> The design of the locked down panels is such that we can really only have a
> single privilege governing the entire content of the panel...

Is it? I can change some personal details in the user panel. So at least it's possible to have some widgets which are sensitive even when the panel is locked.

Note that I'm not asking to have Unlock deal with more than one privilege. I'm just asking that on top of the current Unlock feature, the sensitivity of some widgets can be set based of another privilege.
Comment 3 Matthias Clasen 2011-03-31 13:03:58 UTC
I think what might work is to have some unprivileged, always-available controls on an otherwise locked-down page. Not sure about more complicated setups...
Comment 4 Vincent Untz 2012-03-12 14:34:48 UTC
Created attachment 209486 [details] [review]
datetime: Allow changing timezone without auth if action is allowed

As changing the time can have security implications, while changing the
timezone doesn't, it's not unusual to have a setup where
org.freedesktop.timedate1.set-timezone is allowed while other
time-related actions aren't.

Therefore, if org.freedesktop.timedate1.set-timezone is allowed, there's
no reason to require that the user unlocks the panel to enable him to
change the timezone.
Comment 5 Bastien Nocera 2012-03-12 14:45:58 UTC
No, we need to install a file that'll take care of _all_ the permissions at once when we click "unlock".

See bug 665671
Comment 6 Vincent Untz 2012-03-12 15:00:33 UTC
(In reply to comment #5)
> No, we need to install a file that'll take care of _all_ the permissions at
> once when we click "unlock".

Huh, no. This is already done for the date & time panel. And this is not what this bug is about: currently, I'm required to authenticate with a root password to change the timezone via this Unlock button, while I don't need to authenticate at all to change the timezone. This is broken, as that's an action that we need quite often (as opposed to changing the time, which isn't needed that often).
Comment 7 Vincent Untz 2012-05-25 12:54:20 UTC
For the record, we'll ship this patch in openSUSE.
Comment 8 Dominique Leuenberger 2012-07-01 13:10:54 UTC
This patch indeed works good.
It allows the timezone to be changed by a traveling non-root user.. really annoying to not have the right time visible.

The 'unlock' button is not affected, as it keeps on unlocking all features. This patch simply allows to have a polkit rule allowing to set the timezone independently...
Comment 9 Michael Catanzaro 2013-04-20 15:40:52 UTC
Created attachment 242006 [details] [review]
unlock timezone widget automatically if allowed by policy

We in openSUSE would appreciate another review of this patch - it got disabled in openSUSE recently and it was quickly missed. The attached version applies cleanly on master. The only effect of this patch is to make the timezone settings available regardless of whether or not the panel is locked if org.freedesktop.timedate1.set-timezone is set to 'yes' (which is the default in openSUSE); if that permission isn't available to the current user (the upstream default is 'auth-admin-keep'), then nothing is changed (i.e. the lock button will still lock/unlock the timezone widget, as before, if this permission is unavailable).
Comment 10 Kalev Lember 2013-08-17 10:32:02 UTC
I too would rather avoid making the permission setup more complicated than it already is. Having a single unlock button for the whole panel makes it easy to understand for the users, and keeps the code simple.

But this doesn't mean we can't improve the situation!

At the System Settings hackfest at GUADEC, we talked about letting local admins use the whole Date & Time panel without a password. Attaching a patch that implements this.
Comment 11 Kalev Lember 2013-08-17 10:32:59 UTC
Created attachment 251990 [details] [review]
common: Ship a PolicyKit rule for the datetime panel

Allow local admins with an active session use the Date & Time panel
without requiring a password.
Comment 12 Michael Catanzaro 2013-08-17 15:09:24 UTC
Thanks a bunch for looking at this, Kalev!

(In reply to comment #10)
> I too would rather avoid making the permission setup more complicated than it
> already is. Having a single unlock button for the whole panel makes it easy to
> understand for the users, and keeps the code simple.

Well Vincent's patch doesn't add a new unlock button or anything complicated like that: it just changes whether the timezone widget is affected by the existing unlock button.  Since the datetime panel is going to use timedated to change the timezone, it shouldn't require a password to change the timezone if timedatectl does not.  (My reasoning is that it's silly to prevent the user from changing the timezone from a graphical interface when he has permission to do so from the command line.)  The change is that the timezone widget is sensitive from the start, just like the AM/PM toggle.  (But if unprivileged users cannot change the timezone with timedatectl, then it's still affected by the unlock button, and there is no change from the current code.  So this patch makes no difference in Fedora, where only an admin can change the timezone.)

The logical extreme of this reasoning would be checking every permission to see what's sensitive by default.  I don't know if that's a good idea, but it doesn't seem worse than having weird, separate command-line and GUI permissions.

> But this doesn't mean we can't improve the situation!
> 
> At the System Settings hackfest at GUADEC, we talked about letting local admins
> use the whole Date & Time panel without a password. Attaching a patch that
> implements this.

That sounds like a good idea to me.  (My worry is that if some timedated policies are set to auth-admin-keep, I think the dbus call would fail, but if it works then great.)

I think openSUSE will probably decide to keep carrying this patch anyway, as they want all users to be able to change the timezone [1], and without this patch that's not possible without dropping to the command line to use timedatectl.  I'm not going to condone Linus's language, but he has a point.

[1] http://www.zdnet.com/blog/open-source/linus-torvalds-snarls-at-opensuse-desktop-linuxs-security/10475
Comment 13 Dominique Leuenberger 2013-08-19 07:03:33 UTC
(In reply to comment #11)
> Created an attachment (id=251990) [details] [review]
> common: Ship a PolicyKit rule for the datetime panel
> 
> Allow local admins with an active session use the Date & Time panel
> without requiring a password.

Kalev,

I think we need to take into account that setting date/time has an entire different effect on the system as compared to 'setting timezone'.

If you change your date/time settings for example (to wrong values), kerberos auth is likely to break and depending how far off you go, TLS/ verification fails as well.

TimeZone is mostly a 'display' issue: if a user is traveling from Europe to the US, it's just 'nice' if his panel clock can show the right time; As with openSUSE's patch, the user can chose the timezone (if permitted by the polkit settings), yet, can not break actual time/date settings.

The UI itself is not further cluttered with buttons; the only difference is that the 'MAP' is active when permitted; the rest becomes active when one clicks 'UNLOCK' and presents the right password.
Comment 14 Rui Matos 2013-08-19 15:55:30 UTC
Review of attachment 251990 [details] [review]:

This looks good and it's the way we are handling it in the region panel already. In general I think we should never show these unlock buttons for admin user accounts.
Comment 15 Kalev Lember 2013-08-19 16:10:45 UTC
Comment on attachment 251990 [details] [review]
common: Ship a PolicyKit rule for the datetime panel

Attachment 251990 [details] pushed as 88eeb8c - common: Ship a PolicyKit rule for the datetime panel
Comment 16 Mark Smith 2013-09-08 20:05:03 UTC
I think this is a bad idea. Currently, sudo uses the clock to manage security based on a timeout. At the very least, I would hold off on this change until sudo uses some other method to manage the timeout. See ubuntu bug 1219337 for reference.

There are tons of things that rely on the clock. How often are you changing the clock/timezone that typing your password one extra time is a problem? If you want to have a package that lets you turn this policy on, or a setting or something, fine. Please don't make this the default!
Comment 17 Dominique Leuenberger 2013-09-08 20:08:48 UTC
(In reply to comment #16)
> There are tons of things that rely on the clock. How often are you changing the
> clock/timezone that typing your password one extra time is a problem? If you
> want to have a package that lets you turn this policy on, or a setting or
> something, fine. Please don't make this the default!

On  YOUR machine you might know the root password. People in my company that are traveling around the world, do not.

YET: they should be able to adjust the TIME ZONE (NOT THE TIME) on their system representing their local time (there is a reason why the two are different polkit rules).
Comment 18 Mark Smith 2013-09-08 20:34:01 UTC
I'm not saying "make it impossible for them to change the time."  I'm saying, require authentication, even if it's the users own password. Put them in a group that can change the clock, but still have them authenticate. That's the point of groups, isn't it? If this becomes the default, tons of systems that use sudo will suddenly become vulnerable.
Comment 19 Michael Catanzaro 2013-09-08 21:19:18 UTC
Unfortunately the openSUSE patch doesn't really make sense anymore, now that the panel is divided in two between rows covered by the lock and rows that are not covered.  I don't think it makes sense to modify the UI upstream to support non-upstream configuration.  I guess the only path forward for this would be if systemd were to change the default policy of org.freedesktop.timedate1.set-timezone, then we could adjust the UI accordingly.

(In reply to comment #17)
> YET: they should be able to adjust the TIME ZONE (NOT THE TIME) on their system
> representing their local time (there is a reason why the two are different
> polkit rules).

He's talking about the patch to gnome-control-center.rules (which is dropped in openSUSE) allowing local admins to change all time settings without typing a password.

(In reply to comment #18)
> I'm not saying "make it impossible for them to change the time."  I'm saying,
> require authentication, even if it's the users own password. Put them in a
> group that can change the clock, but still have them authenticate. That's the
> point of groups, isn't it? If this becomes the default, tons of systems that
> use sudo will suddenly become vulnerable.
This can only be exploited by a local user, and only if you leave your computer unlocked while you're away, or if he physically attacks you.  I guess it's not totally implausible if you have secret agents or corporate spies after you....
Comment 20 Mark Smith 2013-09-08 21:36:44 UTC
Linux is used in several industries where corporate spies are a very real threat. Again, I'm not saying don't let users change their timezone or time/date. I'm saying *make them type their password first*.  Put them in a group that is allowed to change timezone, and force them to authenticate, just like they'd have to to log in, or to change their password, or to perform any number of other tasks that could have an effect on security.
Comment 21 Gerald Pfeifer 2013-09-08 22:06:32 UTC
(In reply to comment #20)
> Linux is used in several industries where corporate spies are a very real
> threat. Again, I'm not saying don't let users change their timezone or
> time/date. I'm saying *make them type their password first*. 

Security that relies on the time_zone_ of a system is broken by design.

The GNOME 2 world clock nicely allowed for showing both a number of
timezones and easily switching to one.  With GNOME 3, right now I have
to enter the root password a couple number of times when going to the 
US, say.  Often surrounded by many people at an airport or similar.

(And having a nice overview and way of switching is gone with GNOME 3,
but that's a related, but different issue.)
Comment 22 Mark Smith 2013-09-08 22:17:31 UTC
> Security that relies on the time_zone_ of a system is broken by design.

You bet! That's why I've submitted bugs to that effect. But that's not really the point here.

You can certainly make changes via policykit that lets you change the clock without having to type your password on your machine, if you want. Your use case, however, doesn't apply to all users. If you want to change your security policy, by all means do so! Create an option to turn this feature on even! But PLEASE don't saddle every user with an insecure clock by default.
Comment 23 Bastien Nocera 2013-10-09 16:11:14 UTC
This is fixed in GNOME 3.10. Administrators (see gnome-control-center.rules) can modify the date & time without entering a password.
Comment 24 Dominique Leuenberger 2013-10-09 18:28:02 UTC
:(
too sad nobody seems to undderstand that changing timezone does not mean changing time...
Comment 25 Bastien Nocera 2013-10-09 21:29:23 UTC
Created attachment 256853 [details] [review]
datetime: Allow changing the timezone if polkit says so

Even if we don't have all the permissions necessary for all
the actions, check whether the user is allowed to change the timezone
before making those rows insensitive.
Comment 26 Bastien Nocera 2013-10-09 21:38:12 UTC
Is that more to your liking? You'll need to test it.
Comment 27 Michael Catanzaro 2013-10-10 00:10:43 UTC
Review of attachment 256853 [details] [review]:

Thanks for looking into this.  Unfortunately with the redesigned panel, simply setting the sensitivity of the timezone options is no longer enough: they now also have to be moved from the set of initially-locked options on top to the set of initially-unlocked options (currently just Time Format) below.  I'm not sure that determining the placement of the options at runtime is reasonable. See the first part of comment #19 above.

::: panels/datetime/cc-datetime-panel.c
@@ +784,2 @@
   allowed = (priv->permission == NULL || g_permission_get_allowed (priv->permission));
+  tz_allowed = (priv->tz_permission == NULL && g_permission_get_allowed (priv->tz_permission));

The call to g_permission_get_allowed (priv->tz_permission) will always crash (since this condition guarantees the permission to be NULL).

@@ +935,3 @@
+  active = g_value_get_boolean (source_value);
+  allowed = (priv->permission == NULL && g_permission_get_allowed (priv->permission)) ||
+            (priv->tz_permission == NULL && g_permission_get_allowed (priv->tz_permission));

Two more crashes, same as above
Comment 28 Bastien Nocera 2013-10-10 00:54:11 UTC
(In reply to comment #27)
> Review of attachment 256853 [details] [review]:
> 
> Thanks for looking into this.  Unfortunately with the redesigned panel, simply
> setting the sensitivity of the timezone options is no longer enough: they now
> also have to be moved from the set of initially-locked options on top to the
> set of initially-unlocked options (currently just Time Format) below.  I'm not
> sure that determining the placement of the options at runtime is reasonable.

The placement is nothing to do with whether they're initially locked or unlocked. Otherwise, it would look different if you log in as an admin.

Fixed the thinko in the attached patch, let me know if it works.
Comment 29 Bastien Nocera 2013-10-10 00:54:28 UTC
Created attachment 256867 [details] [review]
datetime: Allow changing the timezone if polkit says so

Even if we don't have all the permissions necessary for all
the actions, check whether the user is allowed to change the timezone
before making those rows insensitive.
Comment 30 Michael Catanzaro 2013-10-13 14:00:35 UTC
I'll test the patch the new patch shortly, thanks.

(In reply to comment #28)
> The placement is nothing to do with whether they're initially locked or
> unlocked. Otherwise, it would look different if you log in as an admin.

The "problem" I saw was that the unlocked rows look really stupid when the rest of the rows in that "box" of options are locked.  A couple of days ago this seemed insurmountable to me, but all we have to do is move the two timezone options to a third box, so not really....
Comment 31 Michael Catanzaro 2013-10-13 23:30:52 UTC
Review of attachment 256867 [details] [review]:

Honestly it looks fine visually (we already do this for NTP and the normal time setting); just ignore my complaints above.

I was able to get this patch to work as expected with minimal tweaking.  Thanks a bunch.

::: panels/datetime/cc-datetime-panel.c
@@ +784,2 @@
+  allowed = (priv->permission != NULL || g_permission_get_allowed (priv->permission));
+  tz_allowed = (priv->tz_permission != NULL && g_permission_get_allowed (priv->tz_permission));

Bastien could you look at these two lines closely?  Line 784 is a potential crash.  They should both either be

(priv->permission == NULL || g_permission_get_allowed (priv->permission)) 

which I think means "no permissions installed, go right ahead", as is currently in master, or else

(priv->permission != NULL && g_permission_get_allowed (priv->permission))

like you did for the timezone permission ("no permission installed, everything is insensitive.")  Either way works.

If the original permission line is changed, that should be done in a separate patch, and it would need to be changed in the original switch_to_row_transform_func as well.  Otherwise, the timezone permissions at line 936 need changed.

@@ +935,3 @@
+  active = g_value_get_boolean (source_value);
+  allowed = (priv->permission != NULL && g_permission_get_allowed (priv->permission)) ||
+            (priv->tz_permission != NULL && g_permission_get_allowed (priv->tz_permission));

See above

@@ +1317,3 @@
                  DATETIME_PERMISSION);
     }
+  priv->tz_permission = polkit_permission_new_sync (DATETIME_TZ_PERMISSION, NULL, NULL, NULL);

This line needs to be moved above the if statement so that the permission is set before entering on_permission_changed.
Comment 32 Michael Catanzaro 2013-12-17 03:05:54 UTC
Created attachment 264384 [details] [review]
datetime: Allow changing the timezone if polkit says so

Bastien's patch, modified according to my review above. I went with (priv->permission == NULL || g_permission_get_allowed (priv->permission)) to match the existing code.
Comment 33 Dominique Leuenberger 2014-11-06 15:13:46 UTC
FWIW: the patch from Dec 2013  (comment 32) works just fine; Would be great if this were to be merged at one point.
Comment 34 Georges Basile Stavracas Neto 2018-01-18 14:33:41 UTC
Review of attachment 264384 [details] [review]:

This patch does not apply on top of master. Is it still relevant? If not, can we close this bug?
Comment 35 Gerald Pfeifer 2018-01-18 15:05:36 UTC
It appears that with GNOME 3.26 I can now change the timezone, even
without being able to change the time (which does require unlocking
the panel).

So... RESOLVED FIXED?
Comment 36 Dominique Leuenberger 2018-01-18 15:09:20 UTC
(In reply to Gerald Pfeifer from comment #35)
> It appears that with GNOME 3.26 I can now change the timezone, even
> without being able to change the time (which does require unlocking
> the panel).
> 
> So... RESOLVED FIXED?

Careful: I'm sure you tested on openSUSE with patch!
Comment 37 Dominique Leuenberger 2018-01-18 15:10:47 UTC
(In reply to Dominique Leuenberger from comment #36)
> (In reply to Gerald Pfeifer from comment #35)
> > It appears that with GNOME 3.26 I can now change the timezone, even
> > without being able to change the time (which does require unlocking
> > the panel).
> > 
> > So... RESOLVED FIXED?
> 
> Careful: I'm sure you tested on openSUSE with patch!

https://build.opensuse.org/package/view_file/openSUSE:Factory/gnome-control-center/gnome-control-center-follow-polkit-permissions-for-tz.patch?expand=1

(that patch no longer applies on master and would need to be rebased - again)
Comment 38 Dominique Leuenberger 2018-01-18 15:25:24 UTC
Created attachment 367022 [details] [review]
Patch rebased on current master d71f705d7
Comment 39 Georges Basile Stavracas Neto 2018-01-21 14:06:18 UTC
Review of attachment 367022 [details] [review]:

The code makes sense to me, but I'm not looped in the guts of changing dates and times and zones. The commit message should have explained why this is necessary.

If you could write the reasoning on the commit message, and no one opposes to this change, I'll push it. The patch will be in 'needs-work' state until there.

Thanks for the patch!
Comment 40 Gerald Pfeifer 2018-01-21 19:16:32 UTC
(In reply to Dominique Leuenberger from comment #36)
> Careful: I'm sure you tested on openSUSE with patch!

Yes, you're right. (And it's really convenient and user friendly.)
Comment 41 Dominique Leuenberger 2018-01-23 15:15:40 UTC
Created attachment 367318 [details] [review]
datetime: Allow changing the timezone if polkit says so

As changing the time can have security implications, while changing the
timezone doesn't, it's not unusual to have a setup where
org.freedesktop.timedate1.set-timezone is allowed while other
time-related actions aren't.

Therefore, if org.freedesktop.timedate1.set-timezone is allowed, there's
no reason to require that the user unlocks the panel to enable him to
change the timezone.
Comment 42 Dominique Leuenberger 2018-01-23 15:16:23 UTC
(In reply to Georges Basile Stavracas Neto from comment #39)
> Review of attachment 367022 [details] [review] [review]:
> 
> The code makes sense to me, but I'm not looped in the guts of changing dates
> and times and zones. The commit message should have explained why this is
> necessary.

Added the description from comment #4, which sums it up very well, to the commit message
Comment 43 Bastien Nocera 2018-01-23 15:24:26 UTC
(In reply to Dominique Leuenberger from comment #41)
> Created attachment 367318 [details] [review] [review]
> datetime: Allow changing the timezone if polkit says so
> 
> As changing the time can have security implications,

Mention which one (password expiry I'm guessing?).

> while changing the
> timezone doesn't, it's not unusual to have a setup where
> org.freedesktop.timedate1.set-timezone is allowed while other
> time-related actions aren't.
> 
> Therefore, if org.freedesktop.timedate1.set-timezone is allowed, there's
> no reason to require that the user unlocks the panel to enable him to

"no reason to require that the user unlock their panel to enable them to"

singular "them", or feminine here.

> change the timezone.

> allowed = (self->permission != NULL && g_permission_get_allowed (self->permission)) ||
>    (self->tz_permission != NULL && g_permission_get_allowed (self->tz_permission));

Given that the top-level permission implies the more precise one, I'd just check for the more precise one, no?
Comment 44 Georges Basile Stavracas Neto 2018-01-26 13:12:43 UTC
Created attachment 367477 [details] [review]
datetime: Allow changing the timezone if polkit says so

Updated the commit message. I'll accept it as is, but leave the bug open so that Bastien's comment about the toplevel permission is addressed (either by answering or by throwing another patch.)
Comment 45 Georges Basile Stavracas Neto 2018-01-26 13:14:21 UTC
Comment on attachment 367477 [details] [review]
datetime: Allow changing the timezone if polkit says so

Leaving the ticket open as commented.

Attachment 367477 [details] pushed as 5a66372 - datetime: Allow changing the timezone if polkit says so
Comment 46 André Klapper 2021-06-09 16:25:53 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new bug report at
  https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/

Thank you for your understanding and your help.