mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 00:14:44 +01:00
Merge Add lsblk profile
AppArmor profile for the lsblk binary, developed and tested on Ubuntu 24.04. MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1437 Approved-by: Ryan Lee <rlee287@yahoo.com> Merged-by: John Johansen <john@jjmx.net>
This commit is contained in:
commit
e86fe8c96c
2 changed files with 45 additions and 0 deletions
38
profiles/apparmor.d/lsblk
Normal file
38
profiles/apparmor.d/lsblk
Normal file
|
@ -0,0 +1,38 @@
|
|||
#------------------------------------------------------------------
|
||||
# Copyright (C) 2024 Canonical Ltd.
|
||||
#
|
||||
# Author: Hlib Korzhynskyy <hlib.korzhynskyy@canonical.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of version 2 of the GNU General Public
|
||||
# License published by the Free Software Foundation.
|
||||
#------------------------------------------------------------------
|
||||
# vim: ft=apparmor
|
||||
#
|
||||
|
||||
abi <abi/4.0>,
|
||||
include <tunables/global>
|
||||
|
||||
profile lsblk /usr/bin/lsblk {
|
||||
include <abstractions/base>
|
||||
include <abstractions/consoles>
|
||||
include <abstractions/nameservice-strict>
|
||||
|
||||
@{sys}/block/ r,
|
||||
@{sys}/class/block/ r,
|
||||
@{sys}/dev/block/ r,
|
||||
|
||||
@{sys}/devices/pci[0-9]*:[0-9]*/** r,
|
||||
@{sys}/devices/virtual/** r,
|
||||
@{sys}/devices/platform/** r,
|
||||
|
||||
/dev/sr[0-9]* rk,
|
||||
|
||||
@{run}/udev/data/** r,
|
||||
|
||||
@{run}/mount/** r,
|
||||
@{PROC}/swaps r,
|
||||
owner @{PROC}/@{pid}/mountinfo r,
|
||||
|
||||
include if exists <local/lsblk>
|
||||
}
|
7
tests/profiles/lsblk/task.yaml
Normal file
7
tests/profiles/lsblk/task.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
summary: smoke test for the lsblk profile
|
||||
execute: |
|
||||
# The lsblk program seems to work.
|
||||
lsblk | MATCH vda1
|
||||
|
||||
# The profile is attached based on the program path.
|
||||
"$SPREAD_PATH"/tests/bin/actual-profile-of lsblk | MATCH 'lsblk \(enforce\)'
|
Loading…
Add table
Reference in a new issue