github.com/chipaca/snappy@v0.0.0-20210104084008-1f06296fe8ad/interfaces/builtin/cups.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2020 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 // On systems where the slot is provided by an app snap, the cups interface is 23 // the companion interface to the cups-control interface. The design of these 24 // interfaces is based on the idea that the slot implementation (eg cupsd) is 25 // expected to query snapd to determine if the cups-control interface is 26 // connected or not for the peer client process and the print service will 27 // mediate admin functionality (ie, the rules in these interfaces allow 28 // connecting to the print service, but do not implement enforcement rules; it 29 // is up to the print service to provide enforcement). 30 const cupsSummary = `allows access to the CUPS socket for printing` 31 32 // cups is currently only available via a providing app snap and this interface 33 // assumes that the providing app snap also slots 'cups-control' (the current 34 // design allows the snap provider to slots both cups-control and cups or just 35 // cups-control (like with implicit classic or any slot provider without 36 // mediation patches), but not just cups). 37 const cupsBaseDeclarationSlots = ` 38 cups: 39 allow-installation: 40 slot-snap-type: 41 - app 42 deny-connection: true 43 deny-auto-connection: true 44 ` 45 46 const cupsConnectedPlugAppArmor = ` 47 # Allow communicating with the cups server 48 49 #include <abstractions/cups-client> 50 /{,var/}run/cups/printcap r, 51 ` 52 53 func init() { 54 registerIface(&commonInterface{ 55 name: "cups", 56 summary: cupsSummary, 57 implicitOnCore: false, 58 implicitOnClassic: false, 59 baseDeclarationSlots: cupsBaseDeclarationSlots, 60 connectedPlugAppArmor: cupsConnectedPlugAppArmor, 61 }) 62 }