Skip to content

Define os_vendor logic doesn't work properly #44

@gmisura

Description

@gmisura

Have you checked ReadtheDocs?:
I checked and the search found nothing relevant.

Describe the Issue
The run_audit.sh defines the os_vendor variable by checking uname -a however, that fails when the OS is a container running on a EC2 (or gitlab runner on Amazon) since uname -a returns the kernel: 4.14.322-244.536.amzn2.x86_64
However the OS is Ubuntu per cat /etc/os-release

PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Then the run_audit.sh script fails because it can't find the goss.xml because it is looking for AMAZON22-CIS-Audit/goss.xml:

WARNING - the /audit/AMAZON22-CIS-Audit/goss.yml is not available

Expected Behavior
I expect the run_audit.sh to properly identify the OS. Maybe using /etc/os-release is a better choice?

Actual Behavior
See above

Control(s) Affected
N/A

Environment (please complete the following information):

  • branch being used: devel
  • Ansible Version: [e.g. 2.10]
  • Host Python Version: [e.g. Python 3.7.6]
  • Ansible Server Python Version: [e.g. Python 3.7.6]
  • Additional Details: N/A

Additional Notes
N/A

Possible Solution
The line in question that causes the error:

echo "WARNING - the $audit_content_dir/$AUDIT_FILE is not available"; export FAILURE=3

uses the var $audit_content_dir built:

audit_content_dir=$AUDIT_CONTENT_LOCATION/$audit_content_version

$audit_content_version comes from

audit_content_version=$os_vendor$os_maj_ver-$BENCHMARK-Audit

Could that simply be:

audit_content_version=$BENCHMARK_OS-$BENCHMARK-Audit

Instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions