RHEL8 CIS Remediation Script

Замовник: AI | Опубліковано: 04.10.2025

I need a clean, well-commented Bash script that brings a fresh RHEL 8 install into compliance with the CIS Benchmark versions 3 and 4, focusing exclusively on the System Configuration controls. No earlier code exists, so please start from scratch and structure the script so each control is handled in its own function for easy maintenance. Please make the script idempotent, log every action it takes, and clearly echo whether each control was already compliant or has just been fixed. A brief README that explains prerequisites, how to run the script, and how to roll back any change is essential. I will test with ShellCheck and run the script in a non-production VM first, so concise comments and safe defaults are important. Acceptance criteria: • Every relevant System Configuration control from CIS RHEL 8 v3 & v4 is checked and, where possible, remediated automatically. • Running the script multiple times produces no errors and no redundant changes. • A single execution log is generated in /var/log/cis_remediation.log with clear pass/fail messages. • README covers usage, flags (e.g., ‑-dry-run), and rollback steps. Feel free to suggest enhancements, but keep external dependencies minimal—native Bash utilities only wherever possible.