Skip to content

Commit

Permalink
Merge pull request #32 from ansible-lockdown/script_update
Browse files Browse the repository at this point in the history
updated script to latest
  • Loading branch information
uk-bolly authored Apr 23, 2024
2 parents 637c2c1 + d697fbf commit 4478545
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions run_audit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
# linting (thanks to @cf-sewe)
# Oracle included by default if RHEL family
# benchmark vars moved
# December 2023 Added goss version and testing
# April 2024 Updating of OS discovery to work for all supported OSs

# Variables in upper case tend to be able to be adjusted
# lower case variables are discovered or built from other variables

# Goss benchmark variables (these should not need changing unless new release)
BENCHMARK=STIG # Benchmark Name aligns to the audit
BENCHMARK=STIG # Benchmark Name aligns to the audit
BENCHMARK_VER=v3r14
BENCHMARK_OS=RHEL7

Expand Down Expand Up @@ -80,10 +82,12 @@ fi

# Discover OS version aligning with audit
# Define os_vendor variable
if [ "$(grep -Ec "rhel|oracle" /etc/os-release)" != 0 ]; then
if [ "$(uname -a | grep -cw amzn)" -ge 1 ]; then
os_vendor="AMAZON"
elif [ "$(grep -Ec "rhel|oracle" /etc/os-release)" != 0 ]; then
os_vendor="RHEL"
else
os_vendor="$(hostnamectl | grep Oper | cut -d : -f2 | awk '{print $1}' | tr '[:lower:]' '[:upper:]' )"
os_vendor="$(hostnamectl | grep Oper | cut -d : -f2 | awk '{print tolower($1)}')"
fi

os_maj_ver="$(grep -w VERSION_ID= /etc/os-release | awk -F\" '{print $2}' | cut -d '.' -f1)"
Expand Down Expand Up @@ -135,7 +139,7 @@ else
fi

## Set the AUDIT json string
audit_json_vars='{"benchmark_type":'"$BENCHMARK"'","benchmark_os":"'"$BENCHMARK_OS"'","benchmark_version":"'"$BENCHMARK_VER"'","machine_uuid":"'"$host_machine_uuid"'","epoch":"'"$host_epoch"'","os_locale":"'"$host_os_locale"'","os_release":"'"$host_os_version"'","os_distribution":"'"$host_os_name"'","os_hostname":"'"$host_os_hostname"'","auto_group":"'"$host_auto_group"'","system_type":"'"$host_system_type"'"}'
audit_json_vars='{"benchmark_type":"'"$BENCHMARK"'","benchmark_os":"'"$BENCHMARK_OS"'","benchmark_version":"'"$BENCHMARK_VER"'","machine_uuid":"'"$host_machine_uuid"'","epoch":"'"$host_epoch"'","os_locale":"'"$host_os_locale"'","os_release":"'"$host_os_version"'","os_distribution":"'"$host_os_name"'","os_hostname":"'"$host_os_hostname"'","auto_group":"'"$host_auto_group"'","system_type":"'"$host_system_type"'"}'

## Run pre checks

Expand Down

0 comments on commit 4478545

Please sign in to comment.