Back to Blog
HermesTailscaleSelf-HostingNetworking

Hermes Agent + Tailscale: Secure Remote Access

Reach a self-hosted Hermes Agent from anywhere without opening ports. Install Tailscale on the host and your devices, then hit port 8642 over the tailnet.

By Hermify Team||7 min read
A private mesh of glowing green nodes over a dark map, evoking a Tailscale tailnet linking a Hermes Agent host to a phone and laptop

Stop exposing port 8642 to the public internet

The moment a self-hosted Hermes Agent leaves your laptop and lands on a VPS, you have a decision to make. The gateway listens on port 8642, and the natural instinct is to open that port on the host firewall so your phone, your desktop, or the Hermes Desktop app can reach it from anywhere. It works, and it is exactly the wrong shape for a process that holds your provider keys, reads your inbox, and executes shell commands on the host.

A better shape is a WireGuard mesh. Install Tailscale on the Hermes host and on every device you chat from, sign both sides into the same tailnet, and reach the gateway at http://<hostname>:8642 from any of those devices with zero inbound firewall rules on the VPS. Nothing on port 8642 is reachable from the public internet. The agent is only visible to machines you have explicitly logged into your tailnet. This is the setup we recommend to every self-hoster who plans to run Hermes off their local network.

What Tailscale actually is

Tailscale is a mesh VPN built on top of WireGuard. Instead of the classic hub-and-spoke VPN where all traffic funnels through a central concentrator, Tailscale sets up encrypted point-to-point tunnels between the devices in your tailnet, using a coordination server only to help peers find each other. When two devices can talk directly, they do. When they cannot because both are behind restrictive NATs, packets fall back to encrypted DERP relays that never see the plaintext.

For a Hermes deployment the practical consequences are:

  • No inbound firewall rules on the host. The gateway keeps listening on 0.0.0.0:8642 inside the VPS, but the host firewall never accepts a public connection on that port. Tailscale binds to the tailscale0 interface, which is not exposed to the internet.
  • Stable device names via MagicDNS. Your Hermes host becomes reachable as http://hermes-vps:8642 from any tailnet peer, regardless of the underlying VPS IP.
  • No key management. Each device is authenticated through your SSO provider (Google, GitHub, Okta, Apple, or an OIDC endpoint). Adding a new phone or removing a stolen one is a two-click operation in the Tailscale admin console.
  • Free for personal use. The Personal plan covers up to 6 users and unlimited devices at no cost, which comfortably fits a single-operator Hermes deployment plus a handful of clients.

If you have not yet decided whether to run the agent yourself at all, read self-hosting vs managed Hermes Agent first. The rest of this post assumes you have a Docker-based Hermes Agent already running on a VPS (the recipe is in the Hermes Agent Docker guide) and you now want to reach it safely from the outside.

Prerequisites

You need:

  • A VPS or homelab box running Hermes Agent, ideally in Docker, with the gateway bound to 0.0.0.0:8642 inside the container.
  • A free Tailscale account (personal plan is fine).
  • SSH access to the host, and admin access to whichever phone or laptop you want to chat from.
  • The public host firewall configured to deny inbound port 8642. If you previously opened it during setup, close it before continuing. This is the whole point of the exercise.

Step 1 - Install Tailscale on the Hermes host

The one-line installer works on every mainstream Linux distribution:

curl -fsSL https://tailscale.com/install.sh | sh

The script detects your distribution, adds the Tailscale package repository, and installs the tailscale and tailscaled binaries. On Debian, Ubuntu, Fedora, Arch, and Alpine it will pick the right package manager automatically. On macOS the equivalent is brew install tailscale; on Windows, download the installer from the Tailscale website.

Then bring the daemon up and log in:

sudo systemctl enable --now tailscaled
sudo tailscale up --ssh

The --ssh flag additionally enables Tailscale SSH, which lets you SSH into the host over the tailnet using your SSO identity instead of a static keypair. If you already have a working SSH setup you can drop this flag; it is an optional and reversible upgrade.

tailscale up prints a one-time login URL. Open it in a browser, authenticate with your identity provider, and the host joins your tailnet. Grab its tailnet IP and MagicDNS name:

tailscale ip -4
tailscale status

You will see something like 100.64.1.5 and hermes-vps.tailnet-name.ts.net. Both work as targets for the gateway.

Step 2 - Install Tailscale on your phone and laptop

Install the Tailscale app on each device you want to chat from:

  • iOS / Android: install the Tailscale app from the App Store or Play Store, open it, and sign in with the same identity you used on the host.
  • macOS / Windows / Linux desktop: download the installer from tailscale.com/download and sign in.

Once signed in, every device is a peer on the same tailnet. From the phone's browser, hit http://hermes-vps:8642/health and you should get the standard health JSON. From a laptop on a different Wi-Fi, the same URL still works. No ports were opened anywhere on the VPS.

Step 3 - Point the Hermes Desktop app at the remote gateway

If you use the Hermes Desktop app, set its gateway URL to the tailnet address of the host. In the app settings, replace the default http://localhost:8642 with:

http://hermes-vps:8642

For the desktop's WebSocket tunnel, use the same hostname with the --tui websocket endpoint. Pin a HERMES_DASHBOARD_SESSION_TOKEN in the container's .env so the desktop authenticates cleanly against a stable token instead of a freshly rotated one. The rest of the app is transport-agnostic; from its point of view the gateway is on localhost, and Tailscale handles the routing.

Once the desktop app is talking to the remote gateway, all the usual Hermes surfaces (voice mode, skills, MCP tools, scheduled tasks) work exactly as they do on a local install. See Hermes Agent voice mode for what voice looks like on the same setup.

Optional: Tailscale Funnel for public HTTPS

Every so often you actually want a webhook target reachable from the public internet: a Stripe webhook, a Discord slash-command endpoint, a Telegram webhook if you are not using long polling. Tailscale Funnel is the escape hatch. It exposes a chosen local port on the tailnet as a public HTTPS endpoint on https://hermes-vps.tailnet-name.ts.net, with Tailscale provisioning a valid Let's Encrypt certificate for you.

Enable it on the host:

sudo tailscale funnel 8642

Funnel is off by default and per-service, so you can open one narrow endpoint without unlocking the whole gateway. If you never need a public HTTPS URL, skip this step and keep the agent entirely inside the tailnet. Details are in the Tailscale Funnel docs.

Tailscale vs Cloudflare Tunnel vs raw firewall and reverse proxy

Three ways to reach a self-hosted Hermes Agent from the outside, ranked by how much you have to think about:

Approach Public exposure Setup effort Best fit
Tailscale mesh None Low You control every device you chat from
Cloudflare Tunnel Yes, with auth Medium You need to share the agent with external users
Firewall + reverse proxy + auth Yes High You want the classic Nginx-in-front-of-everything setup

Cloudflare Tunnel is a reasonable middle ground when your audience is not just your own devices, but it exposes the endpoint to the entire internet and leans on Cloudflare Access for authentication. Raw firewall plus reverse proxy works, but you own the full stack: TLS, rate limits, auth middleware, log review. Tailscale is the shortest path to a genuinely private agent. Hardening advice for either of the more exposed options lives in the Hermes Agent security guide.

The managed alternative

Tailscale is the correct answer if you are committed to self-hosting. It is also six moving parts you did not have before: a Tailscale account, a coordination-server dependency, the tailscaled daemon on each host, a policy for adding and removing devices, MagicDNS names to remember, and a device inventory to audit. That is worth it for a homelab or a curious weekend, less obvious when you just want a personal agent that answers your messages.

If the goal is "an agent I can chat with on Telegram from anywhere" and not "operate a private WireGuard mesh", the managed path is a straight shortcut. Get started with Hermify and your Hermes Agent is live as a Telegram contact in about a minute, with memory that stays yours, no ports to open, and no tailnet to babysit. The device you chat from is your existing Telegram client, no VPN configuration required.

Sources

Run Your Own Hermes Agent

Bring your API key, connect Telegram, and get a self-improving AI agent live in 60 seconds.

Get Started