Skip to content

Commit

Permalink
systemd: Drop second parameter in systemd_tmpfilesd_managed().
Browse files Browse the repository at this point in the history
systemd-tmpfiles can manage various file classes but the permissions
vary depending on the class.

Signed-off-by: Chris PeBenito <[email protected]>
  • Loading branch information
pebenito committed May 7, 2021
1 parent cd78313 commit 460d0eb
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion policy/modules/kernel/devices.te
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fs_xattr_type(device_t)
fs_use_trans devtmpfs gen_context(system_u:object_r:device_t,s0);

optional_policy(`
systemd_tmpfilesd_managed(device_t, fifo_file)
systemd_tmpfilesd_managed(device_t)
')

#
Expand Down
2 changes: 1 addition & 1 deletion policy/modules/kernel/files.te
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ files_runtime_file(var_run_t)
files_mountpoint(var_run_t)

optional_policy(`
systemd_tmpfilesd_managed(var_run_t, lnk_file)
systemd_tmpfilesd_managed(var_run_t)
')

#
Expand Down
2 changes: 1 addition & 1 deletion policy/modules/services/dbus.te
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ optional_policy(`
systemd_use_inherited_machined_ptys(system_dbusd_t)

# allow populating of /var/lib/dbus by systemd-tmpfilesd
systemd_tmpfilesd_managed(system_dbusd_var_lib_t, dir)
systemd_tmpfilesd_managed(system_dbusd_var_lib_t)
')

optional_policy(`
Expand Down
4 changes: 2 additions & 2 deletions policy/modules/system/authlogin.te
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ type wtmp_t;
logging_log_file(wtmp_t)

optional_policy(`
systemd_tmpfilesd_managed(faillog_t, { dir file })
systemd_tmpfilesd_managed(var_auth_t, dir)
systemd_tmpfilesd_managed(faillog_t)
systemd_tmpfilesd_managed(var_auth_t)
')

########################################
Expand Down
2 changes: 1 addition & 1 deletion policy/modules/system/lvm.te
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ files_type(lvm_etc_t)
type lvm_lock_t;
files_lock_file(lvm_lock_t)
optional_policy(`
systemd_tmpfilesd_managed(lvm_lock_t, dir)
systemd_tmpfilesd_managed(lvm_lock_t)
')

type lvm_metadata_t;
Expand Down
2 changes: 1 addition & 1 deletion policy/modules/system/miscfiles.te
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type man_t alias catman_t;
files_type(man_t)

optional_policy(`
systemd_tmpfilesd_managed(man_t, dir)
systemd_tmpfilesd_managed(man_t)
')

type man_cache_t;
Expand Down
20 changes: 11 additions & 9 deletions policy/modules/system/systemd.if
Original file line number Diff line number Diff line change
Expand Up @@ -1710,16 +1710,11 @@ interface(`systemd_relabelto_tmpfiles_conf_files',`

#######################################
## <summary>
## Allow systemd_tmpfiles_t to manage filesystem objects
## Allow systemd_tmpfiles_t to manage filesystem objects
## </summary>
## <param name="type">
## <summary>
## type of object to manage
## </summary>
## </param>
## <param name="class">
## <summary>
## object class to manage
## Type of object to manage
## </summary>
## </param>
#
Expand All @@ -1728,8 +1723,15 @@ interface(`systemd_tmpfilesd_managed',`
type systemd_tmpfiles_t;
')

allow systemd_tmpfiles_t $1:dir list_dir_perms;
allow systemd_tmpfiles_t $1:$2 { setattr relabelfrom relabelto create };
allow systemd_tmpfiles_t $1:dir { manage_dir_perms relabel_dir_perms };
allow systemd_tmpfiles_t $1:file { create setattr unlink write_file_perms relabel_file_perms };
allow systemd_tmpfiles_t $1:lnk_file { create setattr unlink relabel_lnk_file_perms };
allow systemd_tmpfiles_t $1:fifo_file { create setattr unlink relabel_fifo_file_perms };

ifelse(`$2',`',`',`
refpolicywarn(`$0($*) second parameter is deprecated.')
allow systemd_tmpfiles_t $1:$2 { setattr relabelfrom relabelto create };
')
')

########################################
Expand Down

0 comments on commit 460d0eb

Please sign in to comment.