Files
mtusi2026lab4-fork/scripts/check_s3_exposure.sh
T
2026-11-01 01:18:40 +03:00

11 lines
522 B
Bash

#!/usr/bin/env bash
# Host-side: S3 (9000/9001) must not be published anywhere; the network must be internal.
set -eu
pub=$(docker compose ps s3 --format '{{.Publishers}}')
echo "s3 publishers: ${pub:-none}"
case "$pub" in ""|"[]") ;; *) echo "FAIL: s3 publishes ports" >&2; exit 1;; esac
for port in 9000 9001; do
if (exec 3<>/dev/tcp/127.0.0.1/$port) 2>/dev/null; then echo "FAIL: host can reach :$port" >&2; exit 1; fi
done
echo "PASS: S3 and console unreachable from host; run 'make check-s3' for in-network checks"