Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1844431

Summary: xccdf_org.ssgproject.content_rule_sshd_do_not_permit_user_env rule is broken
Product: Red Hat Enterprise Linux 7 Reporter: Renaud Métrich <rmetrich>
Component: scap-security-guideAssignee: Vojtech Polasek <vpolasek>
Status: CLOSED ERRATA QA Contact: Matus Marhefka <mmarhefk>
Severity: high Docs Contact:
Priority: high    
Version: 7.8CC: dapospis, ggasparb, mhaicman, mpoole, vpolasek, wsato
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: lcervako: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-29 19:52:42 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 2020-06-05 11:44:48 UTC
Description of problem:

On my RHEL 7.8 system, the xccdf_org.ssgproject.content_rule_sshd_do_not_permit_user_env rule reports FAIL when "PermitUserEnvironment no" or not set in /etc/ssh/sshd_config.
It should report PASS when "PermitUserEnvironment no" is set, FAIL otherwise.

Looks like a regression compared to RHEL 7.5 (scap-security-guide-0.1.36-10.el7_5.noarch)

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

scap-security-guide-0.1.46-11.el7.noarch


How reproducible:

Always


Steps to Reproduce:
1. Set "PermitUserEnvironment no" in /etc/ssh/sshd_config and execute the rule

  # oscap xccdf eval --fetch-remote-resources --profile xccdf_org.ssgproject.content_profile_C2S --rule xccdf_org.ssgproject.content_rule_sshd_do_not_permit_user_env /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml

Title   Do Not Allow SSH Environment Options
Rule    xccdf_org.ssgproject.content_rule_sshd_do_not_permit_user_env
Ident   CCE-27363-1
Result  fail

2. Set "PermitUserEnvironment yes" in /etc/ssh/sshd_config and execute the rule

  # oscap xccdf eval --fetch-remote-resources --profile xccdf_org.ssgproject.content_profile_C2S --rule xccdf_org.ssgproject.content_rule_sshd_do_not_permit_user_env /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml

Title   Do Not Allow SSH Environment Options
Rule    xccdf_org.ssgproject.content_rule_sshd_do_not_permit_user_env
Ident   CCE-27363-1
Result  pass


Expected results:

The opposite (we want to have "PermitUserEnvironment no")


Additional infos:

Rule:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
        <ns6:textfilecontent54_test check="all" check_existence="all_exist" comment="tests the value of PermitUserEnvironment setting in the /etc/ssh/sshd_config file" id="oval:ssg-test_sshd_do_not_permit_user_env:tst:1" version="1">
          <ns6:object object_ref="oval:ssg-obj_sshd_do_not_permit_user_env:obj:1"/>
          <ns6:state state_ref="oval:ssg-state_sshd_do_not_permit_user_env:ste:1"/>
        </ns6:textfilecontent54_test>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Object: (content of /etc/ssh/sshd_config)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
        <ns6:textfilecontent54_object id="oval:ssg-obj_sshd_do_not_permit_user_env:obj:1" version="1">
          <ns6:filepath>/etc/ssh/sshd_config</ns6:filepath>
          <ns6:pattern operation="pattern match">^[ \t]*(?i)PermitUserEnvironment(?-i)[ \t]+(.+?)[ \t]*(?:$|#)</ns6:pattern>
          <ns6:instance datatype="int" operation="greater than or equal">1</ns6:instance>
        </ns6:textfilecontent54_object>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

State: 
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
        <ns6:textfilecontent54_state id="oval:ssg-state_sshd_do_not_permit_user_env:ste:1" version="1">
          <ns6:subexpression datatype="string" operation="pattern match">^yes$</ns6:subexpression>
        </ns6:textfilecontent54_state>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Here we can see that the state is checked against "yes" instead of "no".

Comment 11 errata-xmlrpc 2020-09-29 19:52:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (scap-security-guide bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:3909