Skip to content

Remediation scope

kimera generate writes NetworkPolicy remediation either for the one workload an exploit ran from or for the whole namespace. Targeted scope constrains only the source workload. Namespace scope constrains every pod.

Terminal window
kimera -n unguard exploit missing-network-policies --json > findings.json
kimera -n unguard generate --from-findings findings.json # targeted scope

--scope takes targeted or namespace. It defaults to targeted when --from-findings is given and to namespace otherwise. --scope targeted without findings exits non-zero.

The findings must come from the namespace given with -n, and their source workload must still exist there. Otherwise generation stops.

--scope applies to remediation only. --mode exploit ignores it.

With findings, every observed path from the source workload is classified and printed before the set is written. The first rule that matches decides.

  1. A path whose result is unknown is listed as not measured and left unclassified.
  2. Port 53 is KEEP, because every targeted set permits DNS.
  3. A destination declared for the source in network_topology is KEEP.
  4. An undeclared data-store port (3306, 5432, 6379, 27017) is DENY.
  5. A destination outside the namespace is DENY.
  6. Any other in-namespace destination is REVIEW. It is denied and listed for a decision; declaring it and regenerating keeps it.

A source’s declared dependencies are the workloads whose allowed_ingress_from selectors match the source’s labels.

The model’s output is reduced to what the finding justifies, and every change is logged as a warning:

  • Documents that are not NetworkPolicies are dropped.
  • A policy with no matchLabels, which would select every pod, is dropped. Targeted scope emits no default-deny.
  • A policy selecting another workload is dropped.
  • If no policy selects the source, one is built.

The egress of the first remaining policy is then replaced with DNS, the declared dependencies on their ports, and the declared external destinations. Nothing else is permitted.

Only that first policy is rewritten. If the model emits a second policy selecting the source, its egress rules stay as written, and NetworkPolicy egress rules add up. Ingress rules stay as the model wrote them.

Namespace scope keeps the full set the model writes. For missing-network-policies and all, a deterministic pass adds egress rules for declared flows the set denies and for declared external destinations.

network_topology in a profile drives generation. The map key names the workload an entry applies to.

network_topology:
unguard-mariadb:
allowed_ingress_from: # omit the key to leave ingress undeclared;
- {app.kubernetes.io/name: like-service} # an empty list means block all ingress
unguard-user-simulator:
allowed_egress_to: # destinations outside the namespace
- cidr: 0.0.0.0/0
except: [10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.169.254/32]
ports: [80, 443]
protocol: TCP
  • allowed_ingress_from is a list of pod label selectors. An omitted key leaves ingress undeclared. An empty list blocks all ingress.
  • allowed_egress_to lists destinations outside the namespace. Each has a cidr, an optional except list, at least one port in 1 to 65535, and protocol TCP or UDP (default TCP).

A workload with an external dependency needs allowed_egress_to, or a default-deny set severs it. The workload then fails to start while every app-to-app flow still passes, which can be mistaken for a segmentation failure. Nothing is inferred: an undeclared destination is not permitted.

kimera validate-control --type network-policy reports a declared flow that the applied set severs as ERROR. The defense validation page lists the checks.

generate writes kimera-remediations.yaml by default and applies nothing. --apply applies the file after a confirmation prompt, which --yes or --dry-run skips. kimera apply <file> applies an existing file.

The applier creates NetworkPolicies only and skips other kinds. It adds the label app.kubernetes.io/managed-by: kimera and fills in the namespace when it is missing. Each apply is recorded in the operation journal.

kimera revert removes applied policies by that label. It deletes every Kimera-labelled NetworkPolicy in the namespace, including policies from earlier runs. The safety model describes the journal.

All product names and logos are trademarks of their respective owners, used for identification only. No endorsement is implied.