Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧹 Improving Linux policies to fit for Container images as well #392

Merged
merged 6 commits into from
May 10, 2024

Conversation

HRouhani
Copy link
Contributor

@HRouhani HRouhani commented May 7, 2024

No description provided.

This comment has been minimized.

core/mondoo-linux-security.mql.yaml Outdated Show resolved Hide resolved
@HRouhani
Copy link
Contributor Author

HRouhani commented May 8, 2024

The following script runs the mondoo-linux-security.mql.yaml for all container Images and saves the results. At the moment, we made sure that none of the tests face with Errors on any Images:

#!/bin/bash

cnspec_path="/cnspec/cnspec-11.0.3"
mql_file="mondoo-linux-security.mql.yaml"

# List of container images
declare -a containers=(
    "alpine:3.16"
    "alpine:3.17"
    "alpine:3.18"
    "alpine:3.19"
    "almalinux:8.9"
    "almalinux:9.3"
    "amazonlinux:2"
    "amazonlinux:2023"
    "centos:7"
    "centos:8"
    "debian:7"
    "debian:8"
    "debian:9"
    "debian:10"
    "debian:11"
    "debian:12"
    "fedora:37"
    "fedora:38"
    "fedora:39"
    "fedora:40"
    "opensuse/leap:15.5"
    "opensuse/leap:42.3"
    "opensuse/tumbleweed"
    "oraclelinux:8.9"
    "oraclelinux:9"
    "photon:3.0"
    "photon:4.0"
    "photon:5.0"
    "registry.access.redhat.com/ubi7/ubi-minimal:7.9-1313"
    "registry.access.redhat.com/ubi8/ubi:8.0-122"
    "registry.access.redhat.com/ubi8/ubi:8.9-1107"
    "rockylinux:8.9"
    "rockylinux:9.3"
    "registry.suse.com/bci/bci-base:15.5"
    "registry.suse.com/suse/sles12sp5:6.5.559"
    "ubuntu:14.04"
    "ubuntu:16.04"
    "ubuntu:18.04"
    "ubuntu:20.04"
    "ubuntu:22.04"
)

# Loop through the containers and run the scan
for container in "${containers[@]}"
do
    #echo "Scanning $container" >> scan-results-new3.txt
    #$cnspec_path scan container "$container" -f $mql_file | grep '! Error:' >> scan-results-new3.txt
    $cnspec_path scan container "$container" -f $mql_file  >> scan-results-new4.txt
done

Next step would be to improving the tests itself and tune it for container images!

Signed-off-by: Hossein Rouhani <[email protected]>
Signed-off-by: Hossein Rouhani <[email protected]>
Signed-off-by: Hossein Rouhani <[email protected]>
Signed-off-by: Hossein Rouhani <[email protected]>
Copy link
Member

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @HRouhani

@chris-rock chris-rock merged commit a2a4785 into main May 10, 2024
7 checks passed
@chris-rock chris-rock deleted the hossein/linux-container branch May 10, 2024 11:57
@github-actions github-actions bot locked and limited conversation to collaborators May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants