Project

General

Profile

Actions

action #93886

closed

[sle][security][backlog]automate testing of scap-security-guide

Added by msmeissn over 3 years ago. Updated almost 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
New test
Target version:
-
Start date:
2022-01-17
Due date:
% Done:

100%

Estimated time:
(Total: 160.00 h)
Difficulty:

Description

we now have a "stig" hardening in the scap-security-guide

can you add testing for this to SLES, for both:

  • detection mode
  • mitigation mode

and also test if regular SLES stuff continues to work after running mitigation.
(e.,g. having a installation flavor regular + stig hardening mitigation )


Subtasks 5 (0 open5 closed)

action #104943: [sle][security][sle15sp4] automate testing of scap-security-guide: run '# oscap "eval" / "eval remote" / "remediate" / "eval after remediate"' Resolvedllzhao2022-01-17

Actions
action #104944: [sle][security][backlog] automate testing of scap-security-guide: compare the eval results with baselineResolvedshawnhao2022-01-17

Actions
action #104947: [sle][security][backlog] automate testing of scap-security-guide: run basic tests on the "remediated" systemResolvedpstivanin2022-01-17

Actions
action #105717: [sle][security][sle15sp4]automate testing of scap-security-guide: optionally upload "report.html" and fix upload timed out on ppc64leResolvedllzhao2022-01-29

Actions
action #114445: [security] add stig and stig_remediated_selinux tests to 15-SP4 security maintenance job groupResolvedpstivanin2022-07-21

Actions
Actions #1

Updated by maritawerner over 3 years ago

  • Subject changed from automate testing of scap-security-guide to [security]automate testing of scap-security-guide
Actions #2

Updated by llzhao over 3 years ago

  • Subject changed from [security]automate testing of scap-security-guide to [sle][security][sle15sp4]automate testing of scap-security-guide
  • Category set to New test
  • Assignee set to llzhao
Actions #3

Updated by llzhao over 3 years ago

msmeissn wrote:

we now have a "stig" hardening in the scap-security-guide

can you add testing for this to SLES, for both:

  • detection mode
  • mitigation mode

and also test if regular SLES stuff continues to work after running mitigation.
(e.,g. having a installation flavor regular + stig hardening mitigation )

@msmeissn , could please offer more info (any docs/links) on the "scap-security-guide"?
We do not have any idea atm. Thanks!

Actions #4

Updated by llzhao over 3 years ago

After investigation found these helpful links:

  1. confluence page: https://confluence.suse.com/display/SecurityCertifications/Hardening+workshop+preparation https://confluence.suse.com/display/GEHC/General+Security+Discussions
  2. JIRA feature: https://jira.suse.com/browse/PM-2390 https://jira.suse.com/browse/PM-245
  3. sles15sp3 GM # zypper se -s scap-security-guide
S Name Type Version Arch Repository
scap-security-guide package 0.1.55git20210323-1.10.1 noarch SLE-Module-Basesystem15-SP3-Pool

...

  1. man page of scap-security-guide ... Profiles in Guide to the Secure Configuration of SUSE Linux Enterprise 15 ... Additional details can be found on the projects wiki page: https://www.github.com/OpenSCAP/scap-security-guide/wiki ...
Actions #5

Updated by msmeissn over 3 years ago

ok, simple approaches:

install openscap-utils

on SLE15 all servicepacks: ( just replace sle15 by sle12 in SLE12)
oscap xccdf eval --profile stig /usr/share/xml/scap/ssg/content/ssg-sle15-ds.xml

this is the basic evaluation and will print to stdout. There are some output optipons too which could be used for easier scripting if needed.

There is a mitigation mode:
oscap xccdf remediate --profile stig /usr/share/xml/scap/ssg/content/ssg-sle15-ds.xml

DANGER NOTE: this WILL change your system and might disallow logins or similar, so only use in scratch vms for testing or when you are able to recover it.

You can take a look at the existing openscap tests in openqa too and inject the ssg-sle15-ds.xml or ssg-sle12-ds.xml there

Actions #6

Updated by llzhao over 3 years ago

Got it, thanks for the info.

Actions #7

Updated by llzhao almost 3 years ago

  • Status changed from New to In Progress
  • Estimated time set to 32.00 h
Actions #8

Updated by llzhao almost 3 years ago

Testing coverage discussion:
On Tue, Dec 21, 2021 at 03:36:42PM +0800, llzhao wrote:

Hi Marcus,

I am automating the poo#93886 - [sle][security][sle15sp4]automate
testing of scap-security-guide (opened by you before and I'm sorry for
the late).

I have some questions need your confirmation.

  1. You had suggested 2 testing modes

    - One is detection:

    Run "# oscap xccdf eval --profile stig /.../ssg-sle15-ds.xml".

    This mode can be executed well and print msg to stdout and the
    return value is "2".

    For the eval outputs [2] there are lots of
    "fail/notchecked/notapplicable/..." except for "pass".

    Can I take this testing pass thought there are "fail/..." and the
    return value is "2"?

Here we can expect some fails, as the system is not fully compliant
before remediation.

I would however perhaps track the output list to see if we regress
between version updates. (e.g. track a baseline of pass/fail/not
applicable here)

*- Another is mitigation*:

Run "# oscap xccdf remediate --profile stig /.../ssg-sle15-ds.xml"

This mode can not be executed well and reports the following msg:

    WARNING: Datastream component
    'scap_org.open-scap_cref_pub-projects-security-oval-suse.linux.enterprise.15.xml'
    points out to the remote
    'https://ftp.suse.com/pub/projects/security/oval/suse.linux.enterprise.15.xml'.
    Use '--fetch-remote-resources' option to download it.
    WARNING: Skipping
    'https://ftp.suse.com/pub/projects/security/oval/suse.linux.enterprise.15.xml'
    file which is referenced from datastream
    WARNING: Skipping
    ./pub-projects-security-oval-suse.linux.enterprise.15.xml file
    which is referenced from XCCDF content
    OpenSCAP Error: Could not find latest TestResult element.
    [/home/abuild/rpmbuild/BUILD/openscap-1.3.5/src/XCCDF/xccdf_session.c:1859]

So I tried this cmd instead: "# oscap xccdf eval --profile stig
--remediate /.../ssg-sle15-ds.xml"
This cmd can be executed and print msg to stdout and the return
value "1", see [2]

For the remediate outputs [2] there are lots of "fail/error/..."
except for "fixed".

Should I take this testing as pass?

So there should at least be no errors I would hope ... :/

We need to go through those. Can you open one bug with the results?

I'm asking these 2 questions as I don't know how to handle the "Result".
  1. For testing suggestion "test if regular SLES stuff continues to work
    after running mitigation"

    I will check after the mitigation the system still can be updated or
    can run "# oscap remediate/evaluation"

    Is it OK?

I think good as first step...

Can we inject this kind of "remediated" system as a base installation
into some sort of basic tests?

  1. Should this test case be run on all openQA arches (x86_64, s390x, ppc64le and aarch64)?

Yes please, although I do not expect differences.

  1. openQA runs for released products

    Usually Security QEs only focus on the testings for products under
    development, such as we are testing sle15sp4.

    QE maintenance team will test released products, such as "sle12 spx"
    and sle15 "sp0/1/2/3".

    In this poo the test requirement is for all sle service packs.

    So I decid only automate it for sle15sp4 then will inform QE
    maintenance team to add test runs for other sle12/15 service packs

    Are you OK with it?

Yes, this sounds good.

Actually this is wanted by Cert Team that we test the new versions of scap-security-guide.

FYI:

[1] https://progress.opensuse.org/issues/93886

([sle][security][sle15sp4]automate testing of scap-security-guide)

[2] see attachment file

Actions #9

Updated by llzhao almost 3 years ago

phase 1: integrate oscap "eval" / "eval remote" / "remediate" / "eval after remediate" test cases into openQA; support on 4 arches
phase 2: check with the baselines after "eval"
phase 2: run basic tests on the "remediated" system
So will open 3 poos to track.

Actions #10

Updated by llzhao almost 3 years ago

  • Estimated time deleted (32.00 h)
Actions #11

Updated by llzhao over 2 years ago

  • Subject changed from [sle][security][sle15sp4]automate testing of scap-security-guide to [sle][security][backlog]automate testing of scap-security-guide
Actions #12

Updated by rfan1 over 2 years ago

  • Assignee changed from llzhao to pstivanin
Actions #13

Updated by pstivanin over 2 years ago

  • Status changed from In Progress to Workable
Actions #14

Updated by pstivanin over 2 years ago

  • Assignee deleted (pstivanin)
Actions #15

Updated by pstivanin over 2 years ago

  • Status changed from Workable to In Progress
  • Assignee set to pstivanin
Actions #16

Updated by pstivanin over 2 years ago

  • Status changed from In Progress to Resolved

All sub tickets have now been resolved. I've checked with Lili, and she confirmed that this can be marked as resolved too.

Actions #17

Updated by pstivanin over 2 years ago

  • Status changed from Resolved to In Progress
Actions #18

Updated by pstivanin over 2 years ago

  • Status changed from In Progress to Blocked
Actions #19

Updated by pstivanin almost 2 years ago

  • Status changed from Blocked to In Progress
Actions #20

Updated by pstivanin almost 2 years ago

  • Status changed from In Progress to Resolved

Last PR merged, STIG will be enabled on all supported archs in 15-SP4 starting from tomorrow, 11th of March, 2023.

Actions

Also available in: Atom PDF