mirror of
https://github.com/Fluent-networks/tailscale-mikrotik.git
synced 2025-06-23 01:08:56 +02:00
29 lines
536 B
Bash
Executable file
29 lines
536 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Prepare run dir
|
|
if [ ! -d "/var/run/sshd" ]; then
|
|
mkdir -p /var/run/sshd
|
|
fi
|
|
|
|
set -m
|
|
|
|
# Install routes
|
|
IFS=',' read -ra SUBNETS <<< "${ADVERTISE_ROUTES}"
|
|
for s in "${SUBNETS[@]}"; do
|
|
ip route add "$s" via "${CONTAINER_GATEWAY}"
|
|
done
|
|
|
|
# Start tailscaled and bring tailscale up
|
|
/usr/local/bin/tailscaled --tun=userspace-networking &
|
|
until /usr/local/bin/tailscale up \
|
|
--authkey=${AUTH_KEY} \
|
|
--advertise-routes="${ADVERTISE_ROUTES}"
|
|
do
|
|
sleep 0.1
|
|
done
|
|
echo Tailscale started
|
|
|
|
# Start SSH
|
|
/usr/sbin/sshd -D
|
|
|
|
fg %1
|