Bug 1472379

Summary: [RFE] Remediate container images so that they are compliant with a security policy
Product: Red Hat Enterprise Linux 7 Reporter: Jan Černý <jcerny>
Component: atomicAssignee: Lokesh Mandvekar <lsm5>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact: Mirek Jahoda <mjahoda>
Priority: unspecified    
Version: 7.5CC: atomic-bugs, bbaude, ddarrah, dwalsh, fkluknav, lsm5, mjahoda, mmarhefk, mpreisle, mthacker, ovasik, weshen
Target Milestone: rcKeywords: Extras, FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-26 07:47:53 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:
Bug Depends On: 1471672    
Bug Blocks: 1469954, 1477926    

Description Jan Černý 2017-07-18 15:19:11 UTC
Description of problem:

We don't have any automated way to create container images that are compliant with a security policy (eg. STIG, OSPP, PCI-DSS, ..) That means users have to change the images manually to make them security compliant. That's very complicated and time-consuming, especially in large container environments.

Instead, we need to enable users to build hardened images directly. That should be achieved by involving OpenSCAP, SCAP Security Guide and Docker Build together. The idea is based on adding a hardening layer on the top of the image.

Atomic scan should be extended in a way that it doesn't only scan, but also fixes the failing rules, so that the new image passes the scan.



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

How reproducible:
never

Steps to Reproduce:
1. atomic scan --harden

Actual results:
none, not implemented yet

Expected results:
An image that is compliant with a security policy is built.

Additional info:
none

Comment 1 Daniel Walsh 2017-07-18 16:09:34 UTC
I guess instead of mounting the image in as ReadOnly it would be mounted in as ReadWrite and we would need to make sure that the atomic scan container can write to the image.

Comment 2 Jan Černý 2017-07-25 13:51:04 UTC
That isn't necessary. Instead of mounting the image as ReadWrite, we can generate a fix script based on scan results, and then build a new image from the scanned image. During the build process the fix script will be invoked. We can think of it as adding new layer on the original image. This layer will contain all the changes needed to comply with a SCAP profile.

Comment 5 Martin Preisler 2017-10-16 17:32:00 UTC
The referenced PR has been reworked in https://github.com/projectatomic/atomic/pull/1090 and merged. Setting to POST.

Comment 10 Edward Shen 2018-09-10 11:36:24 UTC
I tested this on atomic-1.22.1-25.git5a342e3.el7.x86_64.
I can't figure out how this flag "--remediate" works in a short time, but I think below behavior is not the correct one:
1. atomic pull docker.io/busybox
2. atomic scan --remediate docker.io/busybox

result:
openscap has no remediation script.

Comment 12 Edward Shen 2018-09-12 06:24:18 UTC
Thank you, Matus. This is exactly I want to know.
Verified this on atomic-1.22.1-25.git5a342e3.el7.x86_64, it works fine.

Comment 14 errata-xmlrpc 2018-09-26 07:47: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, 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-2018:2795

Comment 15 Red Hat Bugzilla 2023-09-14 04:01:22 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days