From 8cdad7d45c6c58f0b93f0ca5b4779e31bd845bb9 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 20 Jun 2023 14:59:01 +0300 Subject: feat(ops): introduce (head|tail)scale server at net.tvl.fyi This runs a headscale server on sanduny which lets users join their machines to the TVL tailscale network. This would theoretically let people communicate with each other on the internal network, but also more notably joined servers can advertise exit node capability so that we can have our own "VPN network", for starters with endpoints in Germany, UK and Russia (whitby, sanduny and koptevo respectively). This setup isn't fully stable yet, notably: * The IP range used by tailscale is just the default one right now, I'm not sure if that should be changed or what. * The system is stateful (on sanduny), but the state is not (yet) backed up anywhere. Use with caution. * Machine joining is a manual process requiring SSH & root access to sanduny. The process is to log in to sanduny, then get a headscale shell with `sudo -u headscale bash`, and to use the `headscale` CLI within there to administrate access. I've opted to create a user account `tvl` for TVL-owned machines, and a personal account for myself and my machines. Change-Id: I4f1be1fe8062a6c2e77203ff72fe8709f4e4dec8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8837 Reviewed-by: sterni Reviewed-by: flokli Tested-by: BuildkiteCI --- ops/machines/sanduny/default.nix | 8 ++++++++ ops/machines/whitby/default.nix | 6 ++++++ 2 files changed, 14 insertions(+) (limited to 'ops/machines') diff --git a/ops/machines/sanduny/default.nix b/ops/machines/sanduny/default.nix index 14f40d1fa09e..ba14fbd32a60 100644 --- a/ops/machines/sanduny/default.nix +++ b/ops/machines/sanduny/default.nix @@ -20,6 +20,7 @@ in (mod "journaldriver.nix") (mod "known-hosts.nix") (mod "tvl-cache.nix") + (mod "tvl-headscale.nix") (mod "tvl-users.nix") (mod "www/inbox.tvl.su.nix") (mod "www/self-redirect.nix") @@ -71,6 +72,13 @@ in services.openssh.enable = true; services.fail2ban.enable = true; + # Run tailscale for the TVL net.tvl.fyi network. + # tailscale up --login-server https://net.tvl.fyi --accept-dns=false --advertise-exit-node + services.tailscale = { + enable = true; + useRoutingFeatures = "server"; # for exit-node usage + }; + # Automatically collect garbage from the Nix store. services.depot.automatic-gc = { enable = true; diff --git a/ops/machines/whitby/default.nix b/ops/machines/whitby/default.nix index f2a459047163..c7874cd2352d 100644 --- a/ops/machines/whitby/default.nix +++ b/ops/machines/whitby/default.nix @@ -624,6 +624,12 @@ in }; }; + # Join TVL Tailscale network at net.tvl.fyi + services.tailscale = { + enable = true; + useRoutingFeatures = "server"; # for exit-node usage + }; + # Allow Keycloak access to the LDAP module by forcing in the JVM # configuration systemd.services.keycloak.environment.PREPEND_JAVA_OPTS = -- cgit 1.4.1