feat(profile): add lsns.
This commit is contained in:
parent
8b03cff0cf
commit
4f265c6d58
2 changed files with 73 additions and 0 deletions
42
apparmor.d/groups/utils/lsns
Normal file
42
apparmor.d/groups/utils/lsns
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# 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}/lsns
|
||||||
|
profile lsns @{exec_path} flags=(attach_disconnected) {
|
||||||
|
include <abstractions/base>
|
||||||
|
include <abstractions/consoles>
|
||||||
|
include <abstractions/nameservice-strict>
|
||||||
|
|
||||||
|
capability net_admin,
|
||||||
|
capability sys_ptrace,
|
||||||
|
capability dac_read_search,
|
||||||
|
|
||||||
|
network,
|
||||||
|
|
||||||
|
ptrace read,
|
||||||
|
ptrace trace,
|
||||||
|
|
||||||
|
@{exec_path} mr,
|
||||||
|
|
||||||
|
@{att}/ r,
|
||||||
|
|
||||||
|
@{run}/*/netns/** r,
|
||||||
|
@{run}/*/ns/** r,
|
||||||
|
|
||||||
|
@{PROC}/ r,
|
||||||
|
@{PROC}/@{pid}/ r,
|
||||||
|
@{PROC}/@{pid}/stat r,
|
||||||
|
@{PROC}/@{pid}/cmdline r,
|
||||||
|
@{PROC}/@{pid}/comm r,
|
||||||
|
@{PROC}/@{pid}/fd/ r,
|
||||||
|
owner @{PROC}/@{pid}/mountinfo r,
|
||||||
|
|
||||||
|
include if exists <local/lsns>
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim:syntax=apparmor
|
||||||
31
tests/integration/utils/lsns.bats
Normal file
31
tests/integration/utils/lsns.bats
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/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 "lsns: List all namespaces" {
|
||||||
|
lsns
|
||||||
|
sudo lsns
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "lsns: List namespaces in JSON format" {
|
||||||
|
sudo lsns --json
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "lsns: List namespaces associated with the specified process" {
|
||||||
|
sudo lsns --task 1
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "lsns: List the specified type of namespaces only" {
|
||||||
|
sudo lsns --type mnt
|
||||||
|
sudo lsns --type net
|
||||||
|
sudo lsns --type ipc
|
||||||
|
sudo lsns --type user
|
||||||
|
sudo lsns --type pid
|
||||||
|
sudo lsns --type uts
|
||||||
|
sudo lsns --type cgroup
|
||||||
|
sudo lsns --type time
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue