Skip to contentSkip to conversation

policy/test_filesystem.te: fix policy for NFS over a symlinked directory

PATCH In review Ondrej Mosnacek 2 participants 3 messages Sep 9, 2024 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 policy/test_filesystem.te: fix policy for NFS over a symlinked directory

When the curret directory is a symlink to the actual selinux-testsuite directory, running ./tools/nfs.sh would fail at nfs_filesystem/test due to missing policy rules. Add the necessary rules so that it can pass also in this scenario.

---
 policy/test_filesystem.te | 2 ++
 1 file changed, 2 insertions(+)
policy/test_filesystem.te +2 -0
index efe1f4d..f60b0c8 100644
@@ -31,6 +31,7 @@ allow test_filesystem_t test_file_t:dir { add_name mounton read write remove_nam
 # Create test file
 allow test_filesystem_t test_filesystem_file_t:dir { read add_name write search mounton };
 allow test_filesystem_t test_filesystem_file_t:file { open getattr create read write relabelfrom relabelto };
+allow test_filesystem_t test_filesystem_file_t:lnk_file { read };
 
 fs_mount_all_fs(test_filesystem_t)
 fs_remount_all_fs(test_filesystem_t)
@@ -44,6 +45,7 @@ fs_getattr_xattr_fs(test_filesystem_t)
 
 # Required when running the tests on a labeled NFS mount.
 fs_getattr_nfs(test_filesystem_t)
+fs_read_nfs_symlinks(test_filesystem_t)
 
 # Update quotas
 fs_set_all_quotas(test_filesystem_t)
Signature · 1 line
2.46.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Ondrej Mosnacek

When the curret directory is a symlink to the actual selinux-testsuite

s/curret/current/

Quoted 5 lines

directory, running ./tools/nfs.sh would fail at nfs_filesystem/test due to missing policy rules. Add the necessary rules so that it can pass also in this scenario.

Otherwise,

Quoted 27 lines
---
 policy/test_filesystem.te | 2 ++
 1 file changed, 2 insertions(+)
policy/test_filesystem.te +2 -1
index efe1f4d..f60b0c8 100644
@@ -31,6 +31,7 @@ allow test_filesystem_t test_file_t:dir { add_name mounton read write remove_nam
 # Create test file
 allow test_filesystem_t test_filesystem_file_t:dir { read add_name write search mounton };
 allow test_filesystem_t test_filesystem_file_t:file { open getattr create read write relabelfrom relabelto };
+allow test_filesystem_t test_filesystem_file_t:lnk_file { read };
 
 fs_mount_all_fs(test_filesystem_t)
 fs_remount_all_fs(test_filesystem_t)
@@ -44,6 +45,7 @@ fs_getattr_xattr_fs(test_filesystem_t)
 
 # Required when running the tests on a labeled NFS mount.
 fs_getattr_nfs(test_filesystem_t)
+fs_read_nfs_symlinks(test_filesystem_t)
 
 # Update quotas
 fs_set_all_quotas(test_filesystem_t)
--

2.46.0

#2 lore raw
Quoted 7 lines · Stephen Smalley
Quoted 2 lines · Ondrej Mosnacek

When the curret directory is a symlink to the actual selinux-testsuite

s/curret/current/

Quoted 8 lines
Quoted 5 lines

directory, running ./tools/nfs.sh would fail at nfs_filesystem/test due to missing policy rules. Add the necessary rules so that it can pass also in this scenario.

Otherwise,

Thanks, fixed and applied:
https://github.com/SELinuxProject/selinux-testsuite/commit/82cdcae9e3e8c506c37d900d497e94da70728799

Signature · 3 lines
Ondrej Mosnacek
Senior Software Engineer, Linux Security - SELinux kernel
Red Hat, Inc.