Blame SOURCES/scap-security-guide-0.1.61-remove_tmux_process_running_check-PR_8246.patch

3bd189
From 0ffb73fe67cb5773037f62895e6fdc93195f7c38 Mon Sep 17 00:00:00 2001
3bd189
From: Gabriel Becker <ggasparb@redhat.com>
3bd189
Date: Mon, 21 Feb 2022 12:55:10 +0100
3bd189
Subject: [PATCH] Remove tmux process runinng check from
3bd189
 configure_bashrc_exec_tmux.
3bd189
3bd189
This check can cause troubles since the user must be logged to show up
3bd189
as tmux running. For example, an evaluation happening through a cron job
3bd189
wouldn't be able to make this rule work, since no terminal is being
3bd189
used.
3bd189
---
3bd189
 .../configure_bashrc_exec_tmux/oval/shared.xml     | 10 ----------
3bd189
 .../configure_bashrc_exec_tmux/rule.yml            | 14 +-------------
3bd189
 .../tests/correct_value.pass.sh                    |  1 -
3bd189
 .../tests/correct_value_d_directory.pass.sh        |  1 -
3bd189
 .../tests/duplicate_value_multiple_files.pass.sh   |  1 -
3bd189
 .../tests/tmux_not_running.fail.sh                 | 13 -------------
3bd189
 .../tests/wrong_value.fail.sh                      |  2 --
3bd189
 7 files changed, 1 insertion(+), 41 deletions(-)
3bd189
 delete mode 100644 linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/tmux_not_running.fail.sh
3bd189
3bd189
diff --git a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/oval/shared.xml b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/oval/shared.xml
3bd189
index 4cb2f9e0e04..58f91eadf66 100644
3bd189
--- a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/oval/shared.xml
3bd189
+++ b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/oval/shared.xml
3bd189
@@ -4,7 +4,6 @@
3bd189
     <criteria comment="Check exec tmux configured at the end of bashrc" operator="AND">
3bd189
       
3bd189
         test_ref="test_configure_bashrc_exec_tmux" />
3bd189
-      <criterion comment="check tmux is running" test_ref="test_tmux_running"/>
3bd189
     </criteria>
3bd189
   </definition>
3bd189
   
3bd189
@@ -18,13 +17,4 @@
3bd189
     <ind:pattern operation="pattern match">if \[ "\$PS1" \]; then\n\s+parent=\$\(ps -o ppid= -p \$\$\)\n\s+name=\$\(ps -o comm= -p \$parent\)\n\s+case "\$name" in sshd\|login\) exec tmux ;; esac\nfi</ind:pattern>
3bd189
     <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
3bd189
   </ind:textfilecontent54_object>
3bd189
-
3bd189
-  <unix:process58_test check="all" id="test_tmux_running" comment="is tmux running" version="1">
3bd189
-      <unix:object object_ref="obj_tmux_running"/>
3bd189
-  </unix:process58_test>
3bd189
-
3bd189
-  <unix:process58_object id="obj_tmux_running" version="1">
3bd189
-      <unix:command_line operation="pattern match">^tmux(?:|[\s]+.*)$</unix:command_line>
3bd189
-      <unix:pid datatype="int" operation="greater than">0</unix:pid>
3bd189
-  </unix:process58_object>
3bd189
 </def-group>
3bd189
diff --git a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/rule.yml b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/rule.yml
3bd189
index 7afc5fc5e6b..9f224748894 100644
3bd189
--- a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/rule.yml
3bd189
+++ b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/rule.yml
3bd189
@@ -8,19 +8,11 @@ description: |-
3bd189
     The <tt>tmux</tt> terminal multiplexer is used to implement
3bd189
     automatic session locking. It should be started from
3bd189
     <tt>/etc/bashrc</tt> or drop-in files within <tt>/etc/profile.d/</tt>.
3bd189
-    Additionally it must be ensured that the <tt>tmux</tt> process is running
3bd189
-    and it can be verified with the following command:
3bd189
-    
ps all | grep tmux | grep -v grep
3bd189
 
3bd189
 rationale: |-
3bd189
     Unlike <tt>bash</tt> itself, the <tt>tmux</tt> terminal multiplexer
3bd189
     provides a mechanism to lock sessions after period of inactivity.
3bd189
 
3bd189
-warnings:
3bd189
-  - general: |-
3bd189
-        The remediation does not start the tmux process, so it must be
3bd189
-        manually started or have the system rebooted after applying the fix.
3bd189
-
3bd189
 severity: medium
3bd189
 
3bd189
 identifiers:
3bd189
@@ -34,7 +26,7 @@ references:
3bd189
     stigid@ol8: OL08-00-020041
3bd189
     stigid@rhel8: RHEL-08-020041
3bd189
 
3bd189
-ocil_clause: 'exec tmux is not present at the end of bashrc or tmux process is not running'
3bd189
+ocil_clause: 'exec tmux is not present at the end of bashrc'
3bd189
 
3bd189
 ocil: |-
3bd189
     To verify that tmux is configured to execute,
3bd189
@@ -46,9 +38,5 @@ ocil: |-
3bd189
       name=$(ps -o comm= -p $parent)
3bd189
       case "$name" in sshd|login) exec tmux ;; esac
3bd189
     fi
3bd189
-    To verify that the tmux process is running,
3bd189
-    run the following command:
3bd189
-    
ps all | grep tmux | grep -v grep
3bd189
-    If the command does not produce output, this is a finding.
3bd189
 
3bd189
 platform: machine
3bd189
diff --git a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/correct_value.pass.sh b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/correct_value.pass.sh
3bd189
index 221c18665ef..fbc7590f27d 100644
3bd189
--- a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/correct_value.pass.sh
3bd189
+++ b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/correct_value.pass.sh
3bd189
@@ -9,4 +9,3 @@ if [ "$PS1" ]; then
3bd189
 fi
3bd189
 EOF
3bd189
 
3bd189
-tmux new-session -s root -d
3bd189
diff --git a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/correct_value_d_directory.pass.sh b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/correct_value_d_directory.pass.sh
3bd189
index 1702bb17e79..6107f86f248 100644
3bd189
--- a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/correct_value_d_directory.pass.sh
3bd189
+++ b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/correct_value_d_directory.pass.sh
3bd189
@@ -10,4 +10,3 @@ if [ "$PS1" ]; then
3bd189
 fi
3bd189
 EOF
3bd189
 
3bd189
-tmux new-session -s root -d
3bd189
diff --git a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/duplicate_value_multiple_files.pass.sh b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/duplicate_value_multiple_files.pass.sh
3bd189
index 16d4acfcb5a..c662221eca1 100644
3bd189
--- a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/duplicate_value_multiple_files.pass.sh
3bd189
+++ b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/duplicate_value_multiple_files.pass.sh
3bd189
@@ -17,4 +17,3 @@ if [ "$PS1" ]; then
3bd189
 fi
3bd189
 EOF
3bd189
 
3bd189
-tmux new-session -s root -d
3bd189
diff --git a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/tmux_not_running.fail.sh b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/tmux_not_running.fail.sh
3bd189
deleted file mode 100644
3bd189
index 6cb9d83efc5..00000000000
3bd189
--- a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/tmux_not_running.fail.sh
3bd189
+++ /dev/null
3bd189
@@ -1,13 +0,0 @@
3bd189
-#!/bin/bash
3bd189
-# packages = tmux
3bd189
-# remediation = none
3bd189
-
3bd189
-cat >> /etc/bashrc <<'EOF'
3bd189
-if [ "$PS1" ]; then
3bd189
-  parent=$(ps -o ppid= -p $$)
3bd189
-  name=$(ps -o comm= -p $parent)
3bd189
-  case "$name" in sshd|login) exec tmux ;; esac
3bd189
-fi
3bd189
-EOF
3bd189
-
3bd189
-killall tmux || true
3bd189
diff --git a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/wrong_value.fail.sh b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/wrong_value.fail.sh
3bd189
index f13a8b038e4..9b461654572 100644
3bd189
--- a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/wrong_value.fail.sh
3bd189
+++ b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/configure_bashrc_exec_tmux/tests/wrong_value.fail.sh
3bd189
@@ -101,5 +101,3 @@ if [ -z "$BASHRCSOURCED" ]; then
3bd189
 fi
3bd189
 # vim:ts=4:sw=4
3bd189
 EOF
3bd189
-
3bd189
-tmux new-session -s root -d