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: add evolution interfaces #2226
Conversation
niemeyer
requested changes
Oct 28, 2016
Haven't gone in detail through the interface, but a few early comments:
- Rather than an attribute saying which services one is trying to access, these should most likely be two independent interfaces
- We need a more descriptive name for this interface. On a quick read, "evolution-calendar" and "evolution-address-book" might be candidates
niemeyer
changed the title from
Eds
to
interfaces/builtin: add evolution interfaces
Oct 28, 2016
niemeyer
added
the
Blocked
label
Oct 28, 2016
renatofilho
commented
Oct 28, 2016
|
I have been discussing about this interface with @jdstrand, our current idea is to have an interface named: unity8-pim, which contains all services related with contact and calendar, including "sync" services. We need to provide interfaces to access: EDS - [contact, calendar] What do you think about that? |
|
@niemeyer - as @renatofilho said, we've discussed this a bit. As proposed, this interface should be renamed 'unity8-pim' because all the policy and accesses for it are for using Unity8 application APIs that simply happen to use eds under the hood. Furthermore, the various sync services are specific to Unity8 and only cover the parts of eds that Unity8 cares about. In other words, this is not a general-purpose 'evolution-contacts' or 'evolution-calendar' interface. In fact, I prefer this under 'unity8-*'[1] to leave the door open for proper 'evolution-contacts' or 'evolution-calendar' interfaces down the line (again, instead of this interface which is very limited). An argument can be made to split out the various interfaces that @renatofilho mentioned (I'll provide possible names to demonstrate what this might look like):
That said, unity8-pim with attributes like this PR is trying to do seems more aligned with the Ubuntu Personal Unity8 implementation in that the slot implementation shares the same backend currently (eds) and breaking out the sync functionality seems somewhat strained and the Unity8 implementation views all of these as a unit (which suggests a single interface). An alternative middle ground might be to do:
I'm going to defer looking at this PR further until we decide on the name of the interface(s). [1] note that I am advocating for 'unity8-' for naming unity8/ubuntu personal interfaces unless the interface is general and not unity8-specific. |
|
Looking at the interface, I still don't quite understand why this isn't a straightforward break out of interface based on the functionality offered, just like every other case we have. For example, This is not even about unity8, apparently. |
renatofilho
commented
Nov 22, 2016
•
|
I do not mind splitting it in several interfaces. My proposal following this idea is: [Calendar] [Contacts] [Sync] @jdstrand what do you think about that? |
If you change the service, you use another interface. It doesn't make much sense to allow people to talk to the evolution service under a unity8 name, and then break every old software that depended on that interface to talk to evolution because unity8 picked something else. |
|
And by "change the interface" I really mean "use another interface" (fixed comment above). |
|
@niemeyer fyi, in the case of unity8, the applications themselves aren't programming to evolution-- they are programming to qtubuntu APIs that happen to use evolution under the hood to call out to evolution over dbus. AIUI, the qtubuntu folks want the flexibility to change out the backend if they need to. |
|
@renatofilho - honestly if we were to break these out into evolution-* then I think I would prefer unity8-evolution-* instead since the evolution that you are providing via qtubuntu may not be compatible with an evolution that gnome would provide. That gets somewhat complicated though since the dbus apis are likely very similar, yet different and I doubt that a slot implementation of unity8-evolution-* and a slot implementation of evolution-* would be coinstallable. Conversely, I doubt that a unity8 plugging app would work with another slot implementation of evolution-*. |
|
That sounds problematic on itself. Having dbus evolution interfaces that disagree with what evolution itself does would make me pretty upset if I was an evolution developer. Is that really what's going on? |
renatofilho
commented
Nov 22, 2016
|
@jdstrand yes if we are using evolution-* we need somehow specify the version, since this DBUS API is private and they change it a lot. |
renatofilho
commented
Nov 22, 2016
|
@niemeyer, to give you a bit more of context. Yes the EDS DBUS API change a lot (this is a private API), the docs says to never uses that, instead use the glib client library and that one we are using on QtContacts/QtOrganizer implementation. About ubuntu applications: All apps uses QContacts/QtOrganizer API. The code looks like that: QContactManager mrg; |
renatofilho
commented
Nov 24, 2016
|
Yes, let's please go with unity8-contacts and unity8-calendar then, as suggested by @jdstrand. I still don't understand the "sync" distinction, though. Why would that be a separate setting or interface? Isn't that giving access to the exact same data for read/write than the interfaces above would already give alone? The fact the API is different doesn't matter much.. the question is what is being written to or read from, isn't it? |
renatofilho
commented
Nov 25, 2016
•
|
@niemeyer about the sync. The idea is to keep it apart because the apps should not be allowed to sync. The sync itself will be done by the system core (push notifications, interval based, etc..). But since our push notification does not support any of our services (google, owncloud, etc..), as workaround we are allowing the apps to request syncs, this way the user can request a sync from the server. Today local changes are intercepted by the system and trigger a new sync, but remote changes are not notified to our local system and the user needs to manually ask for a sync. Bug related with that: https://bugs.launchpad.net/ubuntu/+source/address-book-app/+bug/1319546 |
zyga
requested changes
Dec 1, 2016
There are a few fixes you should make. I've suggested them inline. When you are done please also merge master into your branch to make sure we carry any other fixes that might prevent this from working.
| @@ -82,5 +82,6 @@ func (s *AllSuite) TestInterfaces(c *C) { | ||
| c.Check(all, DeepContains, builtin.NewTpmInterface()) | ||
| c.Check(all, DeepContains, builtin.NewUPowerObserveInterface()) | ||
| c.Check(all, DeepContains, builtin.NewUnity7Interface()) | ||
| + c.Check(all, DeepContains, builtin.NewUnity8CalendarInterface()) |
| @@ -473,7 +475,7 @@ func (s *baseDeclSuite) TestConnection(c *C) { | ||
| "location-observe": true, | ||
| "lxd": true, | ||
| "mir": true, | ||
| - "udisks2": true, | ||
| + "udisks2": true, |
| + name: "unity8-calendar", | ||
| + permanentSlotAppArmor: unity8CalendarPermanentSlotAppArmor, | ||
| + connectedPlugAppArmor: unity8CalendarConnectedPlugAppArmor, | ||
| + permanentSlotDBus: unity8CalendarPermanentSlotDBus, |
zyga
Dec 1, 2016
Contributor
Feels like this needs the reservedForOS: true flag as this is just about the client side.
renatofilho
Dec 1, 2016
In fact this is the declaration of the slot and the interface. If you take a close look you will see that I am returning a "unity8PimInterface" instance and not the common interface.
| + name: "unity8-contacts", | ||
| + permanentSlotAppArmor: unity8ContactsPermanentSlotAppArmor, | ||
| + connectedPlugAppArmor: unity8ContactsConnectedPlugAppArmor, | ||
| + permanentSlotDBus: unity8ContactsPermanentSlotDBus, |
zyga
Dec 1, 2016
Contributor
Feels like this needs the reservedForOS: true flag as this is just about the client side.
| @@ -63,6 +63,10 @@ | ||
| "revisionTime": "2015-07-22T06:53:40Z" | ||
| }, | ||
| { | ||
| + "path": "github.com/path/of/dependency", |
renatofilho
commented
Dec 2, 2016
|
changes are ready for review again. |
jdstrand
requested changes
Dec 5, 2016
Can you explain how unity8-pim relates to unity8-calendar and unity8-contacts? I was expecting only these two and not unity8-pim....
| + name="org.gnome.evolution.dataserver.Calendar7", | ||
| +dbus (bind) | ||
| + bus=session | ||
| + name=org.gnome.evolution.dataserver.Subprocess.Backend.*, |
jdstrand
Dec 5, 2016
Contributor
What is the '.*' referring to here? As written, it doesn't seem specific to calendar.
renatofilho
Dec 5, 2016
Evolution export several services with name like "org.gnome.evolution.dataserver.Subprocess.Backend.Calendarx6605x2"
jdstrand
Dec 5, 2016
Contributor
Can you then use this instead: name=org.gnome.evolution.dataserver.Subprocess.Backend.Calendar*?
| + bus=session | ||
| + path=/org/gnome/evolution/dataserver/Subprocess/** | ||
| + interface=org.freedesktop.DBus.*, | ||
| +` |
jdstrand
Dec 5, 2016
Contributor
I think nearly all of these should be moved to ConnectedSlotAppArmor. In snappy, we mediate both what slot implementations the client can connect to (ConnectedPlug) and what clients the slot implementation can connect to (ConnectedSlot). PermanentSlot policy should only contain enough policy so that the service may start listening for clients. As such, please rework these rules into ConnectedSlotAppArmor, using ###PLUG_SECURITY_TAGS###. There are plenty of examples in interfaces/builtin/* to get you started.
| + bus=session | ||
| + path=/synchronizer{,/**} | ||
| + peer=(label=unconfined), | ||
| +` |
jdstrand
Dec 5, 2016
Contributor
These will only work for classic systems where eds is shipped as a deb (ie, peer=(label=unconfined) says that the connected client can connected to any unconfined process that uses these paths/interfaces/methods/etc).
Is this interface expected to work on classic systems? If so, then you'll want to move these unconfined rules to unity8CalendarConnectedPlugAppArmor. See the ofono interface for an example.
Please adjust unity8CalendarConnectedPlugAppArmor to use ###SLOT_SECURITY_TAGS### for the peer label (again, the ofono interface can by a guide).
| + <allow send_interface="org.gnome.evolution.dataserver.Calendar"/> | ||
| + <allow send_interface="org.gnome.evolution.dataserver.CalendarView"/> | ||
| + <allow send_interface="org.gnome.evolution.dataserver.CalendarFactory"/> | ||
| +` |
jdstrand
Dec 5, 2016
Contributor
This is problematic-- the dbus interface is meant for system bus policy, but eds is a session service. I'm not sure how to advise here since snappy session services have not been designed yet....
jdstrand
Dec 14, 2016
Contributor
The dbus backend is currently for the system bus, but you have only 'bus=session' rules. As such, please remove use of this backend for now. This can be updated when tvoss/the Personal team update snapd for session services.
| + <allow send_destination="com.canonical.pim"/> | ||
| + <allow send_destination="com.canonical.pim.AddressBook"/> | ||
| + <allow send_destination="com.canonical.pim.AddressBookView"/> | ||
| +` |
jdstrand
Dec 5, 2016
Contributor
Everything I said about the calendar interface applies to the contacts interface (backend is not contacts-specific, use ###PLUG_SECURITY_TAGS### in ConnectedSlot, update PermanentSlot, update ConnectedPlug for classic and ###SLOT_SECURITY_TAGS###, and dbus is problematic.
renatofilho
commented
Dec 5, 2016
•
|
unity8-pim is the base class for both calendar and contacts. It contains all common rules, since both interfaces share alot of apparmor policies. Basically it contains a base policy that is appended to individual policies (calendar and contacts) And it contains the Source manager policy that is common for both interfaces. |
|
@renatofilho - re unity8-pim> ah, I didn't look closely at it. I thought it was a different interface altogether. Organizationally, this makes me think that perhaps these should be organized differently. Maybe unity8_pim_internal.go? Perhaps @zyga would like to comment on that. |
renatofilho
commented
Dec 6, 2016
|
@jdstrand renamed unity8-qtpim to unity8-qtpim-common to match with the concept already used by "commonInterface". |
|
What's the status of this PR? |
renatofilho
commented
Dec 14, 2016
•
jdstrand
requested changes
Dec 14, 2016
Please apply my comments in calendar to contacts and common (eg, dbus, Usage, 'reserved', etc)
| +const unity8CalendarPermanentSlotAppArmor = ` | ||
| +# Description: Allow operating as the EDS service. Reserved because this | ||
| +# gives privileged access to the system. | ||
| +# Usage: reserved |
jdstrand
Dec 14, 2016
Contributor
You can remove the 'Usage' metatag here and everywhere. It is no longer needed now that we have the base declaration.
| +# Usage: reserved | ||
| + | ||
| +# DBus accesses | ||
| +#include <abstractions/dbus-session-strict> |
| +dbus (receive, send) | ||
| + bus=session | ||
| + path=/org/gnome/evolution/dataserver/Subprocess/Backend/Calendar/** | ||
| + peer=(label=unconfined), |
jdstrand
Dec 14, 2016
Contributor
I think all of these are likely 'receive' only, no? Perhaps not. Note that the 'send's here mean that the slot implementation can send to any unconfined process with the specified paths....
renatofilho
Dec 15, 2016
I think that is ok. If the app is unconfined I do not see problem in sending the information.
This was based on ofono interface and it has a similar rule with (send/receive).
jdstrand
Dec 15, 2016
Contributor
Since slot implementations require a snap declaration to be in the store, I'm 'ok' with this access to unconfined. Note that my comment was not about unconfined talking to the slot (which should always be fine), it is about the slot perhaps being able to abuse its privilege and send weird stuff to unconfined. Can you try out these rules with just 'receive' and report back? They might be required, but it is worth check if they're not.
jdstrand
Dec 15, 2016
Contributor
Re ofono> ofono was different; the rule is there so an ofono snap can talk to a network-manager deb.
We discussed this on IRC. There isn't a clear requirement for 'send' to unconfined, so Renato will remove it.
| +dbus (receive, send) | ||
| + bus=session | ||
| + path=/com/canonical/SyncMonitor | ||
| + peer=(label=unconfined), |
| +const unity8CalendarConnectedPlugAppArmor = ` | ||
| +# Description: Can access the calendar. This policy group is reserved for | ||
| +# vetted applications only in this version of the policy. Once LP: #1227824 | ||
| +# is fixed, this can be moved out of reserved status. |
jdstrand
Dec 14, 2016
Contributor
Can you update this description. The language is very 'click' oriented. It should simply be:
# Allow connected clients to communicate with calendar service via DBus
| + <allow send_interface="org.gnome.evolution.dataserver.Calendar"/> | ||
| + <allow send_interface="org.gnome.evolution.dataserver.CalendarView"/> | ||
| + <allow send_interface="org.gnome.evolution.dataserver.CalendarFactory"/> | ||
| +` |
jdstrand
Dec 5, 2016
Contributor
This is problematic-- the dbus interface is meant for system bus policy, but eds is a session service. I'm not sure how to advise here since snappy session services have not been designed yet....
jdstrand
Dec 14, 2016
Contributor
The dbus backend is currently for the system bus, but you have only 'bus=session' rules. As such, please remove use of this backend for now. This can be updated when tvoss/the Personal team update snapd for session services.
| + permanentSlotAppArmor: unity8CalendarPermanentSlotAppArmor, | ||
| + connectedSlotAppArmor: unity8CalendarConnectedSlotAppArmor, | ||
| + connectedPlugAppArmor: unity8CalendarConnectedPlugAppArmor, | ||
| + permanentSlotDBus: unity8CalendarPermanentSlotDBus, |
| + // connected plugs have a non-nil security snippet for seccomp | ||
| + snippet, err = s.iface.ConnectedPlugSnippet(s.plug, s.slot, interfaces.SecuritySecComp) | ||
| + c.Assert(err, IsNil) | ||
| + c.Assert(snippet, Not(IsNil)) |
jdstrand
Dec 14, 2016
Contributor
I would say to add something for the DBus backend here, but won't since I have asked you to remove it :)
| + c.Assert(string(snippet), testutil.Contains, `peer=(label="snap.unity8.*"),`) | ||
| +} | ||
| + | ||
| +// The label uses alternation when some, but not all, apps is bound to the ofono slot |
| + c.Assert(string(snippet), testutil.Contains, `peer=(label="snap.unity8.{app1,app2}"),`) | ||
| +} | ||
| + | ||
| +// The label uses short form when exactly one app is bound to the ofono slot |
| +dbus (bind) | ||
| + bus=session | ||
| + name="org.gnome.evolution.dataserver.Sources5", | ||
| + |
| +var unity8PimCommonConnectedSlotAppArmor = []byte(` | ||
| +# Allow service to interact with connected clients | ||
| +# DBus accesses | ||
| +#include <abstractions/dbus-session-strict> |
jdstrand
Dec 14, 2016
Contributor
This isn't needed since it is already in unity8PimCommonPermanentSlotAppArmor
| +# DBus accesses | ||
| +#include <abstractions/dbus-session-strict> | ||
| + | ||
| + |
| +# Allow all access to eds service | ||
| +dbus (receive, send) | ||
| + bus=session | ||
| + peer=(label=###SLOT_SECURITY_TAGS###), |
jdstrand
Dec 14, 2016
Contributor
This gives complete access to all DBus services provided by the slot and renders all other rules for communicating with the slot meaningless. What are you trying to achieve with this rule?
| +# Description: Allow operating as the EDS service. Reserved because this | ||
| +# gives | ||
| +# privileged access to the system. | ||
| +# Usage: reserved |
| +shutdown | ||
| +socketpair | ||
| +socket | ||
| +`) |
jdstrand
Dec 14, 2016
Contributor
connect, getpeername, getsockopt, setsockopt, socketpair and socket are all in the default template.
| +var unity8PimCommonConnectedPlugSecComp = []byte(` | ||
| +# Description: Allow using EDS service. Reserved because this gives | ||
| +# privileged access to the eds service. | ||
| +# Usage: reserved |
| +sendto | ||
| +sendmsg | ||
| +socket | ||
| +`) |
jdstrand
requested changes
Dec 15, 2016
Thanks for all the changes! This is getting close.
| + | ||
| +const unity8CalendarPermanentSlotAppArmor = ` | ||
| +# Description: Allow operating as the EDS service. Reserved because this | ||
| +# gives privileged access to the system. |
| +dbus (receive, send) | ||
| + bus=session | ||
| + path=/org/gnome/evolution/dataserver/Subprocess/Backend/Calendar/** | ||
| + peer=(label=unconfined), |
jdstrand
Dec 14, 2016
Contributor
I think all of these are likely 'receive' only, no? Perhaps not. Note that the 'send's here mean that the slot implementation can send to any unconfined process with the specified paths....
renatofilho
Dec 15, 2016
I think that is ok. If the app is unconfined I do not see problem in sending the information.
This was based on ofono interface and it has a similar rule with (send/receive).
jdstrand
Dec 15, 2016
Contributor
Since slot implementations require a snap declaration to be in the store, I'm 'ok' with this access to unconfined. Note that my comment was not about unconfined talking to the slot (which should always be fine), it is about the slot perhaps being able to abuse its privilege and send weird stuff to unconfined. Can you try out these rules with just 'receive' and report back? They might be required, but it is worth check if they're not.
jdstrand
Dec 15, 2016
Contributor
Re ofono> ofono was different; the rule is there so an ofono snap can talk to a network-manager deb.
We discussed this on IRC. There isn't a clear requirement for 'send' to unconfined, so Renato will remove it.
| + "github.com/snapcore/snapd/interfaces" | ||
| +) | ||
| + | ||
| +var unity8ContactsPermanentSlotAppArmor = ` |
jdstrand
Dec 15, 2016
Contributor
I just noticed this. Can you change this to const like you have it in unity8_calendar.go? While older interfaces aren't always consistent with this, it is current standard.
| + | ||
| +var unity8ContactsPermanentSlotAppArmor = ` | ||
| +# Description: Allow operating as the EDS service. Reserved because this | ||
| +# gives privileged access to the system. |
| + peer=(label=unconfined), | ||
| +dbus (receive, send) | ||
| + bus=session | ||
| + peer=(label=unconfined), |
jdstrand
Dec 15, 2016
Contributor
Please remove the 'send's to unconfined from the contacts' rules too.
| + peer=(label=###PLUG_SECURITY_TAGS###), | ||
| +` | ||
| + | ||
| +var unity8ContactsConnectedPlugAppArmor = ` |
| + bus=session | ||
| + peer=(label=###SLOT_SECURITY_TAGS###), | ||
| + | ||
| + |
| + "github.com/snapcore/snapd/release" | ||
| +) | ||
| + | ||
| +var unity8PimCommonPermanentSlotAppArmor = []byte(` |
| + | ||
| +var unity8PimCommonPermanentSlotAppArmor = []byte(` | ||
| +# Description: Allow operating as the EDS service. Reserved because this | ||
| +# gives privileged access to the system. |
| + name="org.gnome.evolution.dataserver.Sources5", | ||
| +`) | ||
| + | ||
| +var unity8PimCommonConnectedSlotAppArmor = []byte(` |
| + peer=(label=###PLUG_SECURITY_TAGS###), | ||
| +`) | ||
| + | ||
| +var unity8PimCommonConnectedPlugAppArmor = []byte(` |
| + path=/org/freedesktop/DBus | ||
| + interface=org.freedesktop.DBus | ||
| + member={Request,Release}Name | ||
| + peer=(label=###SLOT_SECURITY_TAGS###), |
jdstrand
Dec 15, 2016
Contributor
I didn't notice this one before. Why do connecting client need to RequestName and ReleaseName? I expected this in CommonPermanentSlotAppArmor, not for plugging clients.
| + peer=(label=###SLOT_SECURITY_TAGS###), | ||
| +`) | ||
| + | ||
| +var unity8PimCommonPermanentSlotSecComp = []byte(` |
| +accept | ||
| +accept4 | ||
| +bind | ||
| +getsockname |
| +shutdown | ||
| +`) | ||
| + | ||
| +var unity8PimCommonConnectedPlugSecComp = []byte(` |
| +# privileged access to the eds service. | ||
| + | ||
| +# Can communicate with DBus system service | ||
| +getsockname |
added some commits
Jul 21, 2016
jdstrand
reviewed
Dec 19, 2016
•
Thanks for making the additional changes! There are a couple of important open questions and tweaking when plugging on classic.
| + allow-installation: | ||
| + slot-snap-type: | ||
| + - app | ||
| + deny-auto-connection: true |
jdstrand
Dec 19, 2016
Contributor
The base declaration discussions have concluded and so now I can advise that since these are both slot implementations, you also need:
deny-connection: true
for both of these.
| + | ||
| +const unity8ContactsConnectedSlotAppArmor = ` | ||
| +# Allow service to interact with connected clients | ||
| +# DBus accesses |
jdstrand
Dec 19, 2016
Contributor
Since other changes are being made, can you put this comment on one line?
| + peer=(label=###PLUG_SECURITY_TAGS###), | ||
| +dbus (receive, send) | ||
| + bus=session | ||
| + peer=(label=###PLUG_SECURITY_TAGS###), |
jdstrand
Dec 19, 2016
Contributor
I asked about this one before. This is too broad. Why is this needed?
| + peer=(label=###SLOT_SECURITY_TAGS###), | ||
| +dbus (receive, send) | ||
| + bus=session | ||
| + peer=(label=###SLOT_SECURITY_TAGS###), |
jdstrand
Dec 19, 2016
Contributor
This is too broad, especially on OnClassic when you set ##SLOT_SECURITY_TAGS### to unconfined. Why is this needed?
| + // classic mode | ||
| + if release.OnClassic { | ||
| + // Let confined apps access unconfined service on classic | ||
| + classicSnippet := bytes.Replace(originalSnippet, old, []byte("unconfined"), -1) |
jdstrand
Dec 19, 2016
Contributor
This rule combined with this from unity8PimCommonConnectedPlugAppArmor:
dbus (send)
bus=session
path=/org/freedesktop/*
interface=org.freedesktop.DBus.Properties
peer=(label=###SLOT_SECURITY_TAGS###),
means that a connected snap may Get and Set any property of any unconfined service on the session bus, which is far too lenient. Also note the above comments on how this affects other rules.
| + case interfaces.SecuritySecComp: | ||
| + return []byte(unity8PimCommonPermanentSlotSecComp), nil | ||
| + case interfaces.SecurityDBus: | ||
| + //FIXME: Implement support after uses session be available. |
| + | ||
| +func (iface *unity8PimCommonInterface) LegacyAutoConnect() bool { | ||
| + return false | ||
| +} |
added some commits
Dec 19, 2016
|
Thank you for making these changes. +1 on the security policy and base declaration. |
jdstrand
removed
the
Blocked
label
Jan 9, 2017
zyga
approved these changes
Jan 17, 2017
Looks good now, all of my comments have been addressed or explained. Thank you.
|
FYI, the travis failures are unrelated: 2017/01/16 11:04:58 Failed tasks: 2 |
|
Master is somewhat broken currently. The issue should be resolved soon though. Let's try to merge master tomorrow and see how this feels. |
renatofilho commentedOct 27, 2016
Implement EDS [calendar, contact] interface.