feat: remove api key after getting the connector
This commit is contained in:
parent
61ba3516d9
commit
e74b73a640
@ -1,9 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
API_HOST="https://api.ssh.surf"
|
|
||||||
API_KEY=$(cat .api-key)
|
|
||||||
|
|
||||||
if [ ! -f .connector ]; then
|
if [ ! -f .connector ]; then
|
||||||
|
API_HOST="https://api.ssh.surf"
|
||||||
|
API_KEY=$(cat .api-key)
|
||||||
|
|
||||||
echo "SSH Connector not found, getting for the first time"
|
echo "SSH Connector not found, getting for the first time"
|
||||||
[ -z $API_KEY ] && echo "API key not found" && exit 1
|
[ -z $API_KEY ] && echo "API key not found" && exit 1
|
||||||
|
|
||||||
@ -17,6 +17,9 @@ if [ ! -f .connector ]; then
|
|||||||
CONNECTOR=$(curl -sH "x-ssh-auth: $API_KEY" -X POST -H "content-type: application/json" $API_HOST/exec --data '{ "cmd": "con --list | grep ssh - Port: 22", "pwd": "/root" }' | grep -o 'Connector: [^"]*' | sed 's/Connector: //' | sed 's/\\n//')
|
CONNECTOR=$(curl -sH "x-ssh-auth: $API_KEY" -X POST -H "content-type: application/json" $API_HOST/exec --data '{ "cmd": "con --list | grep ssh - Port: 22", "pwd": "/root" }' | grep -o 'Connector: [^"]*' | sed 's/Connector: //' | sed 's/\\n//')
|
||||||
|
|
||||||
echo $CONNECTOR > .connector
|
echo $CONNECTOR > .connector
|
||||||
|
|
||||||
|
echo "Connector saved, deleting .api-key"
|
||||||
|
rm .api-key
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CONNECTOR=$(cat .connector)
|
CONNECTOR=$(cat .connector)
|
||||||
|
Loading…
Reference in New Issue
Block a user