Post

Installing Tailscale on a Wifi Pineapple

I went to install Tailscale on a Wifi Pineapple, and the normal pipe to bash (lol) script didn’t work. I had to do it manually like this. YMMV - attempt at your own risk. I’m unsure how this affects other WiFi Pineapple services and features, since I haven’t played with that stuff post-Tailscale install.

Download and install Tailscale.

1
2
3
4
5
6
7
8
9
10
11
12
cd /tmp
wget https://pkgs.tailscale.com/stable/tailscale_1.82.0_mipsle.tgz
tar xzf tailscale_1.82.0_mipsle.tgz
cd tailscale_1.82.0_mipsle

cp tailscale tailscaled /usr/bin/

opkg update
opkg install kmod-tun

rm -rf tailscale_1.82.0_mipsle*

1
chmod +x /usr/bin/tailscale /usr/bin/tailscaled

Create an init.d script to auto-start Tailscale at boot at /etc/init.d/tailscale

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh /etc/rc.common

START=99
STOP=10

USE_PROCD=1

start_service() {
    procd_open_instance
    procd_set_param command /usr/bin/tailscaled
    procd_set_param respawn
    procd_set_param stdout 1
    procd_set_param stderr 1
    procd_close_instance
}
1
2
chmod +x /etc/init.d/tailscale
/etc/init.d/tailscale enable

Then create /etc/tailscale-up.sh and put in your reusable auth key you created at Tailscale website.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

TRIES=0
MAX_TRIES=20

# Wait for tailscaled to create the socket and respond
while [ "$TRIES" -lt "$MAX_TRIES" ]; do
    if tailscale status >/dev/null 2>&1; then
        echo "tailscaled is ready!"
        break
    fi

    echo "Waiting for tailscaled... ($TRIES)"
    sleep 2
    TRIES=$((TRIES + 1))
done

# Try bringing it up if still logged out
if tailscale status 2>/dev/null | grep -q "Logged out"; then
    echo "Bringing up Tailscale..."
    tailscale up --authkey "{putYourTailscaleKeyHere}"
else
    echo "Already logged in or connected!"
fi

Then:

1
chmod +x /etc/tailscale-up.sh

Then edit /etc/rc.local to add the tailscale stuff after bash /etc/pineapple.rc.

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

# Run Pineapple-specific boot script (optional)
bash /etc/pineapple.rc

# Wait a bit to ensure tailscaled is fully up
sleep 30

# Run Tailscale connection script in background and log to file
echo "$(date): running tailscale-up.sh" >> /tmp/tailscale.log
/etc/tailscale-up.sh >> /tmp/tailscale.log 2>&1 &

exit 0
1
chmod +x /etc/rc.local

Now, reboot and it should work and autoconnect. Hopefully…

This post is licensed under CC BY 4.0 by the author.