π‘οΈ CIS Benchmarks Tools Suite (v2.10.0)¶
Enterprise-Grade Automated Security Compliance Audit Engine for Databases and Linux Systems (100% Python Standard Library - PSL ONLY).
Docs: Online Portal (https://cis-benchmarks.lightpath.fr/) Β· Docs Home Β· Tutorials Β· How-To Β· Reference Β· Explanation Β· FR
π Overview¶
CIS Benchmarks Tools is a lightweight, zero-dependency automated security audit suite designed to evaluate system and database configurations against official CIS (Center for Internet Security) Benchmarks and DISA STIG security guidelines.
Key Highlights¶
- π 100% Python Standard Library (PSL ONLY): Zero
pipdependencies. Runs standalone on any standard Python 3 installation without installing external packages. - π― 4-Tier Execution Context Engine: Seamless auto-detection and execution across 4 distinct deployment topologies:
- Local Machine (
--mode local/--local) - Remote SSH (
--mode ssh/--remote user@host/--ssh user@host) - Docker Container (Local) (
--docker <container_name>) - Docker Container (Remote SSH) (
--remote user@host --docker <container_name>) - π 5-State Compliance Taxonomy:
Pass: Verified compliant check.Fail: Security non-compliance detected.Error: Command or environment execution error (guaranteed distinct from security failures).Manual: Procedural manual check with structured operational guides and diagnostic commands.Not Applicable (N/A): Variable, plugin, or feature not applicable in the evaluated environment.- π Database Authentication & Credentials Injection:
- Full support for
--db-user,--db-password,--db-host,--db-port,--db-name,--defaults-file,--auth-db, and standard environment variables (MYSQL_PWD,PGPASSWORD, etc.). - Automatic password masking (
***) in audit output logs and HTML reports. - π©Ί Zero Command Error & Full Diagnostic Telemetry: Complete preservation of
stderrdiagnostics without destructive2>/dev/nullredirection. - π 100% Offline Pure Inline SVG Charts: Donut charts and category progress bars generated natively in Python PSL without CDN or external JavaScript dependencies.
- ποΈ 18 Audit Targets & 887 Controls: Comprehensive coverage for MariaDB, MySQL, PostgreSQL, MongoDB, Apache Cassandra, and Red Hat Enterprise Linux (RHEL 8 / 9 / 10).
- π Multi-Language Support (i18n): English (
--lang en) and French (--lang fr) CLI and HTML reports. - π Multi-Format Exporters (
--format html|json|xml|txt|sarif): HTML, JSON (SIEM/DevSecOps), XML (JUnit/STIG), TXT, and SARIF v2.1.0 reports. - π€ AI Integration: Native PSL MCP server (
mcp_server.py/cis-mcp-server, 5 read-only tools, 3 resources) & 6 per-technology Agent Skills (.agents/skills/,scripts/install_agent_skills.py).
ποΈ Supported Audit Targets (18 Benchmarks / 887 Controls)¶
Database Engines (15 Benchmarks)¶
Linux Operating Systems & STIG (3 Benchmarks)¶
| Target Key | Operating System | Profile / STIG | CIS Benchmark | Controls | Script | Rule Spec |
|---|---|---|---|---|---|---|
rhel8 |
Red Hat Enterprise Linux | RHEL 8 CIS & STIG | v4.0.0 / v2.0.0 | 20 | audit_cis_rhel_8.py |
rules/rhel_8.json |
rhel9 |
Red Hat Enterprise Linux | RHEL 9 CIS & STIG | v2.0.0 / v1.0.0 | 20 | audit_cis_rhel_9.py |
rules/rhel_9.json |
rhel10 |
Red Hat Enterprise Linux | RHEL 10 CIS | v1.0.1 | 20 | audit_cis_rhel_10.py |
rules/rhel_10.json |
π Usage & Execution Examples¶
Requirements¶
- Python 3.8+ (Standard Installation, PSL only)
- Docker (Optional, for containerized audit targets)
0. Quick Install from PyPI¶
0b. Quickstart with Docker Hub¶
docker run --rm jmrenouard/cis-benchmarks-tools --list-targets
docker run --rm -v $(pwd)/reports:/app/reports jmrenouard/cis-benchmarks-tools --target mariadb106 -o /app/reports/audit.html
1. List Available Targets¶
2. Local Machine Audit (--mode local / --local)¶
# PostgreSQL 16 local audit generating an HTML report
python3 audit_cis.py --target postgresql16 --local --format html
# RHEL 9 local audit exporting to JSON for SIEM ingestion
python3 audit_cis.py --target rhel9 --local --format json -o reports/audit_rhel9.json
3. Docker Container Audit (--docker <container_name>)¶
# Audit a running local MySQL 8.0 container directly
python3 audit_cis_mysql_80.py --docker mysql80-test
# Audit a MariaDB container using the unified entrypoint
python3 audit_cis.py --target mariadb106 --docker mariadb106-container --format html
4. Remote SSH Audit (--mode ssh / --remote user@host)¶
# Remote PostgreSQL 17 audit over SSH
python3 audit_cis.py --target postgresql17 --ssh admin@192.168.1.50 --format html
# Remote Docker audit over SSH (container running on a remote server)
python3 audit_cis.py --target mysql80 --ssh admin@192.168.1.50 --docker prod-mysql-container
5. Auditing with Database Credentials¶
# Provide credentials directly via CLI flags
python3 audit_cis_mysql_80.py --db-user root --db-password 'SecretPass123!' --db-host 127.0.0.1 --db-port 3306
# Pass options file for MySQL / PostgreSQL
python3 audit_cis_mysql_80.py --defaults-file /root/.my.cnf
6. Auto-Detection & Sequential Suite Execution¶
# Automatically detect active database services and audit them
python3 audit_cis.py --auto-detect
# Execute all 18 benchmarks sequentially
python3 audit_cis.py --all
7. Native PSL MCP Server & Agent Skills¶
python3 mcp_server.py --check && cis-mcp-server --print-client-config
python3 scripts/install_agent_skills.py --verify && python3 scripts/install_agent_skills.py --dry-run
ποΈ Architecture & Strict Design Principles¶
- Python Standard Library (PSL ONLY):
- Absolutely no third-party package dependencies (
requests,jinja2,yaml,paramiko, etc.). - Guaranteed to execute seamlessly in air-gapped, hardened, or restricted enterprise environments.
- Shared Core Engine (
cis_core_engine.py): - Centralized
BaseAuditEngine,AuditScoresTuple, and dynamic scoring algorithms shared across all benchmark targets. - Polymorphic Execution Drivers (
execution_drivers.py): - Decoupled
BaseExecutorhierarchy (LocalExecutor,DockerExecutor,SSHExecutor,RemoteSSHContainerExecutor) with 6-probeRuntimeDetectorand execution context metadata cards. - Zero Plaintext Secret Exposure:
- Sensitive database credentials are systematically injected via environment variables (
MYSQL_PWD,PGPASSWORD,CIS_DB_PASSWORD) and masked in process tables (ps aux) and output logs (SecretSanitizer). - Decoupled Rule Specifications (
rules/*.json): - Every benchmark's check definitions, preconditions, regexes, and remediation steps are stored in standalone JSON files under
rules/. - Diagnostic Telemetry Integrity:
stderrstreams are systematically preserved without destructive2>/dev/nullmasking.- Offline First (Pure Inline SVG):
- Complete visual reports with native inline SVG donut and category charts without requiring Internet access or external CDNs.
- Script Inventory Governance (
IMP-005): - Strictly maintained 15 active production tools in
scripts/; all superseded migration and generator scripts archived underarchive/scripts/.
π¦ Packaging & Release Pipeline¶
The suite follows PyPA standards (100% PSL runtime) and publishes automatically to PyPI (pypi-publish.yml) and Docker Hub (jmrenouard/cis-benchmarks-tools via docker-publish.yml) upon release publication or manual workflow_dispatch (including testpypi support). Versioned MkDocs Material documentation (docs-publish.yml) publishes automatically to https://cis-benchmarks.lightpath.fr/. See the Publishing Guide and the read-only MCP api_executor Contract.
π License¶
This project is licensed under the GNU General Public License v3.0 (GPL-3.0-or-later) - see the LICENSE file for details.