interfaces: add udev netlink support to hardware-observe #3864

Merged
merged 1 commit into from Sep 7, 2017
Jump to file or symbol
Failed to load files and symbols.
+7 −0
Split
@@ -56,6 +56,7 @@ capability sys_admin,
# Needed for udevadm
/run/udev/data/** r,
+network netlink raw,
# util-linux
/{,usr/}bin/lscpu ixr,
@@ -87,6 +88,10 @@ iopl
# multicast statistics
socket AF_NETLINK - NETLINK_GENERIC
+
+# kernel uevents
+socket AF_NETLINK - NETLINK_KOBJECT_UEVENT
@jdstrand

jdstrand Sep 6, 2017

Contributor

Please also add bind here.

@mvo5

mvo5 Sep 7, 2017

Collaborator

Added

+bind
`
func init() {
@@ -95,13 +95,15 @@ func (s *HardwareObserveInterfaceSuite) TestUsedSecuritySystems(c *C) {
c.Assert(err, IsNil)
c.Assert(apparmorSpec.SecurityTags(), DeepEquals, []string{"snap.other.app2"})
c.Assert(apparmorSpec.SnippetForTag("snap.other.app2"), testutil.Contains, "capability sys_rawio,\n")
+ c.Assert(apparmorSpec.SnippetForTag("snap.other.app2"), testutil.Contains, "network netlink raw,\n")
// connected plugs have a non-nil security snippet for seccomp
seccompSpec := &seccomp.Specification{}
err = seccompSpec.AddConnectedPlug(s.iface, s.plug, nil, s.slot, nil)
c.Assert(err, IsNil)
c.Assert(seccompSpec.SecurityTags(), DeepEquals, []string{"snap.other.app2"})
c.Check(seccompSpec.SnippetForTag("snap.other.app2"), testutil.Contains, "iopl\n")
+ c.Check(seccompSpec.SnippetForTag("snap.other.app2"), testutil.Contains, "socket AF_NETLINK - NETLINK_KOBJECT_UEVENT\n")
}
func (s *HardwareObserveInterfaceSuite) TestInterfaces(c *C) {