Skip to content

Commit

Permalink
Merge pull request #731 from yizhao1/rpm
Browse files Browse the repository at this point in the history
rpm: fixes for dnf
  • Loading branch information
pebenito authored Nov 17, 2023
2 parents 0b148c0 + 100a853 commit 662502a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions policy/modules/admin/rpm.fc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ ifdef(`distro_redhat',`
/var/cache/yum(/.*)? gen_context(system_u:object_r:rpm_var_cache_t,s0)

/var/lib/alternatives(/.*)? gen_context(system_u:object_r:rpm_var_lib_t,s0)
/var/lib/dnf(/.*)? gen_context(system_u:object_r:rpm_var_lib_t,s0)
/var/lib/rpm(/.*)? gen_context(system_u:object_r:rpm_var_lib_t,s0)
/var/lib/YaST2(/.*)? gen_context(system_u:object_r:rpm_var_lib_t,s0)
/var/lib/yum(/.*)? gen_context(system_u:object_r:rpm_var_lib_t,s0)
Expand Down
20 changes: 20 additions & 0 deletions policy/modules/admin/rpm.if
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,26 @@ interface(`rpm_manage_script_tmp_files',`
manage_files_pattern($1, rpm_script_tmp_t, rpm_script_tmp_t)
')

#####################################
## <summary>
## Read rpm temporary files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`rpm_read_tmp_files',`
gen_require(`
type rpm_tmp_t;
')

files_search_tmp($1)
read_files_pattern($1, rpm_tmp_t, rpm_tmp_t)
read_lnk_files_pattern($1, rpm_tmp_t, rpm_tmp_t)
')

#####################################
## <summary>
## Append rpm temporary files.
Expand Down
5 changes: 5 additions & 0 deletions policy/modules/admin/rpm.te
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ seutil_read_file_contexts(rpm_t)
userdom_use_user_terminals(rpm_t)
userdom_use_unpriv_users_fds(rpm_t)

ifdef(`init_systemd', `
systemd_use_logind_fds(rpm_t)
systemd_dbus_chat_logind(rpm_t)
')

optional_policy(`
cron_system_entry(rpm_t, rpm_exec_t)
')
Expand Down
5 changes: 5 additions & 0 deletions policy/modules/admin/usermanage.te
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ files_relabel_etc_files(groupadd_t)
files_read_etc_runtime_files(groupadd_t)
files_read_usr_symlinks(groupadd_t)

kernel_getattr_proc(groupadd_t)
kernel_read_kernel_sysctls(groupadd_t)

# Execute /usr/bin/{passwd, chfn, chsh} and /usr/sbin/{useradd, vipw}.
Expand Down Expand Up @@ -277,6 +278,8 @@ optional_policy(`
optional_policy(`
rpm_use_fds(groupadd_t)
rpm_rw_pipes(groupadd_t)
rpm_read_tmp_files(groupadd_t)
rpm_append_tmp_files(groupadd_t)
')

optional_policy(`
Expand Down Expand Up @@ -589,6 +592,8 @@ optional_policy(`
optional_policy(`
rpm_use_fds(useradd_t)
rpm_rw_pipes(useradd_t)
rpm_read_tmp_files(useradd_t)
rpm_append_tmp_files(useradd_t)
')

optional_policy(`
Expand Down

0 comments on commit 662502a

Please sign in to comment.