Run Remote SSH and Docker CIS Audits¶
Read Reference Index before you start.
Prerequisites¶
- Make sure that Python
3.8+exists on the controller. - Make sure that SSH keys and Docker Engine work.
Safety Instructions¶
CAUTION: Set mode 0600 on SSH keys before remote execution.
Open permissions fail BatchMode=yes checks or expose secrets.
CAUTION: Do not pass database passwords on the command line.
Command arguments leak secrets in process listings (ps aux).
Procedure¶
- List all 18 target keys:
- Run a local Docker container audit:
- Run a remote SSH audit with
--mode sshand--ssh-key:
python3 audit_cis.py -t rhel9 -m ssh -r admin@192.168.1.50 \
--ssh-port 22 -i ~/.ssh/id_ed25519 --sudo -f json -o reports/rhel9_ssh.json
- Run a remote SSH Docker audit for a remote container:
python3 audit_cis.py -t postgresql17 -r admin@192.168.1.50 \
--docker prod-pg17 -f html -o reports/pg17_remote.html
- Mount
/app/reportswhen you runjmrenouard/cis-benchmarks-tools:
docker run --rm -v "$(pwd)/reports:/app/reports" jmrenouard/cis-benchmarks-tools \
-t mariadb106 -r admin@192.168.1.50 -f html -o /app/reports/audit.html
NOTE: The container runs as non-root cisuser (UID 10001).
Verification¶
- Confirm exit code
0fromaudit_cis.py. - Inspect JSON output and confirm zero
Errorstates:
python3 -c "import json; d=json.load(open('reports/rhel9_ssh.json')); print(d.get('target', d['benchmark']), d['overall_score'])"
Rollback¶
- Stop any stuck
audit_cis.pyprocess. - Delete partial files in
reports/. - Test SSH access with
ssh -o BatchMode=yes admin@192.168.1.50 true.