From 025c4ac5e24242236c250e635ebd8c17c3edfbe6 Mon Sep 17 00:00:00 2001 From: Michael <30936296+mtan93@users.noreply.github.com> Date: Wed, 22 Dec 2021 10:28:59 +0000 Subject: [PATCH] Create zt-auth.sh --- zt-auth.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 zt-auth.sh diff --git a/zt-auth.sh b/zt-auth.sh new file mode 100644 index 0000000..20b0363 --- /dev/null +++ b/zt-auth.sh @@ -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'