ZeroTierOne/doc/ext/kubernetes/entrypoint.sh

23 lines
817 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: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-22 18:33:10 +00:00
# Fill out local service auth token
2016-08-18 01:33:49 +00:00
AUTHTOKEN=$(cat /var/lib/zerotier-one/authtoken.secret)
2016-08-18 22:15:38 +00:00
sed "s|\local_service_auth_token_replaced_automatically|${AUTHTOKEN}|" .zerotierCliSettings > /root/.zerotierCliSettings
2016-08-18 22:13:43 +00:00
echo '*** Authorizing'
./zerotier-cli net-auth @my.zerotier.com "$nwid" "$dev"
2016-08-22 18:33:10 +00:00
echo '*** Cleaning up' # Remove controller auth token
rm -rf .zerotierCliSettings /root/.zerotierCliSettings
2016-08-18 22:13:43 +00:00
node server.js