Tutorial 3: Multi-Engine and Auto-Detect Lab¶
Goal: Run
--auto-detect, audit five engines, export EN/FR reports, and test all five formats inside/tmp/cis-multi.
Warning
Isolated Lab Only: Store files in /tmp/cis-multi and target disposable
containers only.
flowchart LR
DET["--auto-detect"] --> ENG["PG16 / MySQL84 / Mongo8 / Cas50 / RHEL9"]
ENG --> FMT["-f html | json | xml | txt | sarif"]
FMT --> LNG["-l en | fr -> /tmp/cis-multi"]
Prerequisites¶
- Python
3.8+checkout ofcis_benchmarks_tools - Completed Tutorial 2: SARIF & Dry-Run Lab
- Optional: Docker Engine for disposable database containers
| Engine | Target Key | Ctrls | Lab Source |
|---|---|---|---|
| PostgreSQL 16/17/18 | postgresql16 (17, 18) |
71 | docker/Dockerfile_postgresql16 |
| MySQL Community 8.4 | mysql-community84 |
79 | docker/Dockerfile_mysql_community_84 |
| MongoDB 8.0 | mongodb8 |
23 | docker/Dockerfile_mongodb8 |
| Apache Cassandra 5.0 | cassandra50 |
20 | docker/Dockerfile_cassandra50 |
| RHEL 9 | rhel9 |
20 | Local host (--local) |
Step 1: Prepare Sandbox and Test --auto-detect¶
With zero matching containers, expected output prints
No specific containers auto-detected. Listing available targets. and lists
all 18 targets.
Step 2: Export All Five Formats in EN and FR (rhel9)¶
Run local rhel9 audits across html, json, xml, txt, and sarif with
English (-l en) and French (-l fr) output.
python3 audit_cis.py -t rhel9 --local -f html -l en -o /tmp/cis-multi/rhel9_en.html
python3 audit_cis.py -t rhel9 --local -f html -l fr -o /tmp/cis-multi/rhel9_fr.html
python3 audit_cis.py -t rhel9 --local -f json -l en -o /tmp/cis-multi/rhel9.json
python3 audit_cis.py -t rhel9 --local -f xml -l en -o /tmp/cis-multi/rhel9.xml
python3 audit_cis.py -t rhel9 --local -f txt -l fr -o /tmp/cis-multi/rhel9_fr.txt
python3 audit_cis.py -t rhel9 --local -f sarif -l en -o /tmp/cis-multi/rhel9.sarif
ls -1 /tmp/cis-multi
Expected output lists all six report files in /tmp/cis-multi.
Step 3: Audit Database Engines in Disposable Containers¶
Build and start disposable containers with target-aligned names for PostgreSQL 16, MySQL 8.4, MongoDB 8, and Cassandra 5.0.
docker build -f docker/Dockerfile_postgresql16 -t lab-postgres16 . && docker run -d --name lab-postgres16 lab-postgres16
docker build -f docker/Dockerfile_mysql_community_84 -t lab-mysql-community84 . && docker run -d --name lab-mysql-community84 lab-mysql-community84
docker build -f docker/Dockerfile_mongodb8 -t lab-mongodb8 . && docker run -d --name lab-mongodb8 lab-mongodb8
docker build -f docker/Dockerfile_cassandra50 -t lab-cassandra50 . && docker run -d --name lab-cassandra50 lab-cassandra50
sleep 20
Audit each container using distinct formats and languages. Swap postgresql16
for postgresql17 or postgresql18 for newer PostgreSQL releases.
python3 audit_cis.py -t postgresql16 -c lab-postgres16 -f json -l en -o /tmp/cis-multi/pg16.json
python3 audit_cis.py -t mysql-community84 -c lab-mysql-community84 -f html -l fr -o /tmp/cis-multi/my84_fr.html
python3 audit_cis.py -t mongodb8 -c lab-mongodb8 -f xml -l en -o /tmp/cis-multi/mg8.xml
python3 audit_cis.py -t cassandra50 -c lab-cassandra50 -f sarif -l en -o /tmp/cis-multi/cas50.sarif
Expected output prints one completion line per engine with its control count.
Step 4: Re-Run --auto-detect Against Active Containers¶
Expected output prints Auto-detected targets: including postgresql16,
mysql-community84, mongodb8, and cassandra50 before running audits.
Step 5: Clean Up /tmp/cis-multi¶
for n in lab-postgres16 lab-mysql-community84 lab-mongodb8 lab-cassandra50; do
if docker container inspect "$n"; then docker rm -f "$n"; fi
done
rm -rf /tmp/cis-multi