-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailscale-pi-auto-install.bash
67 lines (38 loc) · 1.39 KB
/
tailscale-pi-auto-install.bash
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# variables
replaceText="USERNAME"
currentUser=$USER
## credentials
## define console colours
RED='\033[0;31m' # red
WHITE='\033[1;37m' # white
## define formatting
UNDERLINE='\033[4m'
RESETUNDERLINE='\033[24m'
# install Tailscale
## Perform apt update and upgrade
printf "\nPerforming update and upgrade"
sudo apt-get update && sudo apt-get upgrade -y
## install packages
printf "\nInstalling Packages"
sudo apt-get install apt-transport-https -y
curl -fsSL https://pkgs.tailscale.com/stable/raspbian/buster.gpg | sudo apt-key add -
curl -fsSL https://pkgs.tailscale.com/stable/raspbian/buster.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt-get update -y
## install Tailscale
printf "\nInstalling Tailscale"
sudo apt-get install tailscale -y
## configure forwarding
printf "\nConfigure Forwarding"
echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
sudo sysctl -p /etc/sysctl.d/99-tailscale.conf
## start Tailscale
printf "\nStarting Tailscale. Use the URL to authenticate..."
sudo tailscale up --advertise-routes=$1
printf "\nRemember to disable the key expiry in the portal - https://login.tailscale.com/"
printf "\nRemember to enable the advertised routes/subnets in the portal"
sleep 5
# reboot the device
printf "\n\n Rebooting now..."
#sudo reboot