gitee.com/mysnapcore/mysnapd@v0.1.0/interfaces/builtin/ssh_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 sshKeysSummary = `allows reading ssh user configuration and keys` 23 24 const sshKeysBaseDeclarationSlots = ` 25 ssh-keys: 26 allow-installation: 27 slot-snap-type: 28 - core 29 deny-auto-connection: true 30 ` 31 32 // TODO: some distributions, namely openSUSE Tumbleweed with ssh 8.4p1, have 33 // started moving the vendor ssh configuration to other locations not included, 34 // eg. /usr/etc/ssh. The new location isn't made available inside the snap mount 35 // namespace either. 36 const sshKeysConnectedPlugAppArmor = ` 37 # Description: Can read ssh user configuration as well as public and private 38 # keys. 39 40 /usr/bin/ssh ixr, 41 /etc/ssh/ssh_config r, 42 /etc/ssh/ssh_config.d/{,**} r, 43 owner @{HOME}/.ssh/{,**} r, 44 ` 45 46 func init() { 47 registerIface(&commonInterface{ 48 name: "ssh-keys", 49 summary: sshKeysSummary, 50 implicitOnCore: true, 51 implicitOnClassic: true, 52 baseDeclarationSlots: sshKeysBaseDeclarationSlots, 53 connectedPlugAppArmor: sshKeysConnectedPlugAppArmor, 54 }) 55 }