Complete Documentation (Comprehensive)¶
This document is the single, high-detail reference for architecture, usage, operations, testing, packaging, and known failure handling.
For role-oriented quick access:
- New contributors: GETTING_STARTED.md
- API/CLI users: CLI_AND_API_REFERENCE.md
- Operators/release engineers: OPERATIONS_RUNBOOK.md
- Tool and OS compatibility: TOOL_MATRIX.md
- Historical incidents + fixes: TROUBLESHOOTING_AND_POSTMORTEMS.md
- Code map: CODEBASE_DEEP_DIVE.md
1) Project goals¶
CIS Hardening Tool is an orchestration layer over security scanners. It does not replace scanner engines; it installs, invokes, normalizes, and reports their results across Linux and Windows.
Primary goals:
- Unified execution model across heterogeneous operating systems.
- Best-effort installation and scanning with graceful degradation.
- Unified report output from mixed tool formats.
- Practical artifact-level validation via VMs before release acceptance.
2) Runtime modes¶
- Interactive CLI (
cis-toolwith no subcommand) - Direct CLI commands (
scan,tools,history,server,doctor,findings) - FastAPI server + WebSocket UI (
main.py,cis-tool server run) - Packaged binaries (
.deb, AppImage, Windows standalone/installer)
The CLI is structured as a cli/ package (8 modules) rather than a single cli.py file. Global flags include --json, --exit-code, --quiet, --verbose, and --only-failures.
3) Tool support overview¶
See full matrix at TOOL_MATRIX.md.
- Linux: OpenSCAP, Lynis, CIS-CAT Lite, USG (Ubuntu only)
- Windows: HardeningKitty, CIS-CAT Lite, SCT (manual asset)
4) Key data paths¶
- SQLite DB:
cis_history.db(lazy-initialized on first access) - Per-scan artifacts:
<runtime_home>/reports/<YYYYmmdd_HHMMSS>__<scan_id>/... - Session logs:
<runtime_home>/logs/scans/<scan_id>/<YYYYmmdd_HHMMSS>.ndjson - Per-tool logs:
<runtime_home>/logs/scans/<scan_id>/<tool_name>.log - Background server logs:
<runtime_home>/logs/web_server_<YYYYmmdd_HHMMSS>.log - VM validation artifacts:
vms/artifacts/
5) Security and privilege model¶
- Linux scan/install flows generally require root; CLI re-execs with
sudofor non-whitelisted commands. - Windows uses elevation request (
runas) path. - Network operations include release/tool download and scanner content retrieval.
- Local DB and logs are file-based; protect host filesystem permissions accordingly.
6) Install and run quick recipes¶
Dev mode¶
uv pip install -e .
cis-tool --version
cis-tool tools status
cis-tool scan --tools lynis,openscap --non-interactive --export pdf --output report.pdf
Server mode¶
Release artifact validation¶
7) Design principles used across the codebase¶
- Best-effort installation
- Tool installs try per-package and continue on partial failure.
- Cross-distro adaptability
- Package mappings are distro/version aware with fallbacks.
- Safe subprocess environment
- Sanitized env avoids AppImage/PyInstaller linker pollution.
- Operational observability
- Rich console logs, API/log streaming, VM per-target logs.
- Packaging reproducibility
- CI artifacts built in pinned base environments.
8) Documentation map by audience¶
Platform/infra engineers¶
Security engineers/compliance operators¶
Maintainers/contributors¶
9) What changed recently (important)¶
- Debian 11 VM path removed from active matrix.
- Installer robustness improved for distro/version-specific package drift.
- Windows CIS-CAT Java prerequisite moved into install logic.
- VM runners updated to collect/export PDFs and improve diagnostics.
- Packaging includes frontend/template data for standalone runtime correctness.
- CLI refactored from single
cli.pyintocli/package (8 modules). - Reporter refactored:
report_gen.pydeleted and merged intoreporter.py; parsing logic extracted tocore/parsers/package. - New core modules:
core/deps.py,core/constants.py,core/os_detect.py,core/ws_patch.py. - New CLI commands:
doctor(diagnostics),findings(query scan findings). - New API endpoints:
GET /api/health,GET /scan/{id}/findings,GET /scan/{id}/timeline,DELETE /scan/{id}, paginatedGET /scan/status. - Frontend redesigned as multi-page SPA with hash-based routing and modal log viewer.
- Docker build uses uv multi-stage;
Dockerfile.rockyremoved; singleDockerfile. setup.pyremoved;pyproject.tomlis the sole build configuration.- Database: lazy initialization,
completed_atcolumn,delete_scanhelper, pagination support. scan_logger.py: per-tool log files.logger.py:LOG_FORMAT=jsonsupport.- CIS-CAT Linux logic extracted to
wrappers/ciscat_linux.py.
10) Source of truth¶
If docs and behavior diverge, code is authoritative. Start from:
cli/(package with 8 modules)main.pycore/tool_manager.pycore/tools_config.pycore/constants.pycore/deps.pycore/os_detect.pycore/parsers/(report parsing package)core/wrappers/linux.pycore/wrappers/windows.pycore/wrappers/ciscat_linux.pyscripts/*.github/workflows/release.yml