github.com/rigado/snapd@v2.42.5-go-mod+incompatible/interfaces/builtin/bluetooth_control.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2016-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 bluetoothControlSummary = `allows managing the kernel bluetooth stack` 23 24 const bluetoothControlBaseDeclarationSlots = ` 25 bluetooth-control: 26 allow-installation: 27 slot-snap-type: 28 - core 29 deny-auto-connection: true 30 ` 31 32 const bluetoothControlConnectedPlugAppArmor = ` 33 # Description: Allow managing the kernel side Bluetooth stack. Reserved 34 # because this gives privileged access to the system. 35 36 network bluetooth, 37 # For crypto functionality the kernel offers 38 network alg, 39 40 capability net_admin, 41 42 # File accesses 43 /sys/bus/usb/drivers/btusb/ r, 44 /sys/bus/usb/drivers/btusb/** r, 45 /sys/module/btusb/ r, 46 /sys/module/btusb/** r, 47 /sys/class/bluetooth/ r, 48 /sys/devices/**/bluetooth/ rw, 49 /sys/devices/**/bluetooth/** rw, 50 51 # Requires CONFIG_BT_VHCI to be loaded 52 /dev/vhci rw, 53 54 # Device nodes for MTK combo driver 55 /dev/stpbt rw, 56 ` 57 58 const bluetoothControlConnectedPlugSecComp = ` 59 # Description: Allow managing the kernel side Bluetooth stack. Reserved 60 # because this gives privileged access to the system. 61 bind 62 ` 63 64 var bluetoothControlConnectedPlugUDev = []string{`SUBSYSTEM=="bluetooth"`, `SUBSYSTEM=="BT_chrdev"`} 65 66 func init() { 67 registerIface(&commonInterface{ 68 name: "bluetooth-control", 69 summary: bluetoothControlSummary, 70 implicitOnCore: true, 71 implicitOnClassic: true, 72 baseDeclarationSlots: bluetoothControlBaseDeclarationSlots, 73 connectedPlugAppArmor: bluetoothControlConnectedPlugAppArmor, 74 connectedPlugSecComp: bluetoothControlConnectedPlugSecComp, 75 connectedPlugUDev: bluetoothControlConnectedPlugUDev, 76 reservedForOS: true, 77 }) 78 }