From aa1d1ca5643655a97c9d115fc1dfc8e7ee6a69d9 Mon Sep 17 00:00:00 2001 From: Odin Ugedal Date: Wed, 7 Jul 2021 15:41:23 +0200 Subject: [PATCH] tests/int/dev: add CAP_SYSLOG to /dev/kmsg tests Add CAP_SYSLOG to ensure that /dev/kmsg can be accesses on systems where the sysctl kernel.dmesg_restrict = 1. Signed-off-by: Odin Ugedal (cherry picked from commit 6be088d69ddfb04cf13076b363e3321ba43a6728) Signed-off-by: Kir Kolyshkin --- tests/integration/dev.bats | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/integration/dev.bats b/tests/integration/dev.bats index 35a9ac065..01f677859 100644 --- a/tests/integration/dev.bats +++ b/tests/integration/dev.bats @@ -38,6 +38,10 @@ function teardown() { update_config ' .linux.resources.devices = [{"allow": false, "access": "rwm"}] | .linux.devices = [{"path": "/dev/kmsg", "type": "c", "major": 1, "minor": 11}] + | .process.capabilities.bounding += ["CAP_SYSLOG"] + | .process.capabilities.effective += ["CAP_SYSLOG"] + | .process.capabilities.inheritable += ["CAP_SYSLOG"] + | .process.capabilities.permitted += ["CAP_SYSLOG"] | .process.args |= ["sh"]' runc run -d --console-socket "$CONSOLE_SOCKET" test_deny @@ -72,6 +76,10 @@ function teardown() { update_config ' .linux.resources.devices = [{"allow": false, "access": "rwm"},{"allow": true, "type": "c", "major": 1, "minor": 11, "access": "rw"}] | .linux.devices = [{"path": "/dev/kmsg", "type": "c", "major": 1, "minor": 11}] | .process.args |= ["sh"] + | .process.capabilities.bounding += ["CAP_SYSLOG"] + | .process.capabilities.effective += ["CAP_SYSLOG"] + | .process.capabilities.inheritable += ["CAP_SYSLOG"] + | .process.capabilities.permitted += ["CAP_SYSLOG"] | .hostname = "myhostname"' runc run -d --console-socket "$CONSOLE_SOCKET" test_allow_char