Skip to content
프로젝트

소개

Automated CIS Benchmark Compliance Remediation for RHEL 10 with Ansible

시스템 및 인프라

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
+1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

RHEL 10 CIS

Configure a RHEL 10 machine to be CIS compliant

Based on CIS Red Hat Enterprise Linux 10 Benchmark v1.0.1

Remediation role for RHEL 10 and compatible EL10 distributions (AlmaLinux, Rocky Linux, Oracle Linux), with an optional syver based audit that runs before and after remediation.


Contents


Status

Public Repository

Org Stars Stars Forks Followers X URL Discord Badge License

Lint & Pre-Commit Tools

YamlLint Ansible-Lint

Community Release Information

Release Branch Release Tag Main Release Date Benchmark Version Main Benchmark Version Devel

Main Pipeline Status Devel Pipeline Status

Devel Commits Open Issues Closed Issues Pull Requests

Subscriber Release Information

Private Release Branch Private Benchmark Version Private Remediate Pipeline Private Pull Requests Private Closed Issues


Caution(s)

This role will make changes to the system which may have unintended consequences. This is not an auditing tool but rather a remediation tool to be used after an audit has been conducted.

  • Testing is the most important thing you can do. Did we mention testing?
  • Check mode is not supported. The role will complete in check mode without errors, but use it with caution.
  • This role was developed against a clean install of the operating system. If you are applying it to an existing system, review the role for any site specific changes that are needed.
  • To use a release version, point to the main branch and the release for the benchmark you wish to work with.
  • Some controls are disruptive and are only applied when rhel10cis_disruption_high: true (default false), for example authselect/PAM changes, the firewalld zone target and locking accounts. Review them before enabling.

Requirements

General:

  • Basic knowledge of Ansible. If you are unfamiliar with Ansible, these links help get started:
  • A functioning Ansible installation (or AWX / Automation Controller), configured and able to reach the target hosts.
  • Read through the tasks in this role to understand what each control does. Some tasks are disruptive and can have unintended consequences on a live production system. Also familiarise yourself with the variables in defaults/main/main.yml.

Technical Dependencies:

  • RHEL family OS 10
  • ansible-core 2.16.1 or newer
  • Collections listed in collections/requirements.yml: community.general, ansible.posix
  • If using the audit: access to download or add the syver binary and audit content to the system (other options are available for getting the content onto the host)
  • If generating your own bootloader password hash on the controller: passlib

Quick Start

Install the collections, then point a playbook at the role:

ansible-galaxy collection install -r collections/requirements.yml
- name: Apply CIS hardening
  hosts: rhel10_servers
  become: true
  roles:
    - role: RHEL10-CIS

The repository includes a ready made site.yml that targets all hosts, or the hosts passed in the hosts variable:

ansible-playbook -i inventory site.yml -e hosts=rhel10_servers

To run the audit before and after remediation, set setup_audit: true and run_audit: true (see Auditing).


Customising the Role

This role is designed so that the end user should not have to edit the tasks themselves. All customising should be done by overriding variables from defaults/main/main.yml (remediation) and defaults/main/audit.yml (audit), for example in group_vars, host_vars or with extra vars in the project, job or workflow.

  • Every control has a toggle named after its ID, for example rhel10cis_rule_1_1_1_1, so individual controls can be switched off.
  • Each section can be switched off with rhel10cis_section1 to rhel10cis_section7.

Matching a Security Level

It is possible to only run level 1 or level 2 controls for CIS. This is managed using tags:

  • level1-server
  • level1-workstation
  • level2-server
  • level2-workstation

Select a level with --tags, for example --tags level1-server. Do not use --skip-tags level2-server,level2-workstation to leave out Level 2: a control that is Level 1 Server and Level 2 Workstation carries both tags and would be skipped too.

The level variables in defaults/main/main.yml also need to reflect this, as they control the testing that takes place if you are using the audit component.

Tags

There are many tags available for added control precision. Each control has its own set of tags noting what level, what OS element it relates to, whether it is a patch or audit, and the rule number. NIST references follow a specific conversion format for consistency and clarity.

Below is an example of the tag section from a control within this role. Using this example, if you set your run to skip all controls with the tag cramfs, this task will be skipped. The opposite can also happen where you run only controls tagged with cramfs.

  tags:
    - level1-server
    - level1-workstation
    - automated
    - patch
    - rule_1.1.1.1
    - cramfs
    - NIST800-53R5_CM-7
    - CCI-000381

Conversion format for NIST references:

  1. Standard prefix: all references are prefixed with "NIST".
  2. Standard types:
    • "800-53" references are formatted as NIST800-53.
    • "800-53r5" references are formatted as NIST800-53R5 (with 'R' capitalised).
    • "800-171" references are formatted as NIST800-171.
  3. Details:
    • Section and subsection numbers use periods (.) for numeric separators.
    • Parenthetical elements are separated by underscores (_), e.g., IA-5(1)(d) becomes IA-5_1_d.
    • Subsection letters (e.g., "b") are appended with an underscore.

Workstation

The following controls are not listed as applicable to the workstation profile. They can still be applied; set their rhel10cis_rule_* toggle to false where they do not fit.

  • 1.3.1.8
  • 2.1.10
  • 2.1.19
  • 2.1.20
  • 3.1.2

Auditing

This can be turned on or off with the variables setup_audit and run_audit in defaults/main/audit.yml. The value is false by default, please refer to the wiki for more details. The role passes its variables to the audit, so only the controls that are enabled in the role are checked.

The audit uses a small go binary called syver, the continuation of goss, along with the relevant configurations to check, without the need for infrastructure or other tooling. It is a quick, lightweight check of both the configuration and the live/running settings, which aims to remove false positives in the process.

Syver replaces goss as it is a signed fork that is regularly updated, and it reads the same goss audit content unchanged.

Refer to RHEL10-CIS-Audit.

Example Audit Summary

From a clean AlmaLinux 10 host, no GUI, with rhel10cis_disruption_high: true. More tests are run than there are controls, as both the config and the running state are checked.

ok: [alma10bios] => {
    "msg": [
        "The pre remediation audit results are: Count: 940, Failed: 364, Skipped: 25, Duration: 5.114s",
        "The post remediation audit results are: Count: 940, Failed: 4, Skipped: 13, Duration: 6.449s",
        "Full breakdown can be found in /opt",
        ""
    ]
}

PLAY RECAP *******************************************************************************************************************************************
alma10bios                 : ok=566  changed=186  unreachable=0    failed=0    skipped=243  rescued=0    ignored=0

Documentation


Looking for support?

Lockdown Enterprise

Ansible support

Community

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

Contributing

Bug reports and feature requests are welcome from everyone, please raise an issue.

Pull requests are accepted from approved contributors only. To be onboarded, join the Discord Server and request contributor access. See CONTRIBUTING.md for the full process.


Testing

Pipeline Testing

Automated tests run on pull requests into devel:

  • self-hosted runners using OpenTofu
  • ansible collections pulled at the latest version from the requirements file
  • the audit runs using the devel branch

Local Testing

Molecule scenarios: default, localhost, wsl.

molecule test -s default

Known Issues

  • AlmaLinux BaseOS, EPEL and many cloud provider repositories do not support gpgcheck (rule_1.2.1.2) or repo_gpgcheck (rule_1.2.1.3). This will cause issues during the playbook unless a workaround is found.

Credits and Thanks

Massive thanks to the fantastic community and all its members.

This includes a huge thanks and credit to the original authors and maintainers.

Mark Bolwell, George Nalen, Steve Williams, Fred Witty

관련 프로젝트 살펴보기

불러오는 중…