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 1750526 - open scap remediation script: ssg-rhel8-role-ospp.sh placing duplicate entries into /etc/selinux/config file.
Summary: open scap remediation script: ssg-rhel8-role-ospp.sh placing duplicate entrie...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: scap-security-guide
Version: 8.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: 8.0
Assignee: Gabriel Gaspar Becker
QA Contact: Matus Marhefka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-09 19:42 UTC by mkielian@redhat.com
Modified: 2024-03-25 15:24 UTC (History)
3 users (show)

Fixed In Version: scap-security-guide-0.1.50-5.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 02:29:53 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4626 0 None None None 2020-11-04 02:30:13 UTC

Description mkielian@redhat.com 2019-09-09 19:42:52 UTC
Description of problem: 

Open Scap Security Guide Remediation script [ /usr/share/scap-security-guide/bash/ssg-rhel8-role-ospp.sh ]for RHEL8 duplicates entries in the SELINUX configuration file:[ /etc/sexlinux/config ]

Note: ( RHEL 8 Remediation script files)
ssg-rhel8-role-default.sh - Is NOT affected 
ssg-rhel8-role-ospp.sh - Is affected 
ssg-rhel8-role-pci-dss.sh - Is NOT affected


Version-Release number of selected component (if applicable):
scap-security-guide-0.1.42-11.el8.noarch


How reproducible:
Easily Reproducible


Steps to Reproduce:

1. Install SCAP security Guide.
   
    # yum install scap-security-guide

2. Run the scap re-mediation script
   
    # chmod +x /usr/share/scap-security-guide/bash/ssg-rhel8-role-ospp.sh
    # /usr/share/scap-security-guide/bash/ssg-rhel8-role-ospp.sh


3. Check the selinux Configuration file here:
   
    # less /etc/selinux/config



Actual results:

File: /etc/selinux/config 

###BEGIN FILE###

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted



# Per CCE-CCE-80868-3: Set SELINUXTYPE=targeted in /etc/sysconfig/selinux
SELINUXTYPE=targeted

# Per CCE-CCE-80869-1: Set SELINUX=enforcing in /etc/sysconfig/selinux
SELINUX=enforcing

###END FILE###

Note: It appends two duplicate entries to the file after script is ran.
SELINUXTYPE=targeted
SELINUX=enforcing


Expected results:

Script should not be adding additional SELINUX entries [ SELINUXTYPE=targeted , SELINUX=enforcing ] into the selinux configuration file.



Additional info:

Comment 1 Gabriel Gaspar Becker 2019-09-13 14:14:14 UTC
I've identified the root cause of the issue and reported upstream: https://github.com/ComplianceAsCode/content/issues/4838

The bash remediation is not able to detect correctly when a keyword is already present in the configuration file (/etc/sysconfig/linux)

Comment 2 Gabriel Gaspar Becker 2020-05-28 14:57:58 UTC
Fixed upstream: https://github.com/ComplianceAsCode/content/pull/5785

Comment 10 errata-xmlrpc 2020-11-04 02:29:53 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:4626


Note You need to log in before you can comment on or make changes to this bug.