Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow kernel_t to manage and relabel all files #1893

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions policy/modules/kernel/files.if
Original file line number Diff line number Diff line change
Expand Up @@ -1765,8 +1765,12 @@ interface(`files_relabel_all_files',`
relabel_chr_files_pattern($1, { file_type $2 }, { file_type $2 })

# satisfy the assertions:
seutil_relabelto_bin_policy($1)
auth_relabelto_shadow($1)
optional_policy(`
seutil_relabelto_bin_policy($1)
')
optional_policy(`
auth_relabelto_shadow($1)
')
')

########################################
Expand Down Expand Up @@ -1835,6 +1839,44 @@ interface(`files_manage_all_files',`
')
')

########################################
## <summary>
## Manage all block device files on the filesystem.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`files_manage_all_blk_files',`
gen_require(`
attribute file_type;
')

manage_blk_files_pattern($1, file_type, file_type)
')

########################################
## <summary>
## Manage all character device files on the filesystem.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`files_manage_all_chr_files',`
gen_require(`
attribute file_type;
')

manage_chr_files_pattern($1, file_type, file_type)
')

########################################
## <summary>
## Grant execute access to all files on the filesystem,
Expand Down
3 changes: 3 additions & 0 deletions policy/modules/kernel/kernel.te
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@ domain_rw_all_sockets(kernel_t)
domain_obj_id_change_exemption(kernel_t)

files_manage_all_files(kernel_t)
files_manage_all_blk_files(kernel_t)
files_manage_all_chr_files(kernel_t)
files_relabel_all_files(kernel_t)
# The 'execute' permission on lower inodes is checked against the mounter
# cred by overlayfs, so we need to grant it to allow overlay mounts created
# during early boot to work.
Expand Down