Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Tailscale Documentation #130

Merged
merged 2 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ module.exports = {
]
},
'node/securing-your-node',
'node/tailscale',
'node/starting-rp',
'node/cli-intro',
'node/prepare-node',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
133 changes: 133 additions & 0 deletions src/guides/node/tailscale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Configuring a Tailscale VPN Server

::: tip NOTE
This is **optional.**
You only need to consider this section if you run a node at home and would like to connect to it from outside of your home network.
:::

If you would like to log into your home network remotely, such as while on vacation or on a business trip, the most common route is to use a **Virtual Private Network** server.
This will allow you to connect to your node via SSH **and** monitor your Graphana dashboard from anywhere in the world, all without exposing your SSH port to the internet.

Many Rocket Pool node operators use [Tailscale]((https://tailscale.com/blog/how-tailscale-works/)) as their VPN server of choice for this.
Tailscale is an open source P2P VPN tunnel and hosted endpoint discovery service.
It takes care of authentication, publication, and the NAT traversal required to establish an end-to-end encrypted path between your machine and your node without sending any sensitive traffic to a centralized server.
It is a very powerful tool.

We will briefly cover a basic configuration of it, but feel free to [review their documentation](https://tailscale.com/kb/start/) for more details.


## Setting Tailscale Up

First, create a free [Tailscale account](https://tailscale.com/).
Tailscale requires the use of an SSO identity provider such as Google, GitHub, Okta, Microsoft, etc.
For details, visit [their SSO Page](https://tailscale.com/kb/1013/sso-providers/).

It is recommended that you enable 2FA (Two Factor Authentication) on whichever identity provider you choose for added security.

Next, follow [their onboarding guide](https://tailscale.com/kb/1017/install/) to install Tailscale on your **client** - the machine you want to connect to your network with.
For example, this could be a laptop or your phone.
**Note that it is *not* your Rocket Pool node!**

Once completed you should see your computer as 'connected' on the [Tailscale dashboard](https://login.tailscale.com/admin/machines).

<center>

![](./images/tailscale-dashboard-client.png)

</center>

Now, install Tailscale on your **Rocket Pool node**.
You can find instructions for this on their website; for example, here are the [installation instructions for Ubuntu](https://tailscale.com/kb/1039/install-ubuntu-2004/).

::: warning NOTE
If you have UFW configured, you will also want to follow the [UFW Configuration Instructions](https://tailscale.com/kb/1077/secure-server-ubuntu-18-04/)).
:::

Next, add Tailscale’s package signing key and repository **on your Rocket Pool node**:

```shell
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
```

Now, install Tailscale **on your Rocket Pool node**:

```shell
sudo apt-get update
sudo apt-get install tailscale
```

Finally, authenticate and connect your machine to your Tailscale network **on your Rocket Pool node**:

```shell
sudo tailscale up
```

You’re connected!
You can find your Tailscale IPv4 address by running:

```shell
tailscale ip -4
```

You should now see your node machine added to the on the [Tailscale dashboard](https://login.tailscale.com/admin/machines).
You may also change the name of the **node machine** through the dashboard, e.g. to `rocketnode`.

![](./images/tailscale-dashboard-servers.png)

It is suggested to [disable key expiry](https://tailscale.com/kb/1028/key-expiry) to prevent the need to periodically re-authenticate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specify only to do this for the node


You should now be able to `exit` the SSH session to your node on your client, and SSH into your node again through Tailscale using `ssh your.user@rocketnode`.
Copy link
Contributor

@jshufro jshufro Jul 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this kind of assumes magicdns is enabled, but the guide doesn't say to enable it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with this. I think the guide should be clear about this. Perhaps something like

...
If you would like to access your node using a memorable hostname such as rocketnode, you can do so by enabling MagicDNS in the Tailscale settings.
...


::: warning NOTE
If you modified the SSH port of the **node machine** in `/etc/ssh/sshd_config` when you first configured it, use `ssh your.user@rocketnode -p <your port>` instead.

For example, if you assigned SSH to port 1234, you would do:
```
ssh your.user@rocketnode -p 1234
```
:::

You can now also visit `http://rocketnode:3100`in your web browser to access your Grafana dashboard from your **client**.

If you have UFW configured, you can now add a rule to accept any incoming SSH connections over Tailscale.

::: danger WARNING
The following steps will modify your SSH configuration and firewall rules.
**You must have at least 2 SSH sessions open to your node machine before proceeding - one for modifying the configuration and testing it afterwards, and one that will stay logged in as a backup in case your changes break SSH so you can revert them!
:::

**Run these commands on the node machine.**

```shell
sudo ufw allow in on tailscale0 comment
sudo ufw allow 41641/udp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although the Tailscale UFW article provides this example command, their firewall and ports guides indicate that forwarding 41641/udp is not required unless you're dealing with a problematic NAT environment.

FWIW, I haven't had to forward any ports for Tailscale to just work on the handful of local machines (Linux, Windows) and remote VPS instances that I've used it with.

I think the guide should avoid suggesting that this port be forwarded and instead it could become a support item if people are encountering issues with connectivity.

```

Remove the SSH port added before from the firewall (for example, if you used the default port of 22):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should leave 22 open to lan, otherwise tailscale becomes a single point of failure


```shell
sudo ufw delete "22/tcp" comment 'Allow SSH'
```

Once you’ve set up firewall rules to restrict all non-Tailscale connections, restart UFW and SSH:

```shell
sudo ufw reload
sudo service ssh restart
```

Now, confirm that everything is working as expected.
`exit` from one of your current SSH sessions (**but remember to keep the second one open as a backup**).

Next, connect to the **node machine** via SSH using the Tailscale IP address:

```shell
ssh your.user@rocketnode
```

If it works, you did everything right and can now safely log into your home network while abroad!

::: tip TIP
If you've previously port forwarded your node's SSH port in your router, you can now remove it.
:::