feat(lab9): falco custom rules + conftest hardening policies#4
Open
SSSNeka wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Run Falco with modern eBPF to trigger baseline + custom runtime alerts, then write Conftest/Rego policies that gate Kubernetes manifests at CI time β per Lab 9.
Changes
docker run --rm --privileged alpine test -f /sys/kernel/btf/vmlinuxconfirmed before starting).lab9-target(alpine):Terminal shell in containerandRead sensitive file untrusted(cat /etc/shadow).labs/lab9/falco/rules/custom-rules.yaml) β "Write to /tmp by container" β and confirmed it fires via SIGHUP rule-reload + a live trigger.labs/lab9/policies/extra/hardening.rego(Conftest,package main) with 5 deny rules:runAsNonRoot,allowPrivilegeEscalation,capabilities.drop: ["ALL"],resources.limits.memory, and sha256-digest pinning.juice-hardened.yaml, 5 distinct failures onjuice-unhardened.yaml.compose-security.rego(--namespace compose.security) against the provided hardened compose file (PASS) and a deliberately unhardened one (FAIL) to show the samedeny[msg]pattern generalizing toinput.services.not "ALL" in <possibly-missing-path>silently never fires when the path is fully undefined (undefined propagation), guarded withobject.get(..., [])in my policy β the shipped compose policy has the same gap, which is why only 2 of 3 possible denies fire on the bad-compose test.Testing
docker logs falcoβ confirmsOpening 'syscall' source with modern BPF probe.submissions/lab9.md.echo test > /tmp/my-write.txtβ JSON alert captured.conftest test .../juice-hardened.yaml --policy labs/lab9/policies/extra/β10 tests, 10 passed, 0 failures.conftest test .../juice-unhardened.yaml --policy labs/lab9/policies/extra/β10 tests, 5 passed, 5 failures.conftest test .../juice-compose.yml --policy .../compose-security.rego --namespace compose.securityβ4 tests, 4 passed, 0 failures.4 tests, 2 passed, 2 failures.Artifacts & Screenshots
See
submissions/lab9.mdfor full JSON alert dumps, the policy source, and all Conftest output.Checklist
feat(lab9): falco custom rules + conftest hardening policies)labs/lab9/falco/logs/excluded β only rule/policy files and the submission write-up committed)submissions/lab9.mdexists