(entry: Dict[str, str], rec_host: str, kind: str)
| 133 | controls: Dict[str, Dict[str, Any]] = {} |
| 134 | |
| 135 | def bucket(entry: Dict[str, str], rec_host: str, kind: str): |
| 136 | code = (entry.get("code") or "").strip() |
| 137 | mapping = self._map_lynis_code(code) |
| 138 | for control in mapping["controls"]: |
| 139 | slot = controls.setdefault(control, { |
| 140 | "control": control, |
| 141 | "title": mapping["title"], |
| 142 | "warnings": 0, |
| 143 | "suggestions": 0, |
| 144 | "findings": [], |
| 145 | }) |
| 146 | if kind == "warning": |
| 147 | slot["warnings"] += 1 |
| 148 | else: |
| 149 | slot["suggestions"] += 1 |
| 150 | slot["findings"].append({ |
| 151 | "host": rec_host, |
| 152 | "code": code or "—", |
| 153 | "kind": kind, |
| 154 | "message": entry.get("message", ""), |
| 155 | "remediation": entry.get("remediation", ""), |
| 156 | "severity": "high" if kind == "warning" else "medium", |
| 157 | }) |
| 158 | |
| 159 | for rec in lynis: |
| 160 | for warning in rec["warnings"]: |
nothing calls this directly
no test coverage detected