#!/bin/sh set -eu cd "$(dirname "$0")/.." docker compose --env-file .env -f compose.yaml exec -T api python3 - <<'PY' from urllib.request import urlopen try: urlopen("http://s3:9000/messenger-attachments/", timeout=3) raise SystemExit("anonymous bucket read was allowed") except Exception as exc: code = getattr(exc, "code", None) if code not in (401, 403): raise SystemExit("unexpected result %s %s" % (type(exc).__name__, code)) print("anonymous S3 status", code) PY