feat(lab9): falco custom rules + conftest hardening policies#1427
Open
Muratich wants to merge 4 commits into
Open
feat(lab9): falco custom rules + conftest hardening policies#1427Muratich wants to merge 4 commits into
Muratich wants to merge 4 commits into
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
Lab 9: runtime detection with Falco (baseline + custom rules) and Kubernetes hardening checks with Conftest, documented in
submissions/lab9.md.Changes
submissions/lab9.mdlabs/lab9/falco/rules/custom-rules.yamllabs/lab9/policies/extra/hardening.regolabs/lab9/falco/logs/.gitkeepWrite to /tmp by containerPossible Cryptominer ActivityrunAsNonRoot,allowPrivilegeEscalation,capabilities.drop ALL,resources.limits.memory, image digest pinningTesting
docker run -d --name lab9-target alpine:3.20 sleep 1ddocker run -d --name falco --privileged ... falcosecurity/falco:0.43.1 falco -U -o json_output=true -o time_format_iso_8601=truedocker exec lab9-target /bin/sh -lc 'echo "shell-in-container test"'docker exec lab9-target /bin/sh -lc 'cat /etc/shadow'docker exec --user 0 lab9-target /bin/sh -lc 'echo "test" > /tmp/my-write.txt'docker exec lab9-target /bin/sh -c 'apk add --no-cache netcat-openbsd && nc -w 2 127.0.0.1 3333'conftest test labs/lab9/manifests/k8s/juice-hardened.yaml --policy labs/lab9/policies/extra/conftest test labs/lab9/manifests/k8s/juice-unhardened.yaml --policy labs/lab9/policies/extra/conftest test labs/lab9/manifests/compose/juice-compose.yml --policy labs/lab9/policies/compose-security.rego --namespace compose.securityconftest test $env:TEMP/bad-compose.yml --policy labs/lab9/policies/compose-security.rego --namespace compose.securityTerminal shell in container,Read sensitive file untrusted,Write to /tmp by container,Possible Cryptominer Activity(JSON alerts in submission)10 tests, 10 passed, 0 failures4 failures(runAsNonRoot, allowPrivilegeEscalation, memory limits, digest)juice-compose.yml, FAIL on bad compose (missing user + read_only)Artifacts & Screenshots
submissions/lab9.mdlabs/lab9/falco/rules/custom-rules.yamllabs/lab9/policies/extra/hardening.regosubmissions/lab9.mdsubmissions/lab9.mdChecklist
feat(lab9): falco custom rules + conftest hardening policies)labs/lab9/falco/logs/not committed, only.gitkeep)submissions/lab9.mdexists