Created
August 2, 2019 20:56
-
-
Save noahbliss/fc66d2a72fea4e87625a77c6d93c776a to your computer and use it in GitHub Desktop.
Patched zerotier installer for kali linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
<<ENDOFSIGSTART= | |
-----BEGIN PGP SIGNED MESSAGE----- | |
Hash: SHA256 | |
ENDOFSIGSTART= | |
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin | |
# | |
# ZeroTier install script | |
# | |
# All this script does is determine your OS and/or distribution and then add the correct | |
# repository or download the correct package and install it. It then starts the service | |
# and prints your device's ZeroTier address. | |
# | |
# Base URL for download.zerotier.com tree; see https://github.com/zerotier/download.zerotier.com if you want to mirror. | |
# Some things want http, some https, so we must specify both. Must include trailing / | |
ZT_BASE_URL_HTTPS='https://download.zerotier.com/' | |
ZT_BASE_URL_HTTP='http://download.zerotier.com/' | |
echo | |
echo '*** ZeroTier One Quick Install for Unix-like Systems' | |
echo | |
echo '*** Tested distributions and architectures:' | |
echo '*** MacOS (10.7+) on x86_64 (just installs ZeroTier One.pkg)' | |
echo '*** Debian (7+) on x86_64, x86, arm, and arm64' | |
echo '*** RedHat/CentOS (6+) on x86_64 and x86' | |
echo '*** Fedora (16+) on x86_64 and x86' | |
echo '*** SuSE (12+) on x86_64 and x86' | |
echo '*** Mint (18+) on x86_64, x86, arm, and arm64' | |
echo | |
echo '*** Please report problems to contact@zerotier.com and we will try to fix.' | |
echo | |
SUDO= | |
if [ "$UID" != "0" ]; then | |
if [ -e /usr/bin/sudo -o -e /bin/sudo ]; then | |
SUDO=sudo | |
else | |
echo '*** This quick installer script requires root privileges.' | |
exit 0 | |
fi | |
fi | |
# Detect MacOS and install .pkg file there | |
if [ -e /usr/bin/uname ]; then | |
if [ "`/usr/bin/uname -s`" = "Darwin" ]; then | |
echo '*** Detected MacOS / Darwin, downloading and installing Mac .pkg...' | |
$SUDO rm -f "/tmp/ZeroTier One.pkg" | |
curl -s ${ZT_BASE_URL_HTTPS}dist/ZeroTier%20One.pkg >"/tmp/ZeroTier One.pkg" | |
$SUDO installer -pkg "/tmp/ZeroTier One.pkg" -target / | |
echo | |
echo '*** Waiting for identity generation...' | |
while [ ! -f "/Library/Application Support/ZeroTier/One/identity.secret" ]; do | |
sleep 1 | |
done | |
echo | |
echo "*** Success! You are connected to port `cat '/Library/Application Support/ZeroTier/One/identity.public' | cut -d : -f 1` of Earth's planetary smart switch." | |
echo | |
exit 0 | |
fi | |
fi | |
# Detect already-installed on Linux | |
if [ -f /usr/sbin/zerotier-one ]; then | |
echo '*** ZeroTier One appears to already be installed.' | |
exit 0 | |
fi | |
rm -f /tmp/zt-gpg-key | |
echo '-----BEGIN PGP PUBLIC KEY BLOCK-----' >/tmp/zt-gpg-key | |
cat >>/tmp/zt-gpg-key << END_OF_KEY | |
Comment: GPGTools - https://gpgtools.org | |
mQINBFdQq7oBEADEVhyRiaL8dEjMPlI/idO8tA7adjhfvejxrJ3Axxi9YIuIKhWU | |
5hNjDjZAiV9iSCMfJN3TjC3EDA+7nFyU6nDKeAMkXPbaPk7ti+Tb1nA4TJsBfBlm | |
CC14aGWLItpp8sI00FUzorxLWRmU4kOkrRUJCq2kAMzbYWmHs0hHkWmvj8gGu6mJ | |
WU3sDIjvdsm3hlgtqr9grPEnj+gA7xetGs3oIfp6YDKymGAV49HZmVAvSeoqfL1p | |
pEKlNQ1aO9uNfHLdx6+4pS1miyo7D1s7ru2IcqhTDhg40cHTL/VldC3d8vXRFLIi | |
Uo2tFZ6J1jyQP5c1K4rTpw3UNVne3ob7uCME+T1+ePeuM5Y/cpcCvAhJhO0rrlr0 | |
dP3lOKrVdZg4qhtFAspC85ivcuxWNWnfTOBrgnvxCA1fmBX+MLNUEDsuu55LBNQT | |
5+WyrSchSlsczq+9EdomILhixUflDCShHs+Efvh7li6Pg56fwjEfj9DJYFhRvEvQ | |
7GZ7xtysF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4IH5eWtbaprkTNIGt00QhsnM5w+rn1tO80giSxXFpKBE+/pAx8PQ | |
RdVFzxHtTUGMCkZcgOJolk8y+DJWtX8fP+3a4Vq11a3qKJ19VXk3qnuC1aeW7OQF | |
j6ISyHsNNsnBw5BRaS5tdrpLXw6Z7TKr1eq+FylmoOK0pIw5xOdRmSVoFm4lVcI5 | |
e5EwB7IIRF00IFqrXe8dCT0oDT9RXc6CNh6GIs9D9YKwDPRD/NKQlYoegfa13Jz7 | |
S3RIXtOXudT1+A1kaBpGKnpXOYD3w7jW2l0zAd6a53AAGy4SnL1ac4cml76NIWiF | |
m2KYzvMJZBk5dAtFa0SgLK4fg8X6Ygoo9E0JsXxSrW9I1JVfo6Ia//YOBMtt4XuN | |
Awqahjkq87yxOYYTnJmr2OZtQuFboymfMhNqj3G2DYmZ/ZIXXPgwHx0fnd3R0Q== | |
=JgAv | |
END_OF_KEY | |
echo '-----END PGP PUBLIC KEY BLOCK-----' >>/tmp/zt-gpg-key | |
echo '*** Detecting Linux Distribution' | |
echo | |
if [ -f /etc/debian_version ]; then | |
dvers=`cat /etc/debian_version | cut -d '.' -f 1 | cut -d '/' -f 1` | |
$SUDO rm -f /tmp/zt-sources-list | |
if [ -f /etc/lsb-release -a -n "`cat /etc/lsb-release 2>/dev/null | grep -F trusty`" ]; then | |
echo '*** Found Ubuntu "trusty", creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/trusty trusty main" >/tmp/zt-sources-list | |
elif [ -f /etc/lsb-release -a -n "`cat /etc/lsb-release 2>/dev/null | grep -F wily`" ]; then | |
echo '*** Found Ubuntu "wily", creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/wily wily main" >/tmp/zt-sources-list | |
elif [ -f /etc/lsb-release -a -n "`cat /etc/lsb-release 2>/dev/null | grep -F xenial`" ]; then | |
echo '*** Found Ubuntu "xenial", creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/xenial xenial main" >/tmp/zt-sources-list | |
elif [ -f /etc/lsb-release -a -n "`cat /etc/lsb-release 2>/dev/null | grep -F zesty`" ]; then | |
echo '*** Found Ubuntu "zesty", creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/zesty zesty main" >/tmp/zt-sources-list | |
elif [ -f /etc/lsb-release -a -n "`cat /etc/lsb-release 2>/dev/null | grep -F precise`" ]; then | |
echo '*** Found Ubuntu "precise", creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/precise precise main" >/tmp/zt-sources-list | |
elif [ -f /etc/lsb-release -a -n "`cat /etc/lsb-release 2>/dev/null | grep -F artful`" ]; then | |
echo '*** Found Ubuntu "artful", creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/artful artful main" >/tmp/zt-sources-list | |
elif [ -f /etc/lsb-release -a -n "`cat /etc/lsb-release 2>/dev/null | grep -F bionic`" ]; then | |
echo '*** Found Ubuntu "bionic", creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/bionic bionic main" >/tmp/zt-sources-list | |
elif [ -f /etc/lsb-release -a -n "`cat /etc/lsb-release 2>/dev/null | grep -F yakkety`" ]; then | |
echo '*** Found Ubuntu "yakkety", creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/yakkety yakkety main" >/tmp/zt-sources-list | |
elif [ -f /etc/lsb-release -a -n "`cat /etc/lsb-release 2>/dev/null | grep -F disco`" ]; then | |
echo '*** Found Ubuntu "disco", creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/disco disco main" >/tmp/zt-sources-list | |
elif [ "$dvers" = "6" -o "$dvers" = "squeeze" ]; then | |
echo '*** Found Debian "squeeze" (or similar), creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/squeeze squeeze main" >/tmp/zt-sources-list | |
elif [ "$dvers" = "7" -o "$dvers" = "wheezy" ]; then | |
echo '*** Found Debian "wheezy" (or similar), creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/wheezy wheezy main" >/tmp/zt-sources-list | |
elif [ "$dvers" = "8" -o "$dvers" = "jessie" ]; then | |
echo '*** Found Debian "jessie" (or similar), creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/jessie jessie main" >/tmp/zt-sources-list | |
elif [ "$dvers" = "9" -o "$dvers" = "stretch" ]; then | |
echo '*** Found Debian "stretch" (or similar), creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/stretch stretch main" >/tmp/zt-sources-list | |
elif [ "$dvers" = "10" -o "$dvers" = "11" -o "$dvers" = "sid" -o "$dvers" = "buster" -o "$dvers" = "kali" ]; then | |
echo '*** Found Debian "buster", or "sid" (or similar), creating /etc/apt/sources.list.d/zerotier.list' | |
echo "deb ${ZT_BASE_URL_HTTP}debian/buster buster main" >/tmp/zt-sources-list | |
else | |
echo "*** FAILED: unrecognized or ancient distribution: $dvers" | |
exit 1 | |
fi | |
$SUDO mv -f /tmp/zt-sources-list /etc/apt/sources.list.d/zerotier.list | |
$SUDO chown 0 /etc/apt/sources.list.d/zerotier.list | |
$SUDO chgrp 0 /etc/apt/sources.list.d/zerotier.list | |
$SUDO apt-key add /tmp/zt-gpg-key | |
echo | |
echo '*** Installing zerotier-one package...' | |
# Pre-1.1.6 Debian package did not properly enumerate its files, causing | |
# problems when we try to replace it. So just delete them to force. | |
if [ -d /var/lib/zerotier-one ]; then | |
$SUDO rm -f /etc/init.d/zerotier-one /etc/systemd/system/multi-user.target.wants/zerotier-one.service /var/lib/zerotier-one/zerotier-one /usr/local/bin/zerotier-cli /usr/bin/zerotier-cli /usr/local/bin/zero | |
fi | |
cat /dev/null | $SUDO apt-get update | |
cat /dev/null | $SUDO apt-get install -y zerotier-one | |
elif [ -f /etc/SuSE-release -o -f /etc/suse-release -o -f /etc/SUSE-brand -o -f /etc/SuSE-brand -o -f /etc/suse-brand ]; then | |
echo '*** Found SuSE, adding zypper YUM repo...' | |
cat /dev/null | $SUDO zypper addrepo -t YUM -g ${ZT_BASE_URL_HTTP}redhat/el/7 zerotier | |
cat /dev/null | $SUDO rpm --import /tmp/zt-gpg-key | |
echo | |
echo '*** Installing zeortier-one package...' | |
cat /dev/null | $SUDO zypper install -y zerotier-one | |
elif [ -d /etc/yum.repos.d ]; then | |
baseurl="${ZT_BASE_URL_HTTP}redhat/el/7" | |
if [ -n "`cat /etc/redhat-release 2>/dev/null | grep -i fedora`" ]; then | |
echo "*** Found Fedora, creating /etc/yum.repos.d/zerotier.repo" | |
baseurl="${ZT_BASE_URL_HTTP}redhat/fc/22" | |
elif [ -n "`cat /etc/redhat-release 2>/dev/null | grep -i centos`" -o -n "`cat /etc/redhat-release 2>/dev/null | grep -i enterprise`" ]; then | |
echo "*** Found RHEL/CentOS, creating /etc/yum.repos.d/zerotier.repo" | |
baseurl="${ZT_BASE_URL_HTTP}redhat/el/\$releasever" | |
elif [ -n "`cat /etc/system-release 2>/dev/null | grep -i amazon`" ]; then | |
echo "*** Found Amazon (CentOS/RHEL based), creating /etc/yum.repos.d/zerotier.repo" | |
if [ -n "`cat /etc/system-release 2>/dev/null | grep -F 'Amazon Linux 2'`" ]; then | |
baseurl="${ZT_BASE_URL_HTTP}redhat/el/7" | |
else | |
baseurl="${ZT_BASE_URL_HTTP}redhat/amzn1/2016.03" | |
fi | |
else | |
echo "*** Found unknown yum-based repo, using el/7, creating /etc/yum.repos.d/zerotier.repo" | |
fi | |
$SUDO rpm --import /tmp/zt-gpg-key | |
$SUDO rm -f /tmp/zerotier.repo | |
echo '[zerotier]' >/tmp/zerotier.repo | |
echo 'name=ZeroTier, Inc. RPM Release Repository' >>/tmp/zerotier.repo | |
echo "baseurl=$baseurl" >>/tmp/zerotier.repo | |
echo 'enabled=1' >>/tmp/zerotier.repo | |
echo 'gpgcheck=1' >>/tmp/zerotier.repo | |
$SUDO mv -f /tmp/zerotier.repo /etc/yum.repos.d/zerotier.repo | |
$SUDO chown 0 /etc/yum.repos.d/zerotier.repo | |
$SUDO chgrp 0 /etc/yum.repos.d/zerotier.repo | |
echo | |
echo '*** Installing zerotier-one package...' | |
if [ -e /usr/bin/dnf ]; then | |
cat /dev/null | $SUDO dnf install -y zerotier-one | |
else | |
cat /dev/null | $SUDO yum install -y zerotier-one | |
fi | |
fi | |
$SUDO rm -f /tmp/zt-gpg-key | |
if [ ! -e /usr/sbin/zerotier-one ]; then | |
echo | |
echo '*** Package installation failed! Unfortunately there may not be a package' | |
echo '*** for your architecture or distribution. For the source go to:' | |
echo '*** https://github.com/zerotier/ZeroTierOne' | |
echo | |
exit 1 | |
fi | |
echo | |
echo '*** Enabling and starting zerotier-one service...' | |
if [ -e /usr/bin/systemctl -o -e /usr/sbin/systemctl -o -e /sbin/systemctl -o -e /bin/systemctl ]; then | |
$SUDO systemctl enable zerotier-one | |
$SUDO systemctl start zerotier-one | |
if [ "$?" != "0" ]; then | |
echo | |
echo '*** Package installed but cannot start service! You may be in a Docker' | |
echo '*** container or using a non-standard init service.' | |
echo | |
exit 1 | |
fi | |
else | |
if [ -e /sbin/update-rc.d -o -e /usr/sbin/update-rc.d -o -e /bin/update-rc.d -o -e /usr/bin/update-rc.d ]; then | |
$SUDO update-rc.d zerotier-one defaults | |
else | |
$SUDO chkconfig zerotier-one on | |
fi | |
$SUDO /etc/init.d/zerotier-one start | |
fi | |
echo | |
echo '*** Waiting for identity generation...' | |
while [ ! -f /var/lib/zerotier-one/identity.secret ]; do | |
sleep 1 | |
done | |
echo | |
echo "*** Success! You are ZeroTier address [ `cat /var/lib/zerotier-one/identity.public | cut -d : -f 1` ]." | |
echo | |
exit 0 | |
-----BEGIN PGP SIGNATURE----- | |
iQJJBAEBCAAzFiEEdKXpxFjhpDHx2lenFlcZiCPlKmEFAl1B1RUVHGNvbnRhY3RA | |
emVyb3RpZXIuY29tAAoJEBZXGYgj5SphoJEQAIduYbRoNdNZH5dPgHsyQtipcJnM | |
A1X7Vic7cg4Hiyk+Mgdz3iAwROtgHvS9Yl4lL1yDDkOXursjETtkM4f04rn8Db8d | |
SDH2ebE18o3n6UpZ+5kh9fcJyQiHxk+9Fc50FTnvhpGS5SGS0vGxgMDFloEnsT8M | |
RLJYZs0BsKcQihCA3fnotv1qYw2JCntzcpX+iss/zQeGW2ejDAQJXq3CJm0zXHXi | |
3ed8CslMy4XQMhTLmusDtQiE7Hp5Ccw1ZkaMOVqp49c4mF/75IHFa7k9aZ43msTj | |
pX5JYdd6U4HvGjyWRpSd+UMkf8OdH2wcfTwbe94x+vc8MTJ5vOrardZWu40bsc1r | |
mT6aZPTWXpNxY25Ep5Ntd67XZcs3dtmXBanpmeSPTIFt9sidyDgNj/MBWYCszaEo | |
T94kX961/DNS003fnvGOkwfT7nCZo/mZ6kpBlyzN/X39DuDyYa9XMuN+LPJybMhA | |
EGfxhxb+0qOmBBdL6dCJwXHlX9TbQPzPmwEAvtbX1JOyLCA91IlELAB3MKOuD3ME | |
NZnxGiTPTxwZwam+G1Br7eyOjLL7pYT7Lkx2kuVfk8uuR9nBW20rd05GrpPf+96d | |
+EfdOOy4npqPErP9AilhzLn/lYkUagD25Ad9yD3iLEtXkIHrYHcWeBgwCYKmlPF4 | |
4Tb6ZDQHeT+bW7hM | |
=OeC/ | |
-----END PGP SIGNATURE----- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment