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