67 lines
5.0 KiB
Go Template
67 lines
5.0 KiB
Go Template
{{- /*
|
|
report.gohtml — IEC 62443-3-3 SL2 Compliance Report Template
|
|
|
|
Rendered directly by gomplate (https://gomplate.ca) — no custom Go binary
|
|
required. The JSON report is loaded as the root context, so fields are
|
|
accessed with plain dot notation (e.g. .meta.target).
|
|
|
|
Only gomplate's built-in functions (math.*, strings.*) are used, plus two
|
|
in-line sub-templates (passIcon/severityIcon) defined below.
|
|
|
|
Usage:
|
|
gomplate --context .=reports/<hostname>-<date>.json --file reports/report.gohtml
|
|
|
|
To customize: copy this file, modify, and point --file at the copy.
|
|
*/ -}}
|
|
{{- define "passIcon" -}}
|
|
{{- if eq . true }}✅ PASS{{ else if eq . false }}❌ FAIL{{ else }}❓ MANUAL{{ end -}}
|
|
{{- end -}}
|
|
{{- define "severityIcon" -}}
|
|
{{- if eq . "critical" }}🔴{{ else if eq . "high" }}🟠{{ else if eq . "medium" }}🟡{{ else if eq . "low" }}🟢{{ else }}⚪{{ end -}}
|
|
{{- end -}}
|
|
╔══════════════════════════════════════════════════════════════════════════╗
|
|
║ IEC 62443-3-3 SECURITY LEVEL 2 — COMPLIANCE REPORT ║
|
|
╠══════════════════════════════════════════════════════════════════════════╣
|
|
║ Target: {{ printf "%-56s" .meta.target }}║
|
|
║ Standard: {{ printf "%-56s" .meta.standard }}║
|
|
║ Level: {{ printf "%-56s" .meta.security_level }}║
|
|
║ Timestamp: {{ printf "%-56s" .meta.timestamp }}║
|
|
║ Executed by: {{ printf "%-55s" .meta.executed_by }}║
|
|
╠══════════════════════════════════════════════════════════════════════════╣
|
|
║ EXECUTIVE SUMMARY ║
|
|
╠══════════════════════════════════════════════════════════════════════════╣
|
|
║ ║
|
|
║ TOTAL PASSED FAILED REVIEW COMPLIANCE ║
|
|
║ ───── ────── ────── ────── ────────── ║
|
|
║ {{ printf "%-8d" .summary.total }} {{ printf "%-9d" .summary.passed }} {{ printf "%-9d" .summary.failed }} {{ printf "%-9d" .summary.skipped }} {{ if gt .summary.total 0 }}{{ printf "%.1f%%" (mul (div .summary.passed .summary.total) 100) }}{{ else }}N/A{{ end }}
|
|
║ ║
|
|
╠══════════════════════════════════════════════════════════════════════════╣
|
|
║ RESULTS BY REQUIREMENT ║
|
|
╠══════════════════════════════════════════════════════════════════════════╣
|
|
║ ║
|
|
{{- range $i, $r := .results }}
|
|
║ {{ template "severityIcon" $r.severity }} [{{ $r.test_id }}] {{ template "passIcon" $r.passed }} {{ $r.description }}
|
|
║ Requirement: {{ $r.requirement }}
|
|
║ Expected: {{ $r.expected }}
|
|
║ Actual: {{ $r.actual }}
|
|
{{- if not $r.passed }}
|
|
║ Fix: {{ $r.remediation }}
|
|
{{- end }}
|
|
║ ║
|
|
{{- end }}
|
|
╠══════════════════════════════════════════════════════════════════════════╣
|
|
║ FAILURE DETAIL ║
|
|
╠══════════════════════════════════════════════════════════════════════════╣
|
|
{{- $failures := .failures }}
|
|
{{- if $failures }}
|
|
{{- range $i, $f := $failures }}
|
|
║ ❌ {{ $f.test_id }} — {{ $f.description }}
|
|
║ Severity: {{ $f.severity | strings.Title }}
|
|
║ Remediation: {{ $f.remediation }}
|
|
║ ║
|
|
{{- end }}
|
|
{{- else }}
|
|
║ ✅ ALL CONTROLS PASSED ║
|
|
{{- end }}
|
|
╚══════════════════════════════════════════════════════════════════════════╝
|