interfaces/builtin: add evolution interfaces #2226

Merged
merged 22 commits into from Jan 18, 2017

Conversation

Projects
None yet
5 participants

Implement EDS [calendar, contact] interface.

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 niemeyer changed the title from Eds to interfaces/builtin: add evolution interfaces Oct 28, 2016

@niemeyer niemeyer added the Blocked label Oct 28, 2016

@niemeyer

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]
SyncEvolution DBUS API - [calendar sync]
Buteo DBUS API - [contacts sync]

What do you think about that?

Contributor

jdstrand commented Nov 9, 2016

@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):

  • unity8-contacts, unity8-calendar (EDS - [contact, calendar])
  • unity8-calendar-sync (SyncEvolution DBUS API - [calendar sync])
  • unity8-contacts-sync (Buteo DBUS API - [contacts sync])

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:

  • unity8-contacts with optional 'sync' attribute
  • unity8-calendar with optional 'sync' attribute

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.

Contributor

niemeyer commented Nov 22, 2016

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, evolution-calendar gives access to the Evolution calendar. evolution-contacts gives access to the evolution contacts service.

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]
evolution-calendar - EDS calendar

[Contacts]
evolution-contacts - EDS contacts
unity8-contacts - Addressbook Service (keep it as unity8 in case we decide to use a different server)

[Sync]
buteo - For use buteo [contact sync]
syncevolution - For syncevolution service [calendar sync at the moment, we have plans to move it to buteo]

@jdstrand what do you think about that?

Contributor

niemeyer commented Nov 22, 2016

(keep it as unity8 in case we decide to use a different server)

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.

Contributor

niemeyer commented Nov 22, 2016

And by "change the interface" I really mean "use another interface" (fixed comment above).

Contributor

jdstrand commented Nov 22, 2016

@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.

Contributor

jdstrand commented Nov 22, 2016

@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-*.

Contributor

niemeyer commented Nov 22, 2016

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?

@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.

@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;
mgr->setManager("[eds | folks | ubuntu]"); // you can specify which backend do you want to use.
// Default one for ubuntu is "ubuntu" which make uses of
// "com.canonical.pim.AddressBook".
// For calendar we make access directly to eds and the default
// one is "eds"
var contacts = mrg->contacts();

@jdstrand @niemeyer We all agree with the last suggestion from @jdstrand ? Can I go ahead and implement this way?

Contributor

niemeyer 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

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.

interfaces/builtin/all_test.go
@@ -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())
@zyga

zyga Dec 1, 2016

Contributor

Missing NewUnity8ContactsInterface()

@@ -473,7 +475,7 @@ func (s *baseDeclSuite) TestConnection(c *C) {
"location-observe": true,
"lxd": true,
"mir": true,
- "udisks2": true,
+ "udisks2": true,
@zyga

zyga Dec 1, 2016

Contributor

Please go fmt in this directory to correct this.

interfaces/builtin/unity8_calendar.go
+ name: "unity8-calendar",
+ permanentSlotAppArmor: unity8CalendarPermanentSlotAppArmor,
+ connectedPlugAppArmor: unity8CalendarConnectedPlugAppArmor,
+ permanentSlotDBus: unity8CalendarPermanentSlotDBus,
@zyga

zyga Dec 1, 2016

Contributor

Feels like this needs the reservedForOS: true flag as this is just about the client side.

@renatofilho

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.

interfaces/builtin/unity8_contacts.go
+ name: "unity8-contacts",
+ permanentSlotAppArmor: unity8ContactsPermanentSlotAppArmor,
+ connectedPlugAppArmor: unity8ContactsConnectedPlugAppArmor,
+ permanentSlotDBus: unity8ContactsPermanentSlotDBus,
@zyga

zyga Dec 1, 2016

Contributor

Feels like this needs the reservedForOS: true flag as this is just about the client side.

vendor/vendor.json
@@ -63,6 +63,10 @@
"revisionTime": "2015-07-22T06:53:40Z"
},
{
+ "path": "github.com/path/of/dependency",
@zyga

zyga Dec 1, 2016

Contributor

Can you please remove this?

changes are ready for review again.

Can you explain how unity8-pim relates to unity8-calendar and unity8-contacts? I was expecting only these two and not unity8-pim....

interfaces/builtin/unity8_calendar.go
+ name="org.gnome.evolution.dataserver.Calendar7",
+dbus (bind)
+ bus=session
+ name=org.gnome.evolution.dataserver.Subprocess.Backend.*,
@jdstrand

jdstrand Dec 5, 2016

Contributor

What is the '.*' referring to here? As written, it doesn't seem specific to calendar.

@renatofilho

renatofilho Dec 5, 2016

Evolution export several services with name like "org.gnome.evolution.dataserver.Subprocess.Backend.Calendarx6605x2"

@jdstrand

jdstrand Dec 5, 2016

Contributor

Can you then use this instead: name=org.gnome.evolution.dataserver.Subprocess.Backend.Calendar*?

interfaces/builtin/unity8_calendar.go
+ bus=session
+ path=/org/gnome/evolution/dataserver/Subprocess/**
+ interface=org.freedesktop.DBus.*,
+`
@jdstrand

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.

interfaces/builtin/unity8_calendar.go
+ bus=session
+ path=/synchronizer{,/**}
+ peer=(label=unconfined),
+`
@jdstrand

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).

interfaces/builtin/unity8_calendar.go
+ <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

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

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.

interfaces/builtin/unity8_contacts.go
+ <allow send_destination="com.canonical.pim"/>
+ <allow send_destination="com.canonical.pim.AddressBook"/>
+ <allow send_destination="com.canonical.pim.AddressBookView"/>
+`
@jdstrand

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.

Contributor

jdstrand commented Dec 5, 2016

@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.

@jdstrand renamed unity8-qtpim to unity8-qtpim-common to match with the concept already used by "commonInterface".

Member

chipaca commented Dec 14, 2016

What's the status of this PR?

renatofilho commented Dec 14, 2016

@chipaca this is ready for a second round of review. It is on @jdstrand list, he should have some time soon to look at it.

Please apply my comments in calendar to contacts and common (eg, dbus, Usage, 'reserved', etc)

interfaces/builtin/unity8_calendar.go
+const unity8CalendarPermanentSlotAppArmor = `
+# Description: Allow operating as the EDS service. Reserved because this
+# gives privileged access to the system.
+# Usage: reserved
@jdstrand

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.

interfaces/builtin/unity8_calendar.go
+# Usage: reserved
+
+# DBus accesses
+#include <abstractions/dbus-session-strict>
@jdstrand

jdstrand Dec 14, 2016

Contributor

This is already in unity8-common

interfaces/builtin/unity8_calendar.go
+dbus (receive, send)
+ bus=session
+ path=/org/gnome/evolution/dataserver/Subprocess/Backend/Calendar/**
+ peer=(label=unconfined),
@jdstrand

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

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

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

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.

interfaces/builtin/unity8_calendar.go
+dbus (receive, send)
+ bus=session
+ path=/com/canonical/SyncMonitor
+ peer=(label=unconfined),
@jdstrand

jdstrand Dec 14, 2016

Contributor

Same with this one.

interfaces/builtin/unity8_calendar.go
+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

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
interfaces/builtin/unity8_calendar.go
+ <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

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

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.

interfaces/builtin/unity8_calendar.go
+ permanentSlotAppArmor: unity8CalendarPermanentSlotAppArmor,
+ connectedSlotAppArmor: unity8CalendarConnectedSlotAppArmor,
+ connectedPlugAppArmor: unity8CalendarConnectedPlugAppArmor,
+ permanentSlotDBus: unity8CalendarPermanentSlotDBus,
@jdstrand

jdstrand Dec 14, 2016

Contributor

Please remove (see above)

+ // 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

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
@jdstrand

jdstrand Dec 14, 2016

Contributor

Copy/paste issue: ofono

+ 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
interfaces/builtin/unity8_pim_common.go
+dbus (bind)
+ bus=session
+ name="org.gnome.evolution.dataserver.Sources5",
+
@jdstrand

jdstrand Dec 14, 2016

Contributor

Please remove the blank line.

interfaces/builtin/unity8_pim_common.go
+var unity8PimCommonConnectedSlotAppArmor = []byte(`
+# Allow service to interact with connected clients
+# DBus accesses
+#include <abstractions/dbus-session-strict>
@jdstrand

jdstrand Dec 14, 2016

Contributor

This isn't needed since it is already in unity8PimCommonPermanentSlotAppArmor

interfaces/builtin/unity8_pim_common.go
+# DBus accesses
+#include <abstractions/dbus-session-strict>
+
+
@jdstrand

jdstrand Dec 14, 2016

Contributor

Please remove the extra blank line.

interfaces/builtin/unity8_pim_common.go
+# Allow all access to eds service
+dbus (receive, send)
+ bus=session
+ peer=(label=###SLOT_SECURITY_TAGS###),
@jdstrand

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?

interfaces/builtin/unity8_pim_common.go
+# Description: Allow operating as the EDS service. Reserved because this
+# gives
+# privileged access to the system.
+# Usage: reserved
@jdstrand

jdstrand Dec 14, 2016

Contributor

Please remove Usage and note about 'Reserved because...'

interfaces/builtin/unity8_pim_common.go
+shutdown
+socketpair
+socket
+`)
@jdstrand

jdstrand Dec 14, 2016

Contributor

connect, getpeername, getsockopt, setsockopt, socketpair and socket are all in the default template.

interfaces/builtin/unity8_pim_common.go
+var unity8PimCommonConnectedPlugSecComp = []byte(`
+# Description: Allow using EDS service. Reserved because this gives
+# privileged access to the eds service.
+# Usage: reserved
@jdstrand

jdstrand Dec 14, 2016

Contributor

Please remove Usage and note about 'Reserved because...'

interfaces/builtin/unity8_pim_common.go
+sendto
+sendmsg
+socket
+`)
@jdstrand

jdstrand Dec 14, 2016

Contributor

connect, getsockopt and socket are all in the default template.

Thanks for all the changes! This is getting close.

interfaces/builtin/unity8_calendar.go
+
+const unity8CalendarPermanentSlotAppArmor = `
+# Description: Allow operating as the EDS service. Reserved because this
+# gives privileged access to the system.
@jdstrand

jdstrand Dec 15, 2016

Contributor

Nipick. Can you remove the space before 'gives'.

interfaces/builtin/unity8_calendar.go
+dbus (receive, send)
+ bus=session
+ path=/org/gnome/evolution/dataserver/Subprocess/Backend/Calendar/**
+ peer=(label=unconfined),
@jdstrand

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

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

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

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.

interfaces/builtin/unity8_contacts.go
+ "github.com/snapcore/snapd/interfaces"
+)
+
+var unity8ContactsPermanentSlotAppArmor = `
@jdstrand

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.

interfaces/builtin/unity8_contacts.go
+
+var unity8ContactsPermanentSlotAppArmor = `
+# Description: Allow operating as the EDS service. Reserved because this
+# gives privileged access to the system.
@jdstrand

jdstrand Dec 15, 2016

Contributor

Can you remove the space before ' gives'?

interfaces/builtin/unity8_contacts.go
+ peer=(label=unconfined),
+dbus (receive, send)
+ bus=session
+ peer=(label=unconfined),
@jdstrand

jdstrand Dec 15, 2016

Contributor

Please remove the 'send's to unconfined from the contacts' rules too.

interfaces/builtin/unity8_contacts.go
+ peer=(label=###PLUG_SECURITY_TAGS###),
+`
+
+var unity8ContactsConnectedPlugAppArmor = `
@jdstrand

jdstrand Dec 15, 2016

Contributor

Please use const.

interfaces/builtin/unity8_contacts.go
+ bus=session
+ peer=(label=###SLOT_SECURITY_TAGS###),
+
+
@jdstrand

jdstrand Dec 15, 2016

Contributor

Please remove this blank line.

interfaces/builtin/unity8_pim_common.go
+ "github.com/snapcore/snapd/release"
+)
+
+var unity8PimCommonPermanentSlotAppArmor = []byte(`
@jdstrand

jdstrand Dec 15, 2016

Contributor

Please use const.

interfaces/builtin/unity8_pim_common.go
+
+var unity8PimCommonPermanentSlotAppArmor = []byte(`
+# Description: Allow operating as the EDS service. Reserved because this
+# gives privileged access to the system.
@jdstrand

jdstrand Dec 15, 2016

Contributor

Please remove the space before ' gives' here too.

interfaces/builtin/unity8_pim_common.go
+ name="org.gnome.evolution.dataserver.Sources5",
+`)
+
+var unity8PimCommonConnectedSlotAppArmor = []byte(`
@jdstrand

jdstrand Dec 15, 2016

Contributor

Please use const.

interfaces/builtin/unity8_pim_common.go
+ peer=(label=###PLUG_SECURITY_TAGS###),
+`)
+
+var unity8PimCommonConnectedPlugAppArmor = []byte(`
@jdstrand

jdstrand Dec 15, 2016

Contributor

Please use const.

interfaces/builtin/unity8_pim_common.go
+ path=/org/freedesktop/DBus
+ interface=org.freedesktop.DBus
+ member={Request,Release}Name
+ peer=(label=###SLOT_SECURITY_TAGS###),
@jdstrand

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.

interfaces/builtin/unity8_pim_common.go
+ peer=(label=###SLOT_SECURITY_TAGS###),
+`)
+
+var unity8PimCommonPermanentSlotSecComp = []byte(`
@jdstrand

jdstrand Dec 15, 2016

Contributor

Please use const

interfaces/builtin/unity8_pim_common.go
+accept
+accept4
+bind
+getsockname
@jdstrand

jdstrand Dec 15, 2016

Contributor

getsockname is in the default template. Please remove.

interfaces/builtin/unity8_pim_common.go
+shutdown
+`)
+
+var unity8PimCommonConnectedPlugSecComp = []byte(`
@jdstrand

jdstrand Dec 15, 2016

Contributor

Please use const.

interfaces/builtin/unity8_pim_common.go
+# privileged access to the eds service.
+
+# Can communicate with DBus system service
+getsockname

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

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.

interfaces/builtin/unity8_contacts.go
+
+const unity8ContactsConnectedSlotAppArmor = `
+# Allow service to interact with connected clients
+# DBus accesses
@jdstrand

jdstrand Dec 19, 2016

Contributor

Since other changes are being made, can you put this comment on one line?

interfaces/builtin/unity8_contacts.go
+ peer=(label=###PLUG_SECURITY_TAGS###),
+dbus (receive, send)
+ bus=session
+ peer=(label=###PLUG_SECURITY_TAGS###),
@jdstrand

jdstrand Dec 19, 2016

Contributor

I asked about this one before. This is too broad. Why is this needed?

@renatofilho

renatofilho Dec 19, 2016

Sorry I removed from calendar but I did not see that on contacts.
Done

interfaces/builtin/unity8_contacts.go
+ peer=(label=###SLOT_SECURITY_TAGS###),
+dbus (receive, send)
+ bus=session
+ peer=(label=###SLOT_SECURITY_TAGS###),
@jdstrand

jdstrand Dec 19, 2016

Contributor

This is too broad, especially on OnClassic when you set ##SLOT_SECURITY_TAGS### to unconfined. Why is this needed?

@renatofilho

renatofilho Dec 19, 2016

Tested and this is not necessary. (removed)

+ // classic mode
+ if release.OnClassic {
+ // Let confined apps access unconfined service on classic
+ classicSnippet := bytes.Replace(originalSnippet, old, []byte("unconfined"), -1)
@jdstrand

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.

interfaces/builtin/unity8_pim_common.go
+ case interfaces.SecuritySecComp:
+ return []byte(unity8PimCommonPermanentSlotSecComp), nil
+ case interfaces.SecurityDBus:
+ //FIXME: Implement support after uses session be available.
@jdstrand

jdstrand Dec 19, 2016

Contributor

s/uses session be/session services are/

interfaces/builtin/unity8_pim_common.go
+
+func (iface *unity8PimCommonInterface) LegacyAutoConnect() bool {
+ return false
+}
@jdstrand

jdstrand Dec 19, 2016

Contributor

LegacyAutoConnect can be dropped.

Renato Araujo Oliveira Filho added some commits Dec 19, 2016

Contributor

jdstrand commented Dec 19, 2016

Thank you for making these changes. +1 on the security policy and base declaration.

@jdstrand 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.

Contributor

jdstrand commented Jan 17, 2017

FYI, the travis failures are unrelated:

2017/01/16 11:04:58 Failed tasks: 2
- linode:ubuntu-16.04-32:tests/main/snapd-reexec
- linode:ubuntu-16.04-64:tests/main/snapd-reexec

Contributor

zyga commented Jan 17, 2017

Master is somewhat broken currently. The issue should be resolved soon though. Let's try to merge master tomorrow and see how this feels.

@chipaca chipaca merged commit 165bd1c into snapcore:master Jan 18, 2017

5 of 6 checks passed

zesty-amd64 autopkgtest finished (failure)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
xenial-amd64 autopkgtest finished (success)
Details
xenial-i386 autopkgtest finished (success)
Details
xenial-ppc64el autopkgtest finished (success)
Details
yakkety-amd64 autopkgtest finished (success)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment