From df90bf242b35a9e01f721dd7ad436f1bd5d21616 Mon Sep 17 00:00:00 2001 From: Vit Mojzis Date: Mon, 9 Mar 2026 22:03:31 +0100 Subject: [PATCH] Split multi-command fix_cmds into lists This requires https://gitlab.com/setroubleshoot/setroubleshoot/-/merge_requests/54/diffs?commit_id=d5d13afa86c2bd03952c04a187657ed981c9be7e to work properly! --- src/allow_execmod.py | 3 ++- src/automount_exec_config.py | 3 ++- src/cvs_data.py | 3 ++- src/file.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/allow_execmod.py b/src/allow_execmod.py index 6e1f6bf..0a3995f 100644 --- a/src/allow_execmod.py +++ b/src/allow_execmod.py @@ -81,7 +81,8 @@ If you want this to survive a relabel, execute # semanage fcontext -a -t textrel_shlib_t '$FIX_TARGET_PATH';restorecon -v '$FIX_TARGET_PATH' """ - fix_cmd = """/usr/sbin/semanage fcontext -a -t textrel_shlib_t '$FIX_TARGET_PATH';/usr/sbin/restorecon -v '$FIX_TARGET_PATH'""" + fix_cmd = ["""/usr/sbin/semanage fcontext -a -t textrel_shlib_t '$FIX_TARGET_PATH'""", + """/usr/sbin/restorecon -v '$FIX_TARGET_PATH'"""] def init_args(self, args): if len(args) > 0: diff --git a/src/automount_exec_config.py b/src/automount_exec_config.py index a64eaf2..81ada8e 100644 --- a/src/automount_exec_config.py +++ b/src/automount_exec_config.py @@ -40,7 +40,8 @@ class plugin(Plugin): If you want to change the file context of $TARGET_PATH so that the automounter can execute it you can execute "chcon -t bin_t $TARGET_PATH". If you want this to survive a relabel, you need to permanently change the file context: execute "semanage fcontext -a -t bin_t '$FIX_TARGET_PATH'". ''') - fix_cmd = """/usr/sbin/semanage fcontext -a -t bin_t '$FIX_TARGET_PATH';/usr/sbin/restorecon -v '$FIX_TARGET_PATH'""" + fix_cmd = ["""/usr/sbin/semanage fcontext -a -t bin_t '$FIX_TARGET_PATH'""", + """/usr/sbin/restorecon -v '$FIX_TARGET_PATH'"""] if_text = 'If you want to allow automounter to execute $TARGET_PATH' diff --git a/src/cvs_data.py b/src/cvs_data.py index 7451622..1e75ead 100644 --- a/src/cvs_data.py +++ b/src/cvs_data.py @@ -46,7 +46,8 @@ class plugin(Plugin): do_text = """# semanage fcontext -a -t cvs_data_t '$FIX_TARGET_PATH' # restorecon -v '$FIX_TARGET_PATH'""" - fix_cmd = """/usr/sbin/semanage fcontext -a -t cvs_data_t '$FIX_TARGET_PATH';/usr/sbin/restorecon -v '$FIX_TARGET_PATH'""" + fix_cmd = ["""/usr/sbin/semanage fcontext -a -t cvs_data_t '$FIX_TARGET_PATH'""", + """/usr/sbin/restorecon -v '$FIX_TARGET_PATH'"""] def __init__(self): Plugin.__init__(self, __name__) diff --git a/src/file.py b/src/file.py index ac24bf9..25f3a43 100644 --- a/src/file.py +++ b/src/file.py @@ -66,7 +66,7 @@ home directory from a previous installation that did not use SELinux, 'restoreco if args == (1,0): return '/sbin/restorecon -R -v $TARGET_PATH' else: - return 'touch /.autorelabel; reboot' + return ['touch /.autorelabel', 'reboot'] def init_args(self, args): if args == (1,0): -- 2.53.0