From 7b3ede7b2998cfe965fa562981148c2e5561132e Mon Sep 17 00:00:00 2001 From: Adam Chalkley Date: Tue, 11 Jul 2023 06:20:07 -0500 Subject: [PATCH] Update RPM postinstall scripts to use restorecon Replace calls to `chcon` and explicit context details with `restorecon` to allow inheriting previously configured SELinux settings. refs atc0005/todo#63 --- packages/dev/scripts/rpm/postinstall.sh | 8 +------- packages/stable/scripts/rpm/postinstall.sh | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/dev/scripts/rpm/postinstall.sh b/packages/dev/scripts/rpm/postinstall.sh index f6a2c749..76b282b9 100644 --- a/packages/dev/scripts/rpm/postinstall.sh +++ b/packages/dev/scripts/rpm/postinstall.sh @@ -40,13 +40,7 @@ if [ -x "$(command -v selinuxenabled)" ]; then do echo -e "\tApplying SELinux contexts on ${plugin_path}/${plugin_name}${plugin_name_suffix}" - - chcon \ - --verbose \ - -t nagios_unconfined_plugin_exec_t \ - -u system_u \ - -r object_r \ - "${plugin_path}/${plugin_name}${plugin_name_suffix}" + restorecon -v ${plugin_path}/${plugin_name} if [ $? -eq 0 ]; then echo -e "\t[OK] Successfully applied SELinux contexts on ${plugin_path}/${plugin_name}${plugin_name_suffix}" diff --git a/packages/stable/scripts/rpm/postinstall.sh b/packages/stable/scripts/rpm/postinstall.sh index 548b16b0..23661445 100644 --- a/packages/stable/scripts/rpm/postinstall.sh +++ b/packages/stable/scripts/rpm/postinstall.sh @@ -40,13 +40,7 @@ if [ -x "$(command -v selinuxenabled)" ]; then do echo -e "\tApplying SELinux contexts on ${plugin_path}/${plugin_name}${plugin_name_suffix}" - - chcon \ - --verbose \ - -t nagios_unconfined_plugin_exec_t \ - -u system_u \ - -r object_r \ - "${plugin_path}/${plugin_name}${plugin_name_suffix}" + restorecon -v ${plugin_path}/${plugin_name} if [ $? -eq 0 ]; then echo -e "\t[OK] Successfully applied SELinux contexts on ${plugin_path}/${plugin_name}${plugin_name_suffix}"