github.com/rigado/snapd@v2.42.5-go-mod+incompatible/interfaces/builtin/gpg_public_keys.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2017 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 gpgPublicKeysSummary = `allows reading gpg public keys and non-sensitive configuration` 23 24 const gpgPublicKeysBaseDeclarationSlots = ` 25 gpg-public-keys: 26 allow-installation: 27 slot-snap-type: 28 - core 29 deny-auto-connection: true 30 ` 31 32 const gpgPublicKeysConnectedPlugAppArmor = ` 33 # Description: Can read gpg public keys and non-sensitive configuration 34 35 # Allow gpg encrypt, list-keys, verify, etc 36 /usr/bin/gpg{,1,2,v} ixr, 37 /usr/share/gnupg/options.skel r, 38 39 owner @{HOME}/.gnupg/ r, 40 owner @{HOME}/.gnupg/gpg.conf r, 41 owner @{HOME}/.gnupg/openpgp-revocs.d/{,*} r, 42 owner @{HOME}/.gnupg/pubring.gpg r, 43 owner @{HOME}/.gnupg/pubring.kbx r, 44 owner @{HOME}/.gnupg/trustedkeys.gpg r, 45 46 owner @{HOME}/.gnupg/trustdb.gpg r, 47 # gpg sometimes updates the trustdb to decide whether or not to update the 48 # trustdb. For now, silence the denial since no other policy references this 49 deny @{HOME}/.gnupg/trustdb.gpg w, 50 ` 51 52 func init() { 53 registerIface(&commonInterface{ 54 name: "gpg-public-keys", 55 summary: gpgPublicKeysSummary, 56 implicitOnCore: true, 57 implicitOnClassic: true, 58 baseDeclarationSlots: gpgPublicKeysBaseDeclarationSlots, 59 connectedPlugAppArmor: gpgPublicKeysConnectedPlugAppArmor, 60 reservedForOS: true, 61 }) 62 }