Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interfaces/builtin: remove the name=org.freedesktop.DBus restriction in cups-control AppArmor rules #11843

Merged
merged 1 commit into from Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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