github.com/bugraaydogar/snapd@v0.0.0-20210315170335-8c70bb858939/interfaces/builtin/kernel_module_observe.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2018 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 kernelModuleObserveSummary = `allows querying of kernel modules` 23 24 const kernelModuleObserveBaseDeclarationSlots = ` 25 kernel-module-observe: 26 allow-installation: 27 slot-snap-type: 28 - core 29 deny-auto-connection: true 30 ` 31 32 const kernelModuleObserveConnectedPlugAppArmor = ` 33 # Description: Allow querying of kernel modules. 34 /{,usr/}bin/kmod ixr, # seccomp and no SYS_MODULE prevents loading/removing 35 @{PROC}/modules r, 36 37 # Required to use SYSLOG_ACTION_READ_ALL and SYSLOG_ACTION_SIZE_BUFFER when 38 # /proc/sys/kernel/dmesg_restrict is '1' (syslog(2)). These operations are 39 # required to verify kernel modules that are loaded. This also exposes kernel 40 # pointer addresses via %pK format specifiers for processes running with this 41 # capability when accessing /proc/kallsyms, etc when kptr_restrict=1. 42 capability syslog, 43 44 # Allow reading information about loaded kernel modules 45 /sys/module/{,**} r, 46 /etc/modprobe.d/{,**} r, 47 /lib/modprobe.d/{,**} r, 48 ` 49 50 func init() { 51 registerIface(&commonInterface{ 52 name: "kernel-module-observe", 53 summary: kernelModuleObserveSummary, 54 implicitOnCore: true, 55 implicitOnClassic: true, 56 baseDeclarationSlots: kernelModuleObserveBaseDeclarationSlots, 57 connectedPlugAppArmor: kernelModuleObserveConnectedPlugAppArmor, 58 }) 59 }