31 lines
1.2 KiB
Bash
31 lines
1.2 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/../.."
|
|
|
|
ENV_FILE=${ENV_FILE:-.env}
|
|
./scripts/validate-env "$ENV_FILE"
|
|
set -a
|
|
. "./$ENV_FILE"
|
|
set +a
|
|
|
|
tmp=$(mktemp -d)
|
|
trap 'rm -rf "$tmp"' EXIT
|
|
|
|
http_code=$(curl -sS -o /dev/null -w '%{http_code}' "http://${PUBLIC_HOST}/")
|
|
[ "$http_code" = "308" ] || { echo "Expected HTTP 308, got $http_code" >&2; exit 1; }
|
|
curl -fsS "${PUBLIC_WEB_URL}/api/v1/public/app-config" -o "$tmp/app-config.json"
|
|
curl -fsS "${PUBLIC_WEB_URL}/api/v1/public/content" -o "$tmp/content.json"
|
|
curl -fsS "${PUBLIC_WEB_URL}/auth/realms/${KEYCLOAK_REALM}/.well-known/openid-configuration" -o "$tmp/oidc.json"
|
|
|
|
internal_code=$(curl -sS -o /dev/null -w '%{http_code}' "${PUBLIC_WEB_URL}/internal/safety/v1/messages/check")
|
|
[ "$internal_code" = "404" ] || { echo "Public /internal returned $internal_code, expected 404" >&2; exit 1; }
|
|
|
|
headers=$(curl -fsSI "${PUBLIC_WEB_URL}/")
|
|
printf '%s' "$headers" | grep -qi '^x-content-type-options: nosniff'
|
|
printf '%s' "$headers" | grep -qi '^x-request-id:'
|
|
printf '%s' "$headers" | grep -qi '^content-security-policy:'
|
|
|
|
openssl s_client -connect "${PUBLIC_HOST}:443" -servername "$PUBLIC_HOST" </dev/null 2>/dev/null \
|
|
| openssl x509 -noout -checkend 604800
|
|
echo "Public edge smoke passed."
|