System Security with OpenSCAP

SUSE Manager uses OpenSCAP to audit clients. It allows you to schedule and view compliance scans for any client.

1. About SCAP

The Security Certification and Authorization Package (SCAP) is a standardized compliance checking solution for enterprise-level Linux infrastructures. It is a line of specifications maintained by the National Institute of Standards and Technology (NIST) for maintaining system security for enterprise systems.

SCAP was created to provide a standardized approach to maintaining system security, and the standards that are used continually change to meet the needs of the community and enterprise businesses. New specifications are governed by NIST’s SCAP Release cycle to provide a consistent and repeatable revision work flow. For more information, see http://scap.nist.gov/timeline.html.

SUSE Manager uses OpenSCAP to implement the SCAP specifications. OpenSCAP is an auditing tool that utilizes the Extensible Configuration Checklist Description Format (XCCDF). XCCDF is a standard way of expressing checklist content and defines security checklists. It also combines with other specifications such as Common Platform Enumeration (CPE), Common Configuration Enumeration (CCE), and Open Vulnerability and Assessment Language (OVAL), to create a SCAP-expressed checklist that can be processed by SCAP-validated products.

OpenSCAP verifies the presence of patches by using content produced by the SUSE Security Team. OpenSCAP checks system security configuration settings and examines systems for signs of compromise by using rules based on standards and specifications. For more information about the SUSE Security Team, see https://www.suse.com/support/security.

2. Prepare Clients for an SCAP Scan

Before you begin, you need to prepare your client systems for SCAP scanning.

OpenSCAP auditing is not available on Salt clients that use the SSH contact method.

Scanning clients can consume a lot of memory and compute power on the client being scanned. For Red Hat clients, ensure you have at least 2 GB of RAM available on each client to be scanned.

For traditional and Salt clients, install the OpenSCAP scanner and the SCAP Security Guide (content) packages before you begin. Depending on the operating system, these packages are included either on the base operating system, or in the SUSE Manager Client Tools.

The table below lists the packages you need depending on your client operating system:

Table 1. OpenSCAP packages
Operating system Scanner Content

SLES

openscap-utils

scap-security-guide

openSUSE

openscap-utils

scap-security-guide

RHEL

openscap-utils

scap-security-guide-redhat

CentOS

openscap-utils

scap-security-guide-redhat

Oracle Linux

openscap-utils

scap-security-guide-redhat

Ubuntu

libopenscap8

scap-security-guide-ubuntu

Debian

libopenscap8

scap-security-guide-debian

RHEL 7 and compatible systems provide a scap-security-guide package, which contains outdated contents. You are advised to use the scap-security-guide-redhat package you will find in the SUSE Manager Client Tools.

3. OpenSCAP Content Files

OpenSCAP uses SCAP content files to define test rules. These content files are created based on the XCCDF or OVAL standards. In addition to the SCAP Security Guide, you can download publicly available content files and customize it to your requirements. You can install the SCAP Security Guide package for default content file templates. Alternatively, if you are familiar with XCCDF or OVAL, you can create your own content files.

We recommend you use templates to create your SCAP content files. If you create and use your own custom content files, you do so at your own risk. If your system becomes damaged through the use of custom content files, you might not be supported by SUSE.

When you have created your content files, you need to transfer the file to the client. You can do this in the same way as you move any other file, using physical storage media, or across a network with Salt (for example, salt-cp or the Salt File Server), ftp or scp.

We recommend that you create a package to distribute content files to clients that you are managing with SUSE Manager. Packages can be signed and verified to ensure their integrity. For more information, see administration:custom-channels.adoc.

4. Find OpenSCAP profiles

Different operating systems make available different OpenSCAP content files and profiles. One content file may contain more than one profile.

On RPM-based operating systems, use this command to determine the location of the available SCAP files:

rpm -ql <scap-security-guide-package-name-from-table>

On DEB-based operating systems, use this command to determine the location of the available SCAP files:

dpkg -L <scap-security-guide-package-name-from-table>

When you have identified one SCAP content file that suits your needs, list profiles available on the client:

oscap info ./usr/share/xml/scap/ssg/content/ssg-sle15-ds-1.2.xml
Document type: Source Data Stream
Imported: 2021-03-24T18:14:45

Stream: scap_org.open-scap_datastream_from_xccdf_ssg-sle15-xccdf-1.2.xml
Generated: (null)
Version: 1.2
Checklists:
        Ref-Id: scap_org.open-scap_cref_ssg-sle15-xccdf-1.2.xml
                Status: draft
                Generated: 2021-03-24
                Resolved: true
                Profiles:
                        Title: CIS SUSE Linux Enterprise 15 Benchmark
                                Id: xccdf_org.ssgproject.content_profile_cis
                        Title: Standard System Security Profile for SUSE Linux Enterprise 15
                                Id: xccdf_org.ssgproject.content_profile_standard
                        Title: DISA STIG for SUSE Linux Enterprise 15
                                Id: xccdf_org.ssgproject.content_profile_stig
                Referenced check files:
                        ssg-sle15-oval.xml
                                system: http://oval.mitre.org/XMLSchema/oval-definitions-5
                        ssg-sle15-ocil.xml
                                system: http://scap.nist.gov/schema/ocil/2
                        https://ftp.suse.com/pub/projects/security/oval/suse.linux.enterprise.15.xml
                                system: http://oval.mitre.org/XMLSchema/oval-definitions-5
Checks:
        Ref-Id: scap_org.open-scap_cref_ssg-sle15-oval.xml
        Ref-Id: scap_org.open-scap_cref_ssg-sle15-ocil.xml
        Ref-Id: scap_org.open-scap_cref_ssg-sle15-cpe-oval.xml
Dictionaries:
        Ref-Id: scap_org.open-scap_cref_ssg-sle15-cpe-dictionary.xml

Take a note of the file paths and profiles for performing the scan.

5. Perform an Audit Scan

When you have installed or transferred your content files, you can perform audit scans. Audit scans can be triggered using the SUSE Manager Web UI. You can also use the SUSE Manager API to schedule regular scans.

Procedure: Running an Audit Scan from the Web UI
  1. In the SUSE Manager Web UI, navigate to Systems  Systems List and select the client you want to scan.

  2. Navigate to the Audit tab, and the Schedule subtab.

  3. In the Path to XCCDF Document field, enter the parameters for the SCAP template and profile you want to use on the client. For example:

  Command: /usr/bin/oscap xccdf eval
  Command-line arguments: --profile xccdf_org.ssgproject.content_profile_standard
  Path to XCCDF document: /usr/share/xml/scap/ssg/content/ssg-sle15-ds-1.2.xml
  1. The scan runs at the client’s next scheduled synchronization.

The XCCDF content file is validated before it is run on the remote system. If the content file includes invalid arguments, the test fails.

Procedure: Running an Audit Scan from the API
  1. Before you begin, ensure that the client to be scanned has Python and XML-RPC libraries installed.

  2. Choose an existing script or create a script for scheduling a system scan through system.scap.scheduleXccdfScan. For example:

    #!/usr/bin/python
    client = xmlrpclib.Server('https://server.example.com/rpc/api')
    key = client.auth.login('username', 'password')
    client.system.scap.scheduleXccdfScan(key, <1000010001>,
        '<path_to_xccdf_file.xml>',
        '--profile <profile_name>')

    In this example: * <1000010001> is the system ID (sid). * <path_to_xccdf_file.xml> is the path to the content file location on the client. For example, /usr/share/xml/scap/ssg/content/ssg-sle15-ds-1.2.xml. * <profile_name> is an additional argument for the oscap command. For example, use united_states_government_configuration_baseline (USGCB).

  3. Run the script on the client you want to scan, from the command prompt.

6. Scan Results

Information about the scans you have run is in the SUSE Manager Web UI. Navigate to to Audit  OpenSCAP  All Scans for a table of results. For more information about the data in this table, see reference:audit/openscap-all-scans.adoc.

To ensure that detailed information about scans is available, you need to enable it on the client. In the SUSE Manager Web UI, navigate to Admin  Organizations and click on the organization the client is a part of. Navigate to the Configuration tab, and check the Enable Upload of Detailed SCAP Files option. When enabled, this generates an additional HTML file on every scan, which contains extra information. The results show an extra line similar to this:

Detailed Results: xccdf-report.html xccdf-results.xml scap-yast2sec-oval.xml.result.xml

To retrieve scan information from the command line, use the spacewalk-report command:

spacewalk-report system-history-scap
spacewalk-report scap-scan
spacewalk-report scap-scan-results

You can also use the SUSE Manager API to view results, with the system.scap handler.

7. Remediation

Remediation bash scripts and Ansible playbooks are provided in the same SCAP Security Guide packages to harden the client systems. For example:

Listing 1. bash scripts
/usr/share/scap-security-guide/bash/sle15-script-cis.sh
/usr/share/scap-security-guide/bash/sle15-script-standard.sh
/usr/share/scap-security-guide/bash/sle15-script-stig.sh
Listing 2. Ansible playbooks
/usr/share/scap-security-guide/ansible/sle15-playbook-cis.yml
/usr/share/scap-security-guide/ansible/sle15-playbook-standard.yml
/usr/share/scap-security-guide/ansible/sle15-playbook-stig.yml

You can run them using remote commands or with Ansible, after enabling Ansible in the client system.