Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
interfaces/builtin: support time and date settings via 'org.freedesktop.timedate1 #1832
Conversation
stolowski
added some commits
Sep 1, 2016
zyga
reviewed
Sep 2, 2016
| + member="Set{Time,Timezone,LocalRTC,NTP}" | ||
| + peer=(label=unconfined), | ||
| + | ||
| +dbus (receive, send) |
stolowski
Sep 2, 2016
Contributor
Fair point. receive is needed for property change signals (and only for them) and it was a little bit too lenient. I've split this block into two and added comments - property change signals need 'receive', Get & GetAll need 'send'.
zyga
reviewed
Sep 2, 2016
| +// NewTimeDateControlInterface returns a new "time-date-control" interface. | ||
| +func NewTimeDateControlInterface() interfaces.Interface { | ||
| + return &commonInterface{ | ||
| + name: "time-date-control", |
zyga
Sep 2, 2016
Contributor
This is inconsistent with the file name, either call the module time_data_control.go or rename the interface to timedate-control.
|
Please document this interface so that we know what it allows to do (in I have one question about apparmor, please ask @jdstrand for a review after you know the answer to my question. |
stolowski
added some commits
Sep 2, 2016
|
@zyga I've added a short doc and made it auto-connect. I'm not sure however about the making it 'reserved', is it about marking it reservedForOs (which it is already)? |
|
Needs conflict solving, and a review from @jdstrand. LGTM other than that. |
niemeyer
changed the title from
Added time-date-control interface for org.freedesktop.timedate1
to
interfaces/builtin: time-date-control for org.freedesktop.timedate1
Sep 19, 2016
stolowski
added some commits
Sep 20, 2016
jdstrand
requested changes
Sep 22, 2016
I think this PR should be renamed as "support time and date settings via 'org.freedesktop.timedate1" and you should add the timedate-control interface (please rename from time-date-control to timedate-control) and update the timezone-control and timeserver-control as described (each should work without the others, so add the seccomp and dbus introspection rules to all 3).
| + bus=system | ||
| + path=/org/freedesktop/timedate1 | ||
| + interface=org.freedesktop.timedate1 | ||
| + member="Set{Time,Timezone,LocalRTC,NTP}" |
jdstrand
Sep 22, 2016
•
Contributor
We already have the timeserver-control interface for NTP. NTP calls should be moved there.
We already have the timezone-control interface for adjusting TZ. TZ calls should be moved there.
SetTime and SetLocalRTC can remain here.
| + path=/org/freedesktop/timedate1 | ||
| + interface=org.freedesktop.DBus.Properties | ||
| + member=PropertiesChanged | ||
| + peer=(label=unconfined), |
jdstrand
Sep 22, 2016
Contributor
Unfortunately we can't mediate on method data and systemd only provides Get methods for properties, so you'll need to have these two rules in timezone-control and timeserver-control. This means that all the time* interfaces will be able to read each others properties, but at least they won't be able to Set them.
| + connectedPlugAppArmor: timeDateControlConnectedPlugAppArmor, | ||
| + connectedPlugSecComp: timeDateControlConnectedPlugSecComp, | ||
| + reservedForOS: true, | ||
| + autoConnect: true, |
jdstrand
Sep 22, 2016
Contributor
Adjusting the time on a system is a privileged action and this should not autoconnect.
|
'time-control' is probably a better name than timedate-control. Will want @niemeyer to weigh in on that. |
stolowski
added some commits
Sep 23, 2016
stolowski
changed the title from
interfaces/builtin: time-date-control for org.freedesktop.timedate1
to
interfaces/builtin: support time and date settings via 'org.freedesktop.timedate1
Sep 23, 2016
|
@jdstrand Thanks for the review, I have followed your suggestions and moved some permissions to the other interfaces. All interfaces have permissions to read the properties as well as to introspect timedate1 object. |
| + PanicMatches, `plug is not of interface "timedate-control"`) | ||
| +} | ||
| + | ||
| +func (s *TimeDateControlTestInterfaceSuite) TestUnusedSecuritySystems(c *C) { |
zyga
Sep 23, 2016
Contributor
Let's drop this test please. We just concluded a large simplification where those tests were axed.
stolowski
added some commits
Sep 25, 2016
jdstrand
reviewed
Sep 26, 2016
+1 on security policy changes. Please adjust docs/interfaces.md and implicit.go
I think that 'time-control' would be a nicer name for this interface. @niemeyer, can you comment on if you prefer 'timedate-control' or 'time-control' (or something else)?
| +### timedate-control | ||
| + | ||
| +Can modify time/date exposed via D-Bus by systemd-timedated and read all | ||
| +all properties of /org/freedesktop/timedate1 D-Bus object. |
jdstrand
Sep 26, 2016
Contributor
Can we rephrase this to be:
Can set system time and date and query systemd-timedated for time information.
It's possible we may allow setting the time or the date in other ways (eg, like we do with timezone-control and timeserver-control).
| +all properties of /org/freedesktop/timedate1 D-Bus object. | ||
| + | ||
| +* Auto-Connect: yes | ||
| + | ||
| ### timeserver-control | ||
| Can manage timeservers directly separate from ``config core``. |
jdstrand
Sep 26, 2016
Contributor
Can you update this to be:
Can manage timeservers via systemd-timedated and directly separate from ``config core``
### timezone-control
Can manage timezone via systemd-timedated and directly separate from ``config core``
* Auto-Connect: no
In other words, update timeserver-control to reference systemd-timedated and add timezone-control.
stolowski
Sep 29, 2016
Contributor
@jdstrand apologies for forgetting about this change, I'll address it in a separete PR.
| @@ -54,6 +54,7 @@ var implicitSlots = []string{ | ||
| "timezone-control", | ||
| "tpm", | ||
| "kernel-module-control", | ||
| + "timedate-control", |
|
Note that I approved the changes you made, but still request further changes (using github's 'comment' mechanism instead of 'request changes' to avoid blocking on me). |
|
+1 on |
niemeyer
added
the
Reviewed
label
Sep 27, 2016
|
"+1 on time-control if we intend this interface to remain intermediating the ability to set the time even if we change the backend." Yes this is the intent. In this manner it is similar to timezone-control and timeserver-control. @stolowski - we now have agreement. Please rename to 'time-control' and I can do the final review. |
stolowski
added some commits
Sep 28, 2016
niemeyer
merged commit 677ed08
into
snapcore:master
Sep 28, 2016
1 check passed
|
FYI, the request to add |
stolowski commentedSep 2, 2016
•
Edited 1 time
-
stolowski
Sep 23, 2016
Added new timedate-control interface and updated two existing interfaces: timeserver-control and timezone-control to allow access to respective parts of systemd' org.freedesktop.timedate1 interface (lp #1616052).
The test shamelessly stolen from unity7_test.go.
Tested introspection and a property getter manually with:
$ timedatetest.gdbus introspect --system --dest org.freedesktop.timedate1 --object-path /org/freedesktop/timedate1
$ timedatetest.gdbus call --system --dest org.freedesktop.timedate1 --object-path /org/freedesktop/timedate1 --method org.freedesktop.DBus.Properties.Get "org.freedesktop.timedate1" "Timezone"
with the following simple snap:
name: timedatetest
version: 1.0
summary: A test
description: A test
apps:
gdbus:
command: usr/bin/gdbus
plugs: [timedate-control]
parts:
gdbus:
plugin: nil
stage-packages:
- libglib2.0-bin