mirror of
https://github.com/PurpleComputing/helpful-scripts.git
synced 2026-09-17 19:30:41 +01:00
Create zt-auth.sh
This commit is contained in:
37
zt-auth.sh
Normal file
37
zt-auth.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
******
|
||||
*...../ / ******
|
||||
************** *****/ *****/*****/***/*************/ ****** /**********
|
||||
******/..*****/ *****/ *****/********//******/ ,*****/******,***** ,*****/
|
||||
*****/ ***** *****/ *****/*****/ *****/ /**************************
|
||||
*******//*****/ *************/*****/ *********************/*******./*/* ())
|
||||
************* ******/*****/*****/ *****/******/. ****** ********** (()))
|
||||
*****/ *****/ ())
|
||||
*****/ *****/
|
||||
|
||||
|
||||
#//////////////////\\\\\\\\\\\\\\\\\\\\#
|
||||
#\\\\\\\\\\\\\\\\\\////////////////////#
|
||||
#//////////////////\\\\\\\\\\\\\\\\\\\\#
|
||||
#\\\\\\\\\\\\\\\\\\////////////////////#
|
||||
###\\\\ INCOMPLETE DUE NOT TEST ////###
|
||||
#//////////////////\\\\\\\\\\\\\\\\\\\\#
|
||||
#\\\\\\\\\\\\\\\\\\////////////////////#
|
||||
#//////////////////\\\\\\\\\\\\\\\\\\\\#
|
||||
#\\\\\\\\\\\\\\\\\\////////////////////#
|
||||
|
||||
|
||||
################################################################################################
|
||||
|
||||
|
||||
# First get your NodeID (some OS require sudo here)
|
||||
NETID=[REPLACE WITH NET ID]
|
||||
#
|
||||
APIKEY=[REPLACE WITH API KEY]
|
||||
#
|
||||
MYID=$(zerotier-cli info | cut -d " " -f 3)
|
||||
DEVNAME=$(hostname -f)
|
||||
DEVDESC=Device authorised through Purple Script.
|
||||
#Then call the API
|
||||
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'
|
||||
Reference in New Issue
Block a user