Update zt-auth.sh

This commit is contained in:
Michael
2021-12-22 10:36:02 +00:00
committed by GitHub
parent 6954616432
commit 2cc1eb9d05

View File

@@ -23,16 +23,20 @@
#
#
################################################################################################
# First get your NodeID (some OS require sudo here)
NETID=[REPLACE WITH NET ID]
#
# SET INFO
#
NETID=[REPLACE WITH NET ID]
APIKEY=[REPLACE WITH API KEY]
#
#
#
MYID=$(zerotier-cli info | cut -d " " -f 3)
DEVNAME=$(/usr/sbin/scutil --get ComputerName)
DEVDESC=Device authorised through Purple Script.
#Then call the API
DEVDESC="Device authorised through Purple Script."
#
# CALL API WITH INFO
#
curl -H "Authorization: Bearer $APIKEY" -X POST -d '{"name":"$DEVNAME","description":"$DEVDESC","config":{"authorized":true}}' https://my.zerotier.com/api/network/$NETID/member/$MYID
curl -s -H "Authorization: Bearer $APIKEY" https://my.zerotier.com/api/network/$NETID/member/$MYID >> '~/.config.authorized'
curl -s -H "Authorization: Bearer $APIKEY" https://my.zerotier.com/api/network/$NETID/member/$MYID >> '~/.ztconfig.authorized'
#