Add token validation
This commit is contained in:
parent
4757159e72
commit
ac50c87b89
@ -1,4 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
[ -z "$1" ] && echo "You need to provide your api key fot this thing to work.
|
API_HOST="https://api.ssh.surf"
|
||||||
It is strongly advised enabling privacy mode (\`/privacy\`) for the time of execution" && exit 1
|
API_KEY="$1"
|
||||||
|
|
||||||
|
[ -z $API_KEY ] && echo "You need to provide your api key fot this thing to work.
|
||||||
|
It is strongly advised enabling privacy mode (\`/privacy\`) for the time of execution" && exit 1
|
||||||
|
|
||||||
|
hello=$(curl -w %{http_code} -sH "x-ssh-auth: $API_KEY" $API_HOST/hello -o /dev/null)
|
||||||
|
|
||||||
|
if [[ hello -ne 200 ]]; then
|
||||||
|
echo "token not valid, exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user