github.com/bugraaydogar/snapd@v0.0.0-20210315170335-8c70bb858939/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 # Allow use of the netplan binary from the base snap. With this interface, this 36 # is expected to be able to only get information about the current network 37 # configuration and not generate or apply it like is allowed with 38 # network-setup-control. 39 /usr/sbin/netplan ixr, 40 # core18+ has /usr/sbin/netplan as a symlink to this script 41 /usr/share/netplan/netplan.script ixr, 42 # netplan related files 43 /usr/share/netplan/ r, 44 /usr/share/netplan/** r, 45 46 # Netplan uses busctl internally, so allow using that as well 47 /usr/bin/busctl ixr, 48 49 /etc/netplan/{,**} r, 50 /etc/network/{,**} r, 51 /etc/systemd/network/{,**} r, 52 53 /run/systemd/network/{,**} r, 54 /run/NetworkManager/conf.d/{,**} r, 55 /run/udev/rules.d/ r, 56 /run/udev/rules.d/[0-9]*-netplan-* r, 57 58 #include <abstractions/dbus-strict> 59 60 # Allow use of Netplan Info API, used to get information on available netplan 61 # features and version 62 dbus (send) 63 bus=system 64 interface=io.netplan.Netplan 65 path=/io/netplan/Netplan 66 member=Info 67 peer=(label=unconfined), 68 69 ` 70 71 func init() { 72 registerIface(&commonInterface{ 73 name: "network-setup-observe", 74 summary: networkSetupObserveSummary, 75 implicitOnCore: true, 76 implicitOnClassic: true, 77 baseDeclarationSlots: networkSetupObserveBaseDeclarationSlots, 78 connectedPlugAppArmor: networkSetupObserveConnectedPlugAppArmor, 79 }) 80 }