#!/usr/bin/env bash set -euo pipefail BASE_DOMAIN="${NETMAKER_BASE_DOMAIN:-nm.101-96-214-81.nip.io}" ENV_FILE="${NETMAKER_ENV_FILE:-/root/netmaker/netmaker.env}" if [[ ! -f "${ENV_FILE}" ]]; then echo "[AbyssInfo] Missing ${ENV_FILE}" >&2 exit 1 fi set -a # shellcheck source=/dev/null . "${ENV_FILE}" set +a if [[ -z "${MASTER_KEY:-}" ]]; then echo "[AbyssInfo] MASTER_KEY is missing in ${ENV_FILE}" >&2 exit 1 fi echo "[AbyssInfo] Probing Netmaker API routes" for path in \ /api/networks \ /api/v1/networks \ /api/v1/enrollment-keys \ /api/server/getserverinfo \ /api/users/adm/hasadmin \ /api/v1/server/getserverinfo do response_file="$(mktemp)" code="$(curl -ksS -o "${response_file}" -w "%{http_code}" \ -H "Authorization: Bearer ${MASTER_KEY}" \ "https://api.${BASE_DOMAIN}${path}" || true)" printf "%s %s " "${code}" "${path}" head -c 180 "${response_file}" | tr '\n' ' ' echo rm -f "${response_file}" done