Skip to content

Commit

Permalink
tests/kola: add SELinux systemd /var/cache exceptions in upgrade test
Browse files Browse the repository at this point in the history
  • Loading branch information
dustymabe committed Oct 24, 2024
1 parent 2d0fce6 commit d659db6
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tests/kola/upgrade/extended/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,20 @@ selinux-sanity-check() {
mislabeled="$(restorecon -vnr /var/ /etc/ /usr/ /boot/)"
if [ -n "${mislabeled}" ]; then
# Exceptions for files that could be wrong (sometimes upgrades are messy)
# Would relabel /var/lib/cni from system_u:object_r:var_lib_t:s0 to system_u:object_r:container_var_lib_t:s0
# Would relabel /etc/selinux/targeted/semanage.read.LOCK from system_u:object_r:semanage_trans_lock_t:s0 to system_u:object_r:selinux_config_t:s0
# Would relabel /etc/selinux/targeted/semanage.trans.LOCK from system_u:object_r:semanage_trans_lock_t:s0 to system_u:object_r:selinux_config_t:s0
# Would relabel /etc/systemd/journald.conf.d from system_u:object_r:etc_t:s0 to system_u:object_r:systemd_conf_t:s0
# Would relabel /etc/systemd/journald.conf.d/forward-to-console.conf from system_u:object_r:etc_t:s0 to system_u:object_r:systemd_conf_t:s0
# Would relabel /boot/lost+found from system_u:object_r:unlabeled_t:s0 to system_u:object_r:lost_found_t:s0' ']'
# Would relabel /var/lib/systemd/home from system_u:object_r:init_var_lib_t:s0 to system_u:object_r:systemd_homed_library_dir_t:s0
# - Would relabel /var/lib/cni from system_u:object_r:var_lib_t:s0 to system_u:object_r:container_var_lib_t:s0
# - Would relabel /etc/selinux/targeted/semanage.read.LOCK from system_u:object_r:semanage_trans_lock_t:s0 to system_u:object_r:selinux_config_t:s0
# - Would relabel /etc/selinux/targeted/semanage.trans.LOCK from system_u:object_r:semanage_trans_lock_t:s0 to system_u:object_r:selinux_config_t:s0
# - Would relabel /etc/systemd/journald.conf.d from system_u:object_r:etc_t:s0 to system_u:object_r:systemd_conf_t:s0
# - Would relabel /etc/systemd/journald.conf.d/forward-to-console.conf from system_u:object_r:etc_t:s0 to system_u:object_r:systemd_conf_t:s0
# - Would relabel /boot/lost+found from system_u:object_r:unlabeled_t:s0 to system_u:object_r:lost_found_t:s0' ']'
# - Would relabel /var/lib/systemd/home from system_u:object_r:init_var_lib_t:s0 to system_u:object_r:systemd_homed_library_dir_t:s0
# - 39.20230916.1.1->41.20240928.10.1
# - https://github.com/fedora-selinux/selinux-policy/commit/3ba70ae27d067f7edc0a52ff722511c5ada724f2
# - Would relabel /var/cache/systemd from system_u:object_r:var_t:s0 to system_u:object_r:systemd_cache_t:s0
# Would relabel /var/cache/systemd/home from system_u:object_r:var_t:s0 to system_u:object_r:systemd_homed_cache_t:s0
# - 38.20230322.1.0->42.20241023.91.0
# - https://github.com/fedora-selinux/selinux-policy/commit/b08568ca696f14d3232adef6a291ebb0ec80ba46
# - https://github.com/coreos/fedora-coreos-tracker/issues/1819
declare -A exceptions=(
['/var/lib/cni']=1
['/etc/selinux/targeted/semanage.read.LOCK']=1
Expand All @@ -192,6 +197,8 @@ selinux-sanity-check() {
['/etc/systemd/journald.conf.d/forward-to-console.conf']=1
['/boot/lost+found']=1
['/var/lib/systemd/home']=1
['/var/cache/systemd']=1
['/var/cache/systemd/home']=1
)
paths="$(echo "${mislabeled}" | grep "Would relabel" | cut -d ' ' -f 3)"
found=""
Expand Down

0 comments on commit d659db6

Please sign in to comment.