diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-03-30 16:46:52 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-04-16 13:13:06 -0400 |
commit | 179f02621554e08005df005c162eba482f808c60 (patch) | |
tree | 5f5fb7bb37f16621275e2c162ae5a9b157fc308e /test/system | |
parent | b3ef9e4dd8f91326b1f5e85360679ec5ffd213f9 (diff) | |
download | podman-179f02621554e08005df005c162eba482f808c60.tar.gz podman-179f02621554e08005df005c162eba482f808c60.tar.bz2 podman-179f02621554e08005df005c162eba482f808c60.zip |
Don't relabel volumes if running in a privileged container
Docker does not relabel this content, and openstack is running
containers in this manner. There is a penalty for doing this
on each container, that is not worth taking on a disable SELinux
container.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r-- | test/system/410-selinux.bats | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/system/410-selinux.bats b/test/system/410-selinux.bats index 4a2c7b7a4..8a690fb48 100644 --- a/test/system/410-selinux.bats +++ b/test/system/410-selinux.bats @@ -191,5 +191,33 @@ function check_label() { is "$output" "Error.*: \`/proc/thread-self/attr/exec\`: OCI runtime error: unable to assign security attribute" "useful diagnostic" } +@test "podman selinux: check relabel" { + skip_if_no_selinux + + LABEL="system_u:object_r:tmp_t:s0" + tmpdir=$PODMAN_TMPDIR/vol + touch $tmpdir + chcon -vR ${LABEL} $tmpdir + ls -Z $tmpdir + + run_podman run -v $tmpdir:/test $IMAGE cat /proc/self/attr/current + level=$(secon -l $output) + run ls -dZ ${tmpdir} + is "$output" ${LABEL} "No Relabel Correctly" + + run_podman run -v $tmpdir:/test:Z --security-opt label=disable $IMAGE cat /proc/self/attr/current + level=$(secon -l $output) + run ls -dZ $tmpdir + is "$output" ${LABEL} "No Privileged Relabel Correctly" + + run_podman run -v $tmpdir:/test:Z $IMAGE cat /proc/self/attr/current + level=$(secon -l $output) + run ls -dZ $tmpdir + is "$output" "system_u:object_r:container_file_t:$level" "Confined Relabel Correctly" + + run_podman run -v $tmpdir:/test:z $IMAGE cat /proc/self/attr/current + run ls -dZ $tmpdir + is "$output" "system_u:object_r:container_file_t:s0" "Shared Relabel Correctly" +} # vim: filetype=sh |