github.com/hugh712/snapd@v0.0.0-20200910133618-1a99902bd583/interfaces/builtin/network_setup_observe.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2016 Canonical Ltd 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 3 as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package builtin 21 22 const networkSetupObserveSummary = `allows read access to netplan configuration` 23 24 const networkSetupObserveBaseDeclarationSlots = ` 25 network-setup-observe: 26 allow-installation: 27 slot-snap-type: 28 - core 29 deny-auto-connection: true 30 ` 31 32 const networkSetupObserveConnectedPlugAppArmor = ` 33 # Description: Can read netplan configuration files 34 35 /etc/netplan/{,**} r, 36 /etc/network/{,**} r, 37 /etc/systemd/network/{,**} r, 38 39 /run/systemd/network/{,**} r, 40 /run/NetworkManager/conf.d/{,**} r, 41 /run/udev/rules.d/ r, 42 /run/udev/rules.d/[0-9]*-netplan-* r, 43 44 #include <abstractions/dbus-strict> 45 46 # Allow use of Netplan Info API, used to get information on available netplan 47 # features and version 48 dbus (send) 49 bus=system 50 interface=io.netplan.Netplan 51 path=/io/netplan/Netplan 52 member=Info 53 peer=(label=unconfined), 54 55 ` 56 57 func init() { 58 registerIface(&commonInterface{ 59 name: "network-setup-observe", 60 summary: networkSetupObserveSummary, 61 implicitOnCore: true, 62 implicitOnClassic: true, 63 baseDeclarationSlots: networkSetupObserveBaseDeclarationSlots, 64 connectedPlugAppArmor: networkSetupObserveConnectedPlugAppArmor, 65 }) 66 }