Skip to content

Commit

Permalink
Merge pull request #11843 from jhenstridge/cups-control-iface-dbus-na…
Browse files Browse the repository at this point in the history
…me-fix

interfaces/builtin: remove the name=org.freedesktop.DBus restriction in cups-control AppArmor rules
  • Loading branch information
mvo5 committed Jun 7, 2022
2 parents 9d2958f + a6725ea commit cafc226
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions interfaces/builtin/cups_control.go
Expand Up @@ -81,7 +81,7 @@ dbus (send)
bus=system
path=/org/cups/cupsd/Notifier
interface=org.cups.cupsd.Notifier
peer=(name=org.freedesktop.DBus,label=unconfined),
peer=(label=unconfined),
# Allow daemon to send signals to its snap_daemon processes
capability kill,
Expand All @@ -96,7 +96,7 @@ dbus (send)
bus=system
path=/org/cups/cupsd/Notifier
interface=org.cups.cupsd.Notifier
peer=(name=org.freedesktop.DBus,label=###PLUG_SECURITY_TAGS###),
peer=(label=###PLUG_SECURITY_TAGS###),
`

const cupsControlConnectedPlugAppArmor = `
Expand All @@ -111,7 +111,7 @@ dbus (receive)
bus=system
path=/org/cups/cupsd/Notifier
interface=org.cups.cupsd.Notifier
peer=(name=org.freedesktop.DBus,label=###SLOT_SECURITY_TAGS###),
peer=(label=###SLOT_SECURITY_TAGS###),
`

type cupsControlInterface struct {
Expand Down
10 changes: 5 additions & 5 deletions interfaces/builtin/cups_control_test.go
Expand Up @@ -106,7 +106,7 @@ func (s *cupsControlSuite) TestAppArmorSpecCore(c *C) {
c.Assert(spec.SecurityTags(), DeepEquals, []string{"snap.consumer.app"})
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "# Allow communicating with the cups server for printing and configuration.")
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "#include <abstractions/cups-client>")
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "peer=(name=org.freedesktop.DBus,label=\"snap.provider.app\"")
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "peer=(label=\"snap.provider.app\"")
c.Assert(spec.SnippetForTag("snap.provider.app"), Not(testutil.Contains), "# Allow daemon access to create the CUPS socket")

// provider to consumer on core for PermanentSlot
Expand All @@ -120,7 +120,7 @@ func (s *cupsControlSuite) TestAppArmorSpecCore(c *C) {
spec = &apparmor.Specification{}
c.Assert(spec.AddConnectedSlot(s.iface, s.plug, s.providerSlot), IsNil)
c.Assert(spec.SecurityTags(), DeepEquals, []string{"snap.provider.app"})
c.Assert(spec.SnippetForTag("snap.provider.app"), testutil.Contains, "peer=(name=org.freedesktop.DBus,label=\"snap.consumer.app\"")
c.Assert(spec.SnippetForTag("snap.provider.app"), testutil.Contains, "peer=(label=\"snap.consumer.app\"")
}

func (s *cupsControlSuite) TestAppArmorSpecClassic(c *C) {
Expand All @@ -133,7 +133,7 @@ func (s *cupsControlSuite) TestAppArmorSpecClassic(c *C) {
c.Assert(spec.SecurityTags(), DeepEquals, []string{"snap.consumer.app"})
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "# Allow communicating with the cups server for printing and configuration.")
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "#include <abstractions/cups-client>")
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "peer=(name=org.freedesktop.DBus,label=\"{unconfined,/usr/sbin/cupsd,cupsd}\"")
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "peer=(label=\"{unconfined,/usr/sbin/cupsd,cupsd}\"")
c.Assert(spec.SnippetForTag("snap.provider.app"), Not(testutil.Contains), "# Allow daemon access to create the CUPS socket")

// core to consumer on classic is empty for PermanentSlot
Expand All @@ -152,7 +152,7 @@ func (s *cupsControlSuite) TestAppArmorSpecClassic(c *C) {
c.Assert(spec.SecurityTags(), DeepEquals, []string{"snap.consumer.app"})
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "# Allow communicating with the cups server for printing and configuration.")
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "#include <abstractions/cups-client>")
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "peer=(name=org.freedesktop.DBus,label=\"snap.provider.app\"")
c.Assert(spec.SnippetForTag("snap.consumer.app"), testutil.Contains, "peer=(label=\"snap.provider.app\"")
c.Assert(spec.SnippetForTag("snap.provider.app"), Not(testutil.Contains), "# Allow daemon access to create the CUPS socket")

// provider to consumer on classic for PermanentSlot
Expand All @@ -166,7 +166,7 @@ func (s *cupsControlSuite) TestAppArmorSpecClassic(c *C) {
spec = &apparmor.Specification{}
c.Assert(spec.AddConnectedSlot(s.iface, s.plug, s.providerSlot), IsNil)
c.Assert(spec.SecurityTags(), DeepEquals, []string{"snap.provider.app"})
c.Assert(spec.SnippetForTag("snap.provider.app"), testutil.Contains, "peer=(name=org.freedesktop.DBus,label=\"snap.consumer.app\"")
c.Assert(spec.SnippetForTag("snap.provider.app"), testutil.Contains, "peer=(label=\"snap.consumer.app\"")
}

func (s *cupsControlSuite) TestStaticInfo(c *C) {
Expand Down

0 comments on commit cafc226

Please sign in to comment.