-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzt-auth.sh
46 lines (46 loc) · 2.04 KB
/
zt-auth.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
################################################################################################
#
# ******
# *...../ / ******
# ************** *****/ *****/*****/***/*************/ ****** /**********
# ******/..*****/ *****/ *****/********//******/ ,*****/******,***** ,*****/
# *****/ ***** *****/ *****/*****/ *****/ /**************************
# *******//*****/ *************/*****/ *********************/*******./*/* ())
# ************* ******/*****/*****/ *****/******/. ****** ********** (()))
# *****/ *****/ ())
# *****/ *****/
#
################################################################################################
# NOTICE: MAC SPECIFIC SCRIPT
################################################################################################
#
#
#//////////////////\\\\\\\\\\\\\\\\\\\\#
#\\\\\\\\\\\\\\\\\\////////////////////#
#//////////////////\\\\\\\\\\\\\\\\\\\\#
#\\\\\\\\\\\\\\\\\\////////////////////#
###\\\\ INCOMPLETE DO NOT TEST ////###
#//////////////////\\\\\\\\\\\\\\\\\\\\#
#\\\\\\\\\\\\\\\\\\////////////////////#
#//////////////////\\\\\\\\\\\\\\\\\\\\#
#\\\\\\\\\\\\\\\\\\////////////////////#
#
#
################################################################################################
#
# 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."
#
# 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 >> '~/.ztconfig.authorized'
#