Implement lab 7 transport security and worker containment
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
repo=$PWD
|
||||
project="lab7-clean-$(date -u +%Y%m%d%H%M%S)"
|
||||
dir=$(mktemp -d /tmp/lab7-clean.XXXXXX)
|
||||
sha=$(git rev-parse HEAD)
|
||||
export COMPOSE_PROJECT_NAME="$project"
|
||||
export LAB7_OPERATOR_DIR="$HOME/.local/share/mtusi2026lab7/$project"
|
||||
export LB_HTTPS_PORT=19443 GRAFANA_HTTPS_PORT=28300 BAO_HTTPS_PORT=29200
|
||||
export BASE_URL=https://localhost:19443 BAO_OPERATOR_URL=https://localhost:29200
|
||||
export NO_PROXY=localhost,127.0.0.1,::1
|
||||
cleanup() {
|
||||
status=$?
|
||||
trap - EXIT HUP INT TERM
|
||||
if [ -f "$dir/compose.yaml" ]; then
|
||||
cd "$dir"
|
||||
docker compose --profile tools --profile reconcile down || status=1
|
||||
fi
|
||||
echo "exit_code=$status clone=$dir project=$project volumes retained"
|
||||
exit "$status"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
trap 'exit 130' HUP INT TERM
|
||||
echo "commit=$sha project=$project"
|
||||
git clone --quiet --no-hardlinks "$repo" "$dir"
|
||||
cd "$dir"
|
||||
git checkout --quiet --detach "$sha"
|
||||
printf 'COMPOSE_PROJECT_NAME=%s\n' "$project" > .env
|
||||
export CA_FILE="$dir/secrets/pki/operator/ca.crt"
|
||||
make install
|
||||
make check validate lint
|
||||
make up
|
||||
make test test-security
|
||||
docker compose run --rm --no-deps security-audit
|
||||
python3 scripts/security_inventory.py
|
||||
echo "PASS clean clone with fresh CA, operator state and persistent volumes"
|
||||
Reference in New Issue
Block a user