github.com/bugraaydogar/snapd@v0.0.0-20210315170335-8c70bb858939/interfaces/builtin/system_backup.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2019 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 systemBackupSummary = `allows read-only access to the entire system for backups` 23 24 const systemBackupBaseDeclarationSlots = ` 25 system-backup: 26 allow-installation: 27 slot-snap-type: 28 - core 29 deny-auto-connection: true 30 ` 31 32 const systemBackupConnectedPlugAppArmor = ` 33 # Description: Allow read-only access to the entire system 34 capability dac_read_search, 35 36 # read access to everything except items under /dev, /sys and /proc 37 /{,var/lib/snapd/hostfs/}[^dsp]** r, 38 /{,var/lib/snapd/hostfs/}{d[^e],s[^y],p[^r]}** r, 39 /{,var/lib/snapd/hostfs/}{de[^v],sy[^s],pr[^o]}** r, 40 /{,var/lib/snapd/hostfs/}{dev[^/],sys[^/],pro[^c]}** r, 41 /{,var/lib/snapd/hostfs/}proc[^/]** r, 42 43 # Allow a few not caught in the above 44 /{,var/lib/snapd/hostfs/}{d,de,p,pr,pro,s,sy}/** r, 45 /{,var/lib/snapd/hostfs/}{d,de,dev,p,pr,pro,proc,s,sy,sys}{,/} r, 46 ` 47 48 type systemBackupInterface struct { 49 commonInterface 50 } 51 52 func init() { 53 registerIface(&systemBackupInterface{commonInterface{ 54 name: "system-backup", 55 summary: systemBackupSummary, 56 implicitOnCore: true, 57 implicitOnClassic: true, 58 baseDeclarationSlots: systemBackupBaseDeclarationSlots, 59 connectedPlugAppArmor: systemBackupConnectedPlugAppArmor, 60 }}) 61 }