telebit/examples/admin-disconnect-device.sh

21 lines
502 B
Bash
Raw Permalink Normal View History

2020-07-20 22:21:27 +00:00
#!/bin/bash
set -e
set -u
source .env
TUNNEL_RELAY_API="${TUNNEL_RELAY_API:-"https://devices.example.com/api"}"
2020-07-29 16:26:15 +00:00
CLIENT_SUBJECT="${CLIENT_SUBJECT:-"newbie"}"
2020-07-20 22:21:27 +00:00
echo "RELAY_SECRET: $RELAY_SECRET"
TOKEN=$(go run cmd/signjwt/*.go \
--vendor-id "$VENDOR_ID" \
--secret "$RELAY_SECRET" \
--machine-ppid "$RELAY_SECRET"
)
echo "ADMIN TOKEN: '$TOKEN'"
echo "Auth URL: $TUNNEL_RELAY_API"
2020-07-29 16:26:15 +00:00
curl -X DELETE "$TUNNEL_RELAY_API/subscribers/${CLIENT_SUBJECT}" -H "Authorization: Bearer ${TOKEN}"
2020-07-20 22:21:27 +00:00
echo ""