feat(profile): add pidof
This commit is contained in:
parent
6b5fad404b
commit
771dd9b589
2 changed files with 37 additions and 0 deletions
18
apparmor.d/groups/procps/pidof
Normal file
18
apparmor.d/groups/procps/pidof
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# apparmor.d - Full set of apparmor profiles
|
||||
# Copyright (C) 2025 Alexandre Pujol <alexandre@pujol.io>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
abi <abi/4.0>,
|
||||
|
||||
include <tunables/global>
|
||||
|
||||
@{exec_path} = @{bin}/pidof
|
||||
profile pidof @{exec_path} {
|
||||
include <abstractions/base>
|
||||
|
||||
@{exec_path} mr,
|
||||
|
||||
include if exists <local/pidof>
|
||||
}
|
||||
|
||||
# vim:syntax=apparmor
|
||||
19
tests/integration/procps/pidof.bats
Normal file
19
tests/integration/procps/pidof.bats
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bats
|
||||
# apparmor.d - Full set of apparmor profiles
|
||||
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
load ../common
|
||||
|
||||
@test "pidof: List all process IDs with given name" {
|
||||
pidof systemd
|
||||
pidof bash
|
||||
}
|
||||
|
||||
@test "pidof: List a single process ID with given name" {
|
||||
pidof -s bash
|
||||
}
|
||||
|
||||
@test "pidof: List process IDs including scripts with given name" {
|
||||
pidof -x bash
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue