mirror of
https://github.com/systemd/systemd.git
synced 2025-09-10 22:52:49 +02:00
test: Add test for nspawn's handling of cap_net_bind_service
This commit is contained in:
@@ -1470,4 +1470,22 @@ testcase_link_journal_host() {
|
||||
rm -fr "$root"
|
||||
}
|
||||
|
||||
testcase_cap_net_bind_service() {
|
||||
local root
|
||||
|
||||
root="$(mktemp -d /var/lib/machines/TEST-13-NSPAWN.cap-net-bind-service.XXX)"
|
||||
create_dummy_container "$root"
|
||||
|
||||
# Check that CAP_NET_BIND_SERVICE is available without --private-users
|
||||
systemd-nspawn --register=no --directory="$root" capsh --has-p=cap_net_bind_service
|
||||
|
||||
# Check that CAP_NET_BIND_SERVICE is not available with --private-users=identity
|
||||
(! systemd-nspawn --register=no --directory="$root" --private-users=identity capsh --has-p=cap_net_bind_service)
|
||||
|
||||
# Check that CAP_NET_BIND_SERVICE is not available with --private-users=pick
|
||||
(! systemd-nspawn --register=no --directory="$root" --private-users=pick capsh --has-p=cap_net_bind_service)
|
||||
|
||||
rm -fr "$root"
|
||||
}
|
||||
|
||||
run_testcases
|
||||
|
||||
Reference in New Issue
Block a user