#!/bin/sh set -eu cd "$(dirname "$0")/.." # Bootstrap is deliberately repeated; existing objects must survive both runs. docker compose run --rm s3-init docker compose run --rm s3-init docker compose run --rm --entrypoint /bin/sh s3-init -ec ' mc alias set app http://s3:9000 "$(cat /run/secrets/s3_api_access_key_id)" "$(cat /run/secrets/s3_api_secret_access_key)" >/dev/null if mc admin info app >/dev/null 2>&1; then exit 1; fi if mc mb app/forbidden-bucket >/dev/null 2>&1; then exit 1; fi if mc anonymous set download "app/$S3_BUCKET" >/dev/null 2>&1; then exit 1; fi printf test > /tmp/test-object if mc cp /tmp/test-object "app/$S3_BUCKET/forbidden-prefix/object" >/dev/null 2>&1; then exit 1; fi mc stat "app/$S3_BUCKET" >/dev/null printf "PASS: app cannot administer MinIO, create buckets, change policy or write to an unrelated prefix\n" ' if docker compose exec -T lb wget -q -T 2 -O /dev/null http://s3:9001; then echo 'FAIL: console reachable from shared network' exit 1 fi echo 'PASS: console unavailable from shared network'