Bug 2193120

Summary: Please explain the idea behing xccdf_org.ssgproject.content_rule_configure_bashrc_tmux rule ("Support session locking with tmux (not enforcing)")
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: scap-security-guideAssignee: Vojtech Polasek <vpolasek>
Status: CLOSED MIGRATED QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.7CC: bwelterl, ggasparb, matyc, mhaicman, mlysonek, wsato
Target Milestone: rcKeywords: MigratedToJIRA, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-10 13:47:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Renaud Métrich 2023-05-04 11:40:26 UTC
Description of problem:

With scap-security-guide, we ship 2 "similar" rules:

- xccdf_org.ssgproject.content_rule_configure_bashrc_tmux ("Support session locking with tmux (not enforcing)")

  which ships the following snippet:
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  if [ "$PS1" ]; then
   parent=$(ps -o ppid= -p $$)
   name=$(ps -o comm= -p $parent)
   case "$name" in (sshd|login) tmux ;; esac
  fi
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

- xccdf_org.ssgproject.content_rule_configure_bashrc_exec_tmux ("Support session locking with tmux")

  which ships the following snippet:
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  if [ "$PS1" ]; then
   parent=$(ps -o ppid= -p $$)
   name=$(ps -o comm= -p $parent)
   case "$name" in (sshd|login) exec tmux ;; esac
  fi
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The difference being "exec tmux" in second rule, compared to just "tmux" in first rule.

Please explain why we ship xccdf_org.ssgproject.content_rule_configure_bashrc_tmux ("Support session locking with tmux (not enforcing)") at all, implementing this rule leads to non-sense when logging in, as shown in the example below:

1. ssh to the system

  --> tmux started and "tmux prompt" is displayed

2. exit from tmux

  --> initial "ssh" shell prompt is displayed


In a nutshell, once you do "ssh" on the system, you need to exit TWICE to get out of ssh. This is because it spawns "tmux" instead of "exec tmux" in first rule.
This doesn't make any sense to me.

Version-Release number of selected component (if applicable):

scap-security-guide

How reproducible:

Always, see above.

Comment 1 Watson Yuuma Sato 2023-05-04 15:43:15 UTC
Hi Renaud,

Thank you for the feedback.
The rule configure_bashrc_tmux was created to align with a change in RHEL-08-020041 RHEL8 STIG V1R9.
For reference: https://stigaview.com/products/rhel8/v1r9/RHEL-08-020041/

At the time of development we note the described behavior and briefly discussed the scope and impact of the change with DISA.
But as a STIG update is in effect the moment it is released, we opted to keep the profile aligned with the STIG guidance.

To minimize the impact of the change, we added a warning about this to the rule description:
"This rule configures Tmux to be executed in a way that exiting Tmux drops the user into a regular shell instead of logging them out, therefore the session locking mechanism is not enforced on the user."

We will get back with DISA to discuss RHEL-08-020041.

Comment 4 Renaud Métrich 2023-05-09 12:14:11 UTC
Thanks Watson for the explanation and reporting to DISA.

Comment 6 RHEL Program Management 2023-08-10 13:47:17 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues.