diff --git a/docker-compose.yml b/docker-compose.yml index ce071d3f..5fb028d6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,7 @@ services: # image: docker-bench-security # use build path to Dockerfile if docker-compose should build the image + image: docker-bench-security build: . cap_add: @@ -19,3 +20,11 @@ services: - /var/run/docker.sock:/var/run/docker.sock:ro - /usr/lib/systemd:/usr/lib/systemd:ro - /etc:/etc:ro + - ./log:/log + + report: + image: nginx:alpine + ports: + - "8099:80" + volumes: + - ./log:/usr/share/nginx/html:ro diff --git a/generate_report.py b/generate_report.py new file mode 100644 index 00000000..5dc61ced --- /dev/null +++ b/generate_report.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +import json, sys, pathlib + +log_dir = pathlib.Path(__file__).parent / "log" +json_file = log_dir / "docker-bench-security.log.json" +output_file = log_dir / "report.html" + +with open(json_file) as f: + data = json.load(f) + +COLORS = {"PASS": "#2ecc71", "WARN": "#e74c3c", "INFO": "#3498db", "NOTE": "#f39c12"} +BG = {"PASS": "#eafaf1", "WARN": "#fdedec", "INFO": "#eaf4fb", "NOTE": "#fef9e7"} + +rows = [] +totals = {"PASS": 0, "WARN": 0, "INFO": 0, "NOTE": 0} + +for section in data.get("tests", []): + rows.append(f'
| Resultado | ID | Descripción | Detalle | +
|---|