Skip to content

Commit

Permalink
Update the bootupd policy
Browse files Browse the repository at this point in the history
In particular, the following permissions were allowed:
- allow read files in /sysroot, which have root_t type
- allow read udev pid files in case lsblk was executed from bootupd
  so no transition to udev applied
- root_t as the default file context for /sysroot/.aleph-version.json

Resolves: rhbz#2320395
Resolves: #2362
  • Loading branch information
zpytela committed Nov 19, 2024
1 parent 87abd28 commit d307fa8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions policy/modules/contrib/bootupd.te
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ domain_use_interactive_fds(bootupd_t)
files_create_boot_dirs(bootupd_t)
files_read_etc_files(bootupd_t)
files_manage_boot_files(bootupd_t)
files_read_root_files(bootupd_t)

fs_getattr_all_fs(bootupd_t)
fs_manage_dos_dirs(bootupd_t)
Expand All @@ -63,6 +64,7 @@ optional_policy(`

optional_policy(`
udev_domtrans(bootupd_t)
udev_read_pid_files(bootupd_t)
')

optional_policy(`
Expand Down
1 change: 1 addition & 0 deletions policy/modules/kernel/files.fc
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,5 @@ ifndef(`distro_redhat',`
/nsr(/.*)? gen_context(system_u:object_r:var_t,s0)
/nsr/logs(/.*)? gen_context(system_u:object_r:var_log_t,s0)

/sysroot/.aleph-version.json gen_context(system_u:object_r:root_t,s0)
/sysroot/ostree/deploy/.*-atomic/deploy(/.*)? gen_context(system_u:object_r:root_t,s0)
18 changes: 18 additions & 0 deletions policy/modules/kernel/files.if
Original file line number Diff line number Diff line change
Expand Up @@ -2870,6 +2870,24 @@ interface(`files_root_filetrans',`
filetrans_pattern($1, root_t, $2, $3, $4)
')

########################################
## <summary>
## Read files in the root directory.
## </summary>
## <param name="domain">
## <summary>
## Domain to not audit.
## </summary>
## </param>
#
interface(`files_read_root_files',`
gen_require(`
type root_t;
')

read_files_pattern($1, root_t, root_t)
')

########################################
## <summary>
## Do not audit attempts to read files in
Expand Down

0 comments on commit d307fa8

Please sign in to comment.