Completed for a grade of four

This commit is contained in:
2026-11-05 17:49:35 +03:00
parent 770ca11745
commit b4834572a7
31 changed files with 785 additions and 66 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/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 outside originals/\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'