Giter VIP home page Giter VIP logo

rhel9-cis-audit's Introduction

RHEL 9 Goss config

Overview

based on CIS 1.0.0

Ability to audit a system using a lightweight binary to check the current state.

This is:

  • very small 11MB
  • lightweight
  • self contained

It works using a set of configuration files and directories to audit STIG of RHEL/CentOS 7 servers. These files/directories correlate to the STIG Level and STIG_ID

Tested on

  • RHEL9
  • Rocky9
  • AlmaLinux 9
  • Oraclelinux 9

Requirements

You must have goss available to your host you would like to test.

You must have sudo/root access to the system as some commands require privilege information.

Assuming you have already clone this repository you can run goss from where you wish.

Please refer to the audit documentation for usage.

This also works alongside the Ansible Lockdown RHEL9-CIS role

Which will:

  • install
  • audit
  • remediate
  • audit

Join us

On our Discord Server to ask questions, discuss features, or just chat with other Ansible-Lockdown users

Set of configuration files and directories to run the first stages of CIS of RHEL 9 servers

This is configured in a directory structure level.

Goss is run based on the goss.yml file in the top level directory. This specifies the configuration.

further information

rhel9-cis-audit's People

Contributors

georgenalen avatar mj84 avatar uk-bolly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rhel9-cis-audit's Issues

Duplicate key detected: 'package: vsftp'.

Describe the Issue
Manually running Audit on freshly built RHEL 9.4 system generates warning message

[root@rhel94-test02 ~]# /opt/RHEL9-CIS-Audit/run_audit.sh

## Pre-Checks Start

OK - Audit binary /usr/local/bin/goss is available
OK - Goss is installed and version is ok (0.4.7 >= 0.4.4)
OK - /opt/RHEL9-CIS-Audit/goss.yml is available

## Pre-checks Successful

#############
Audit Started
#############

2024-06-01T23:42:43Z [WARN] Duplicate key detected: 'package: vsftp'. The value from a later-loaded goss file has overwritten the previous value.
    "summary": {
        "failed-count": 90,
        "skipped-count": 12,
        "summary-line": "Count: 639, Failed: 90, Skipped: 12, Duration: 35.228s",
        "test-count": 639,
Completed file can be found at /opt/audit_rhel94-test02-CIS-RHEL9_1717285363.json
###############
Audit Completed
###############

Expected Behavior
No warnings generated

Actual Behavior
The files section_2/cis_2.3/cis_2.3.1_4.yml and section_2/cis_2.2/cis_2.2.6.yml contain a duplicate key vsftp

Control(s) Affected
What controls are being affected by the issue

Environment (please complete the following information):

  • branch being used: devel

Possible Solution
sed -i 's/vsftp/ftp/' section_2/cis_2.2/cis_2.2.6.yml

5.6.1.3 regex typos

Rule https://github.com/ansible-lockdown/RHEL9-CIS-Audit/blob/devel/section_5/cis_5.6/cis_5.6.1.3.yml

first check
title: 5.6.1.3 | Ensure password expiration warning days is 7 or more, may give false alarm if PASS_WARN_AGE has more then 2 digits.

I would suggest replacing line 9
- '!/^PASS_WARN_AGE\s*[1-6]/'
with
- '!/^PASS_WARN_AGE\s*[1-6]$/'

second check in the same rule
title: 5.6.1.3 | Ensure password expiration warning days is 7 or more | check_users, I would say it's a typo mistake line 24 has one ] extra and on line 25 [ is missing:

- '/^.*:([7-9]|[1-9][0-9]{1,}])$/'
- '!/^.*:1-6]$/'

replace with

- '/^.*:([7-9]|[1-9][0-9]{1,})$/'
- '!/^.*:[1-6]$/'

run_audit setup finds ORACLE and not RHEL

Describe the Issue
On Oracle 9U2 (at least), running the RHEL9-CIS-AUDIT extracts os_vendor from hostnamectl , which returns ORACLE and not RHEL.
Thus when one sets AUDIT_CONTENT_LOCATION, rather than RHEL9 being inserted, ORALCE9 is instead. If one has cloned the repository, it will be /path/RHEL9-CIS-AUDIT, and not /path/ORACLE9-CIS-AUDIT

Expected Behavior
Neither /etc/os-release nor hostnamectl contain and reference to RHEL. At this time, there should be a mapping to identify Oracle as RHEL, as for the future, who knows. If one maps ORACLE to RHEL , then it will functions as intended.

Actual Behavior
The following shows how the run_audit script identifies the os family

++ hostnamectl
++ cut -d : -f2
++ grep Oper
++ awk '{print $1}'
++ tr a-z A-Z

  • os_vendor=ORACLE
    ++ awk '-F"' '{print $2}'
    ++ cut -d . -f1
    ++ grep -w VERSION_ID= /etc/os-release
  • os_maj_ver=9
  • audit_content_version=ORACLE9-CIS-Audit
  • audit_content_dir=/home/opc/ORACLE9-CIS-Audit

Control(s) Affected
What controls are being affected by the issue

Environment (please complete the following information):

  • branch being used: devel
  • Ansible Version: 2.15.2
  • Host Python Version: Python 3.11.12
  • Ansible Server Python Version: Python 3.9.16
  • Additional Details:

Additional Notes
Anything additional goes here

Possible Solution
In run_audit, have an associative array mapping ORACLE -> RHEL (only as it eliminates having a conditional)

Missing meta/main.yml causes galaxy-install to fail in roles/requirements.yml

Describe the Issue
This role does not appear to have a meta/main.yml file.

Expected Behavior
Starting galaxy role install process

changing role RHEL9_cis_audit from to unspecified
Actual Behavior
[WARNING]: - RHEL9-CIS-Audit was NOT installed successfully: this role does not appear to have a meta/main.yml file.

Control(s) Affected
Using it in a project.

Environment (please complete the following information):

not relevant here.

Additional Notes
Anything additional goes here

Possible Solution
Add file meta/main.yml.

Missing rhel9cis_rule_5_1_9 from vars/CIS.yml

Describe the Issue
When running the run_audit.sh, it fails with the following error:

Error: could not read json data in /home/opc/ORACLE9-CIS-Audit/section_5/cis_5.1/cis_5.1.8_9.yml: template: test:31:11: executing "test" at <.Vars.rhel9cis_rule
_5_1_9>: map has no entry for key "rhel9cis_rule_5_1_9"

Expected Behavior
There should be no non-existent variables referenced in conditional statements.

Actual Behavior
{{ if .Vars.rhel9cis_rule_5_1_9 }}
/etc/at.deny:
title: 5.1.9 | Ensure at is restricted to authorized users
exists: false
meta:

Since the variable has not been defined, it is not possible to evaluate the conditional statement.

Control(s) Affected
What controls are being affected by the issue

Environment (please complete the following information):

  • branch being used: devel
  • Ansible Version: 2.15.2
  • Host Python Version: Python 3.11.12
  • Ansible Server Python Version: Python 3.9.16
  • Additional Details:

Additional Notes
Anything additional goes here

Possible Solution
Add rhel9cis_rule_5_1_9 to the defaults to the CIS.yaml file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.