forked from MonolithProjects/docker-tailscale-up
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailscale.sh
executable file
·91 lines (72 loc) · 2.78 KB
/
tailscale.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh
tailscale_cmd='tailscale up'
if [[ -n "${ACCEPT_DNS}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: ACCEPT_DNS enabled"
tailscale_cmd="${tailscale_cmd} --accept-dns"
fi
if [[ -n "${ACCEPT_ROUTES}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: ACCEPT_ROUTES enabled"
tailscale_cmd="${tailscale_cmd} --accept-routes"
fi
if [[ -n "${ADVERTISE_EXIT_NODE}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: ADVERTISE_EXIT_NODE enabled"
tailscale_cmd="${tailscale_cmd} --advertise-exit-node"
fi
if [[ -n "${ADVERTISE_ROUTES}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: ADVERTISE_ROUTES provided"
tailscale_cmd="${tailscale_cmd} --advertise-routes=${ADVERTISE_ROUTES}"
fi
if [[ -n "${ADVERTISE_TAGS}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: ADVERTISE_TAGS provided"
tailscale_cmd="${tailscale_cmd} --advertise-tags=${ADVERTISE_TAGS}"
fi
if [[ -n "${AUTHKEY}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: AUTHKEY provided"
tailscale_cmd="${tailscale_cmd} --authkey=${AUTHKEY}"
fi
if [[ -n "${CUSTOM_HOSTNAME}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: CUSTOM_HOSTNAME $CUSTOM_HOSTNAME provided"
tailscale_cmd="${tailscale_cmd} --hostname=${CUSTOM_HOSTNAME}"
fi
if [[ -n "${EXIT_NODE}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: EXIT_NODE enabled"
tailscale_cmd="${tailscale_cmd} --exit-node=${EXIT_NODE}"
fi
if [[ -n "${EXIT_NODE_ALLOW_LAN_ACCESS}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: EXIT_NODE_ALLOW_LAN_ACCESS enabled"
tailscale_cmd="${tailscale_cmd} --exit-node-allow-lan-access"
fi
if [[ -n "${FORCE_REAUTH}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: FORCE_REAUTH enabled"
tailscale_cmd="${tailscale_cmd} --force-reauth"
fi
if [[ -n "${HOST_ROUTES}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: HOST_ROUTES enabled"
tailscale_cmd="${tailscale_cmd} --host-routes"
fi
if [[ -n "${NETFILTER_MODE}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: NETFILTER_MODE provided"
tailscale_cmd="${tailscale_cmd} --netfilter-mode=${NETFILTER_MODE}"
fi
if [[ -n "${OPERATOR}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: OPERATOR $OPERATOR provided"
tailscale_cmd="${tailscale_cmd} --operator=${OPERATOR}"
fi
if [[ -n "${QR}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: QR enabled"
tailscale_cmd="${tailscale_cmd} --qr"
fi
if [[ -n "${RESET}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: RESET enabled"
tailscale_cmd="${tailscale_cmd} --reset"
fi
if [[ -n "${SHIELDS_UP}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: SHIELDS_UP enabled"
tailscale_cmd="${tailscale_cmd} --shields-up"
fi
if [[ -n "${SNAT_SUBNET_ROUTES}" ]]; then
echo $(date +"%Y/%m/%d %T") "Tailscale: SNAT_SUBNET_ROUTES enabled"
tailscale_cmd="${tailscale_cmd} --snat-subnet-routes"
fi
eval ${tailscale_cmd} 2>&1 &
tailscaled