ZeroTierOne/doc/ext/kubernetes/entrypoint.sh

21 lines
650 B
Bash
Raw Normal View History

2016-08-18 22:13:43 +00:00
#!/bin/bash
2016-08-18 00:43:34 +00:00
echo '*** ZeroTier-Kubernetes self-auth test script'
chown -R daemon /var/lib/zerotier-one
chgrp -R daemon /var/lib/zerotier-one
su daemon -s /bin/bash -c '/zerotier-one -d -U -p9993 >>/tmp/zerotier-one.out 2>&1'
2016-08-18 22:13:43 +00:00
dev=""
2016-08-18 00:43:34 +00:00
2016-08-18 00:52:19 +00:00
nwconf=$(ls *.conf)
nwid="${nwconf%.*}"
2016-08-18 01:03:34 +00:00
2016-08-18 22:13:43 +00:00
sleep 10
dev=$(cat /var/lib/zerotier-one/identity.public| cut -d ':' -f 1)
echo '*** Joining'
./zerotier-cli join "$nwid".conf
2016-08-18 01:33:49 +00:00
AUTHTOKEN=$(cat /var/lib/zerotier-one/authtoken.secret)
sed "s|\local_service_auth_token|${AUTHTOKEN}|" .zerotierCliSettings > /root/.zerotierCliSettings
2016-08-18 22:13:43 +00:00
echo '*** Authorizing'
./zerotier-cli net-auth @my.zerotier.com "$nwid" "$dev"
node server.js