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: put base policy fragments inside each interface #3464

Merged
merged 92 commits into from
Jun 29, 2017
Merged
Show file tree
Hide file tree
Changes from 91 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
f694f3c
interfaces: move base decl for account-control to interface itself
zyga Jun 6, 2017
0af74ce
interfaces: move base decl for greengrass-support to interface itself
zyga Jun 20, 2017
b74c9b9
interfaces: move base decl for alsa to interface itself
zyga Jun 6, 2017
d2d6ea6
interfaces: move base decl for autopilot-introspection to interface i…
zyga Jun 6, 2017
c80da39
interfaces: move base decl for avahi-observe to interface itself
zyga Jun 6, 2017
e5b5759
interfaces: move base decl for bluetooth-control to interface itself
zyga Jun 6, 2017
c541419
interfaces: move base decl for bluez to interface itself
zyga Jun 6, 2017
a19b63f
interfaces: move base decl for bool-file to interface itself
zyga Jun 6, 2017
a2dc704
interfaces: move base decl for browser-support to interface itself
zyga Jun 6, 2017
06c0211
interfaces: move base decl for camera to interface itself
zyga Jun 6, 2017
d05fb11
interfaces: move base decl for classic-support to interface itself
zyga Jun 6, 2017
efa3e0a
interfaces: move base decl for content to interface itself
zyga Jun 6, 2017
fb9ee7a
interfaces: move base decl for core-support to interface itself
zyga Jun 6, 2017
4584199
interfaces: move base decl for cups-control to interface itself
zyga Jun 6, 2017
9c2e6b5
interfaces: move base decl for dbus to interface itself
zyga Jun 6, 2017
2033f93
interfaces: move base decl for dcdbas-control to interface itself
zyga Jun 6, 2017
5d6baa2
interfaces: move base decl for docker to interface itself
zyga Jun 6, 2017
10e2045
interfaces: move base decl for docker-support to interface itself
zyga Jun 6, 2017
bdcc24a
interfaces: move base decl for firewall-control to interface itself
zyga Jun 6, 2017
3a257d2
interfaces: move base decl for framebuffer to interface itself
zyga Jun 6, 2017
2be8b84
interfaces: move base decl for fuse-support to interface itself
zyga Jun 6, 2017
7932054
interfaces: move base decl for fwupd to interface itself
zyga Jun 6, 2017
2eda83b
interfaces: move base decl for gpio to interface itself
zyga Jun 6, 2017
5291811
interfaces: move base decl for hardware-observe to interface itself
zyga Jun 6, 2017
d515e4e
interfaces: move base decl for hardware-random-control to interface i…
zyga Jun 6, 2017
dc59d1c
interfaces: move base decl for hardware-random-observe to interface i…
zyga Jun 6, 2017
81fae0e
interfaces: move base decl for hidraw to interface itself
zyga Jun 6, 2017
158ada3
interfaces: move base decl for home to interface itself
zyga Jun 6, 2017
eeec0a3
interfaces: move base decl for i2c to interface itself
zyga Jun 6, 2017
9cca7b4
interfaces: move base decl for iio to interface itself
zyga Jun 6, 2017
c3ea6b3
interfaces: move base decl for io-ports-control to interface itself
zyga Jun 6, 2017
dc13384
interfaces: move base decl for joystick to interface itself
zyga Jun 6, 2017
b5e5780
interfaces: move base decl for kernel-module-control to interface itself
zyga Jun 6, 2017
6e178ea
interfaces: move base decl for kubernetes-control to interface itself
zyga Jun 6, 2017
58e27f2
interfaces: move base decl for libvirt to interface itself
zyga Jun 6, 2017
d83ac42
interfaces: move base decl for locale-control to interface itself
zyga Jun 6, 2017
c5fb171
interfaces: move base decl for location-control to interface itself
zyga Jun 6, 2017
c143fac
interfaces: move base decl for location-observe to interface itself
zyga Jun 6, 2017
8603626
interfaces: move base decl for log-observe to interface itself
zyga Jun 6, 2017
1d37420
interfaces: move base decl for lxd to interface itself
zyga Jun 6, 2017
555107d
interfaces: move base decl for lxd-support to interface itself
zyga Jun 6, 2017
8e6ce4a
interfaces: move base decl for maliit to interface itself
zyga Jun 6, 2017
ed2b72a
interfaces: move base decl for media-hub to interface itself
zyga Jun 6, 2017
08350fd
interfaces: move base decl for mir to interface itself
zyga Jun 6, 2017
dba5ac0
interfaces: move base decl for modem-manager to interface itself
zyga Jun 6, 2017
82412f9
interfaces: move base decl for mount-observe to interface itself
zyga Jun 6, 2017
48275bb
interfaces: move base decl for mpris to interface itself
zyga Jun 6, 2017
2379406
interfaces: move base decl for netlink-audit to interface itself
zyga Jun 6, 2017
44e055c
interfaces: move base decl for netlink-connector to interface itself
zyga Jun 6, 2017
8d4b9bb
interfaces: move base decl for network to interface itself
zyga Jun 6, 2017
b2c3cf9
interfaces: move base decl for network-bind to interface itself
zyga Jun 6, 2017
825bfe9
interfaces: move base decl for network-control to interface itself
zyga Jun 6, 2017
e8e1959
interfaces: move base decl for network-manager to interface itself
zyga Jun 6, 2017
160f41b
interfaces: move base decl for network-observe to interface itself
zyga Jun 6, 2017
e251c92
interfaces: move base decl for network-setup-control to interface itself
zyga Jun 6, 2017
d6efa71
interfaces: move base decl for network-setup-observe to interface itself
zyga Jun 6, 2017
3e5047a
interfaces: move base decl for network-status to interface itself
zyga Jun 6, 2017
b265d50
interfaces: move base decl for ofono to interface itself
zyga Jun 6, 2017
e6af385
interfaces: move base decl for online-accounts-service to interface i…
zyga Jun 6, 2017
5e0a9c7
interfaces: move base decl for opengl to interface itself
zyga Jun 6, 2017
208ec09
interfaces: move base decl for openvswitch to interface itself
zyga Jun 7, 2017
c3906dc
interfaces: move base decl for openvswitch-support to interface itself
zyga Jun 7, 2017
9a5851c
interfaces: move base decl for optical-drive to interface itself
zyga Jun 7, 2017
0cc911a
interfaces: move base decl for physical-memory-control to interface i…
zyga Jun 7, 2017
2614058
interfaces: move base decl for physical-memory-observe to interface i…
zyga Jun 7, 2017
75e3205
interfaces: move base decl for ppp to interface itself
zyga Jun 7, 2017
d39a2d6
interfaces: move base decl for process-control to interface itself
zyga Jun 7, 2017
b940b24
interfaces: move base decl for pulseaudio to interface itself
zyga Jun 7, 2017
4d0fad7
interfaces: move base decl for raw-usb to interface itself
zyga Jun 7, 2017
b98ddcb
interfaces: move base decl for removable-media to interface itself
zyga Jun 7, 2017
14503ca
interfaces: move base decl for screen-inhibit-control to interface it…
zyga Jun 7, 2017
0127561
interfaces: move base decl for serial-port to interface itself
zyga Jun 7, 2017
21eda2f
interfaces: move base decl for shutdown to interface itself
zyga Jun 7, 2017
1b76c90
interfaces: move base decl for snapd-control to interface itself
zyga Jun 7, 2017
775ee9f
interfaces: move base decl for storage-framework-service to interface…
zyga Jun 7, 2017
8247489
interfaces: move base decl for system-observe to interface itself
zyga Jun 7, 2017
49fb541
interfaces: move base decl for system-trace to interface itself
zyga Jun 7, 2017
5a6988c
interfaces: move base decl for thumbnailer-service to interface itself
zyga Jun 7, 2017
6dc62d4
interfaces: move base decl for time-control to interface itself
zyga Jun 7, 2017
91e56d9
interfaces: move base decl for timeserver-control to interface itself
zyga Jun 7, 2017
e21006c
interfaces: move base decl for timezone-control to interface itself
zyga Jun 7, 2017
ad8696b
interfaces: move base decl for tpm to interface itself
zyga Jun 7, 2017
c8e00b2
interfaces: move base decl for ubuntu-download-manager to interface i…
zyga Jun 7, 2017
5e75216
interfaces: move base decl for udisks2 to interface itself
zyga Jun 7, 2017
3407b92
interfaces: move base decl for uhid to interface itself
zyga Jun 7, 2017
c1ea2c7
interfaces: move base decl for unity7 to interface itself
zyga Jun 7, 2017
35fd627
interfaces: move base decl for unity8 to interface itself
zyga Jun 7, 2017
ed29f4d
interfaces: move base decl for unity8-calendar to interface itself
zyga Jun 7, 2017
85e9c27
interfaces: move base decl for unity8-contacts to interface itself
zyga Jun 7, 2017
cffcca1
interfaces: move base decl for upower-observe to interface itself
zyga Jun 7, 2017
4e3a855
interfaces: move base decl for x11 to interface itself
zyga Jun 7, 2017
d3f3c2c
Merge branch 'master' of github.com:snapcore/snapd into feature/metad…
zyga Jun 23, 2017
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
9 changes: 9 additions & 0 deletions interfaces/builtin/account_control.go
Expand Up @@ -28,6 +28,14 @@ delete non-system users as well as to change account passwords.
The core snap provides the slot that is shared by all the snaps.
`

const accountControlBaseDeclarationSlots = `
account-control:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`

const accountControlConnectedPlugAppArmor = `
/{,usr/}sbin/chpasswd ixr,
/{,usr/}sbin/user{add,del} ixr,
Expand Down Expand Up @@ -74,6 +82,7 @@ func init() {
description: accountControlDescription,
implicitOnCore: true,
implicitOnClassic: true,
baseDeclarationSlots: accountControlBaseDeclarationSlots,
connectedPlugAppArmor: accountControlConnectedPlugAppArmor,
connectedPlugSecComp: accountControlConnectedPlugSecComp,
reservedForOS: true,
Expand Down
9 changes: 9 additions & 0 deletions interfaces/builtin/alsa.go
Expand Up @@ -27,6 +27,14 @@ The alsa interface allows connected plugs to access raw ALSA devices.
The core snap provides the slot that is shared by all the snaps.
`

const alsaBaseDeclarationSlots = `
alsa:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`

const alsaConnectedPlugAppArmor = `
# Description: Allow access to raw ALSA devices.

Expand All @@ -46,6 +54,7 @@ func init() {
description: alsaDescription,
implicitOnCore: true,
implicitOnClassic: true,
baseDeclarationSlots: alsaBaseDeclarationSlots,
connectedPlugAppArmor: alsaConnectedPlugAppArmor,
reservedForOS: true,
})
Expand Down
9 changes: 9 additions & 0 deletions interfaces/builtin/autopilot.go
Expand Up @@ -21,6 +21,14 @@ package builtin

const autopilotIntrospectionSummary = `allows introspection of application user interface`

const autopilotIntrospectionBaseDeclarationSlots = `
autopilot-introspection:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`

const autopilotIntrospectionPlugAppArmor = `
# Description: Allows an application to be introspected and export its ui
# status over DBus
Expand Down Expand Up @@ -60,6 +68,7 @@ func init() {
summary: autopilotIntrospectionSummary,
implicitOnCore: true,
implicitOnClassic: true,
baseDeclarationSlots: autopilotIntrospectionBaseDeclarationSlots,
connectedPlugAppArmor: autopilotIntrospectionPlugAppArmor,
connectedPlugSecComp: autopilotIntrospectionPlugSecComp,
reservedForOS: true,
Expand Down
9 changes: 9 additions & 0 deletions interfaces/builtin/avahi_observe.go
Expand Up @@ -21,6 +21,14 @@ package builtin

const avahiObserveSummary = `allows discovering local domains, hostnames and services`

const avahiObserveBaseDeclarationSlots = `
avahi-observe:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`

const avahiObserveConnectedPlugAppArmor = `
# Description: allows domain browsing, service browsing and service resolving

Expand Down Expand Up @@ -118,6 +126,7 @@ func init() {
name: "avahi-observe",
summary: avahiObserveSummary,
implicitOnClassic: true,
baseDeclarationSlots: avahiObserveBaseDeclarationSlots,
connectedPlugAppArmor: avahiObserveConnectedPlugAppArmor,
reservedForOS: true,
})
Expand Down
9 changes: 9 additions & 0 deletions interfaces/builtin/bluetooth_control.go
Expand Up @@ -21,6 +21,14 @@ package builtin

const bluetoothControlSummary = `allows managing the kernel bluetooth stack`

const bluetoothControlBaseDeclarationSlots = `
bluetooth-control:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`

const bluetoothControlConnectedPlugAppArmor = `
# Description: Allow managing the kernel side Bluetooth stack. Reserved
# because this gives privileged access to the system.
Expand Down Expand Up @@ -54,6 +62,7 @@ func init() {
summary: bluetoothControlSummary,
implicitOnCore: true,
implicitOnClassic: true,
baseDeclarationSlots: bluetoothControlBaseDeclarationSlots,
connectedPlugAppArmor: bluetoothControlConnectedPlugAppArmor,
connectedPlugSecComp: bluetoothControlConnectedPlugSecComp,
reservedForOS: true,
Expand Down
12 changes: 11 additions & 1 deletion interfaces/builtin/bluez.go
Expand Up @@ -30,6 +30,15 @@ import (

const bluezSummary = `allows operating as the bluez service`

const bluezBaseDeclarationSlots = `
bluez:
allow-installation:
slot-snap-type:
- app
deny-connection: true
deny-auto-connection: true
`

const bluezPermanentSlotAppArmor = `
# Description: Allow operating as the bluez service. This gives privileged
# access to the system.
Expand Down Expand Up @@ -191,7 +200,8 @@ func (iface *bluezInterface) Name() string {

func (iface *bluezInterface) MetaData() interfaces.MetaData {
return interfaces.MetaData{
Summary: bluezSummary,
Summary: bluezSummary,
BaseDeclarationSlots: bluezBaseDeclarationSlots,
}
}

Expand Down
12 changes: 11 additions & 1 deletion interfaces/builtin/bool_file.go
Expand Up @@ -30,6 +30,15 @@ import (

const boolFileSummary = `allows access to specific file with bool semantics`

const boolFileBaseDeclarationSlots = `
bool-file:
allow-installation:
slot-snap-type:
- core
- gadget
deny-auto-connection: true
`

// boolFileInterface is the type of all the bool-file interfaces.
type boolFileInterface struct{}

Expand All @@ -45,7 +54,8 @@ func (iface *boolFileInterface) Name() string {

func (iface *boolFileInterface) MetaData() interfaces.MetaData {
return interfaces.MetaData{
Summary: boolFileSummary,
Summary: boolFileSummary,
BaseDeclarationSlots: boolFileBaseDeclarationSlots,
}
}

Expand Down
17 changes: 14 additions & 3 deletions interfaces/builtin/browser_support.go
Expand Up @@ -29,6 +29,16 @@ import (

const browserSupportSummary = `allows access to various APIs needed by modern web browsers`

const browserSupportBaseDeclarationSlots = `
browser-support:
allow-installation:
slot-snap-type:
- core
deny-connection:
plug-attributes:
allow-sandbox: true
`

const browserSupportConnectedPlugAppArmor = `
# Description: Can access various APIs needed by modern browsers (eg, Google
# Chrome/Chromium and Mozilla) and file paths they expect. This interface is
Expand Down Expand Up @@ -246,9 +256,10 @@ func (iface *browserSupportInterface) Name() string {

func (iface *browserSupportInterface) MetaData() interfaces.MetaData {
return interfaces.MetaData{
Summary: browserSupportSummary,
ImplicitOnCore: true,
ImplicitOnClassic: true,
Summary: browserSupportSummary,
ImplicitOnCore: true,
ImplicitOnClassic: true,
BaseDeclarationSlots: browserSupportBaseDeclarationSlots,
}
}

Expand Down
9 changes: 9 additions & 0 deletions interfaces/builtin/camera.go
Expand Up @@ -21,6 +21,14 @@ package builtin

const cameraSummary = `allows access to all cameras`

const cameraBaseDeclarationSlots = `
camera:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`

const cameraConnectedPlugAppArmor = `
# Until we have proper device assignment, allow access to all cameras
/dev/video[0-9]* rw,
Expand All @@ -38,6 +46,7 @@ func init() {
summary: cameraSummary,
implicitOnCore: true,
implicitOnClassic: true,
baseDeclarationSlots: cameraBaseDeclarationSlots,
connectedPlugAppArmor: cameraConnectedPlugAppArmor,
reservedForOS: true,
})
Expand Down
16 changes: 16 additions & 0 deletions interfaces/builtin/classic_support.go
Expand Up @@ -21,6 +21,20 @@ package builtin

const classicSupportSummary = `special permissions for the classic snap`

const classicSupportBaseDeclarationPlugs = `
classic-support:
allow-installation: false
deny-auto-connection: true
`

const classicSupportBaseDeclarationSlots = `
classic-support:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`

const classicSupportPlugAppArmor = `
# Description: permissions to use classic dimension. This policy is
# intentionally not restricted. This gives device ownership to
Expand Down Expand Up @@ -108,6 +122,8 @@ func init() {
summary: classicSupportSummary,
implicitOnCore: true,
implicitOnClassic: true,
baseDeclarationPlugs: classicSupportBaseDeclarationPlugs,
baseDeclarationSlots: classicSupportBaseDeclarationSlots,
connectedPlugAppArmor: classicSupportPlugAppArmor,
connectedPlugSecComp: classicSupportPlugSecComp,
})
Expand Down
19 changes: 18 additions & 1 deletion interfaces/builtin/content.go
Expand Up @@ -34,6 +34,22 @@ import (

const contentSummary = `allows sharing code and data with other snaps`

const contentBaseDeclarationSlots = `
content:
allow-installation:
slot-snap-type:
- app
- gadget
allow-connection:
plug-attributes:
content: $SLOT(content)
allow-auto-connection:
plug-publisher-id:
- $SLOT_PUBLISHER_ID
plug-attributes:
content: $SLOT(content)
`

// contentInterface allows sharing content between snaps
type contentInterface struct{}

Expand All @@ -43,7 +59,8 @@ func (iface *contentInterface) Name() string {

func (iface *contentInterface) MetaData() interfaces.MetaData {
return interfaces.MetaData{
Summary: contentSummary,
Summary: contentSummary,
BaseDeclarationSlots: contentBaseDeclarationSlots,
}
}

Expand Down
25 changes: 21 additions & 4 deletions interfaces/builtin/core_support.go
Expand Up @@ -21,6 +21,21 @@ package builtin

const coreSupportSummary = `special permissions for the core snap`

const coreSupportBaseDeclarationPlugs = `
core-support:
allow-installation:
plug-snap-type:
- core
`

const coreSupportBaseDeclarationSlots = `
core-support:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`

const coreSupportConnectedPlugAppArmor = `
# Description: Can control all aspects of systemd via the systemctl command,
# update rsyslog configuration, update systemd-timesyncd configuration and
Expand Down Expand Up @@ -78,10 +93,12 @@ owner /boot/uboot/config.txt.tmp rwk,

func init() {
registerIface(&commonInterface{
name: "core-support",
summary: coreSupportSummary,
implicitOnCore: true,
implicitOnClassic: true,
name: "core-support",
summary: coreSupportSummary,
implicitOnCore: true,
implicitOnClassic: true,
baseDeclarationPlugs: coreSupportBaseDeclarationPlugs,
baseDeclarationSlots: coreSupportBaseDeclarationSlots,
// NOTE: core-support implicitly contains the rules from network-bind.
connectedPlugAppArmor: coreSupportConnectedPlugAppArmor + networkBindConnectedPlugAppArmor,
connectedPlugSecComp: "" + networkBindConnectedPlugSecComp,
Expand Down
9 changes: 9 additions & 0 deletions interfaces/builtin/cups_control.go
Expand Up @@ -21,6 +21,14 @@ package builtin

const cupsControlSummary = `allows access to the CUPS control socket`

const cupsControlBaseDeclarationSlots = `
cups-control:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`

const cupsControlConnectedPlugAppArmor = `
# Description: Can access cups control socket. This is restricted because it provides
# privileged access to configure printing.
Expand All @@ -33,6 +41,7 @@ func init() {
name: "cups-control",
summary: cupsControlSummary,
implicitOnClassic: true,
baseDeclarationSlots: cupsControlBaseDeclarationSlots,
connectedPlugAppArmor: cupsControlConnectedPlugAppArmor,
reservedForOS: true,
})
Expand Down
14 changes: 13 additions & 1 deletion interfaces/builtin/dbus.go
Expand Up @@ -33,6 +33,17 @@ import (

const dbusSummary = `allows owning a specifc name on DBus`

const dbusBaseDeclarationSlots = `
dbus:
allow-installation:
slot-snap-type:
- app
deny-connection:
slot-attributes:
name: .+
deny-auto-connection: true
`

const dbusPermanentSlotAppArmor = `
# Description: Allow owning a name on DBus public bus

Expand Down Expand Up @@ -195,7 +206,8 @@ func (iface *dbusInterface) Name() string {

func (iface *dbusInterface) MetaData() interfaces.MetaData {
return interfaces.MetaData{
Summary: dbusSummary,
Summary: dbusSummary,
BaseDeclarationSlots: dbusBaseDeclarationSlots,
}
}

Expand Down
9 changes: 9 additions & 0 deletions interfaces/builtin/dcdbas_control.go
Expand Up @@ -21,6 +21,14 @@ package builtin

const dcdbasControlSummary = `allows access to Dell Systems Management Base Driver`

const dcdbasControlBaseDeclarationSlots = `
dcdbas-control:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`

// https://www.kernel.org/doc/Documentation/dcdbas.txt
const dcdbasControlConnectedPlugAppArmor = `
# Description: This interface allows communication with Dell Systems Management Base Driver
Expand Down Expand Up @@ -49,6 +57,7 @@ func init() {
summary: dcdbasControlSummary,
implicitOnCore: true,
implicitOnClassic: true,
baseDeclarationSlots: dcdbasControlBaseDeclarationSlots,
connectedPlugAppArmor: dcdbasControlConnectedPlugAppArmor,
reservedForOS: true,
})
Expand Down