outpost: a self-hosted IPv6 and subdomain tunnel

A plan for one small server that gives each user public IPv6 addresses and public subdomains. The addresses and subdomains reach the user's own machine through an encrypted tunnel. One dashboard manages all of it.

Status: plan. The network behaviour in section 2 was tested on the real server. All other parts are proposed and are not built yet. Addresses and domain names on this page are example values.

1. The problem

A laptop or a home server usually has no public address. Other people on the internet cannot connect to it. Tools such as ngrok solve part of this problem, but they only forward web traffic, and they run on someone else's servers.

We have one cloud server. The provider gives it a small block of 16 public IPv6 addresses and routes all 16 to the server. We also control a domain, and every name under *.box.example.com points to the server.

The goal is to share these resources with a small group of invited users:

2. What we tested tested

The IPv6 feature depends on one fact: the provider must route the whole block to the server, and it must keep each packet's destination address. We tested this before we made the plan.

Result: the server can see which of the 16 addresses a client used. So it can forward traffic for each address to a different user.

3. Terms

WireGuard
An encrypted network tunnel. It carries whole IP packets over UDP. Linux runs it inside the kernel, so it uses little CPU.
Agent
The outpostd program on a user's machine. It keeps the tunnel up and applies the settings from the dashboard.
Device
One machine with an agent. A user can have more than one device.
Tunnel address
A private IPv6 address that each device gets inside the tunnel. The server uses it to reach the device.
Zone
A base domain, for example box.example.com. Users choose one name under a zone.
Mapping
A rule that connects one hostname to one service on one device.
SNI
Server Name Indication. The hostname that a browser sends in plain text at the start of a TLS connection.
PROXY protocol
A short header in front of a forwarded TCP connection. It tells the receiver the real address of the client.
DNS-01
A way to prove to a certificate authority that you control a domain. You publish a TXT record under _acme-challenge.

4. Main decisions

QuestionDecisionReason
TransportWireGuard, one tunnel per deviceThe IPv6 feature must carry whole IP packets. WireGuard does this natively. Its overhead is about 60 bytes per packet, and the server runs it in the kernel.
Where settings liveOnly in the dashboardOne source of truth. The agent has no local settings and no commands that change settings.
TLSA wildcard certificate on the server, from DNS-01One certificate covers all user names in a zone. The server can apply headers and redirects.
End-to-end encryptionOptional, with direct mode for each mappingSome users need the server to see only encrypted bytes.
Server and dashboardOne Go program with SQLite. The Vue dashboard is built into it.Easy to deploy: one file and one service.
Sign-inAn admin sends an invite link. The user sets a password.No external services are necessary.

Transport options that we compared

OptionOverhead per packetCarries IP packetsResult
WireGuard60 bytes (IPv4 outside), 80 bytes (IPv6 outside)YesChosen. Lowest server CPU.
QUIC with datagrams (MASQUE, RFC 9484)About 45–60 bytesYes, but complexGood on networks that block UDP. It uses more server CPU. It is the best choice if we must replace WireGuard.
Streams over TCP (yamux, smux)SmallBadly: TCP inside TCP stalls when packets are lostGood for web traffic only.
6in4, GRE20–40 bytesYesNo encryption. Does not pass NAT. Not good for laptops.

5. How the parts fit

There are three parts. The dashboard stores the settings. The server receives traffic from the internet. The agent on each device receives traffic from the server through the tunnel.

outpost architecture Internet traffic on ports 443 and 80, and traffic to user IPv6 addresses, arrives at the outpost server. The server sends it through a WireGuard tunnel to the agent on the user's device. The agent forwards web traffic to a local service. The dashboard in the server pushes settings to the agent, and the agent reports status back. Internet HTTPS :443 HTTP :80 IPv6 to a user address outpost Dashboard + API settings in SQLite Edge :443 / :80 read hostname, pick device wildcard certificate Route per address address → device wg0 (WireGuard, kernel) User device outpostd agent applies settings web listener :7080 direct listener :7443 mounts IPv6 addresses Local service localhost:8080 outpost0 (WireGuard) encrypted UDP settings (push) status
Figure 1. The server receives all public traffic. Every path to a device goes through that device's WireGuard tunnel. Blue lines show settings and status.

Who owns which data

DataFieldsManaged by
Useremail, password hash, role, quotasAdmin
Zonebase domain, DNS provider (Cloudflare, Route53 or manual), credentials, certificate stateAdmin
Devicename, owner, WireGuard public key, tunnel address, last seenUser
IPv6 addressaddress (allocated automatically) → one device. A device can have more than one address. Switch: allow inbound (on by default).User: add, release
Device outgoingnone (default), or one of the device's addressesUser
Mappingname + zone → device; mode; the fields for that modeUser

6. One request, from start to end

Alice maps alice.box.example.com to http://localhost:8080 on her laptop. The mapping uses proxy mode, which is the default. A visitor opens https://alice.box.example.com/.

  1. DNS returns the server address, because *.box.example.com points to the server.
  2. The browser connects to the server on port 443. It sends the name alice.box.example.com as SNI.
  3. The server reads the SNI and finds Alice's mapping. The mapping says: device "laptop", proxy mode.
  4. The server completes TLS with the wildcard certificate for *.box.example.com.
  5. The server opens a connection to the laptop's tunnel address on port 7080. This connection goes through WireGuard, so it is encrypted on the network.
  6. The server sends a PROXY v2 header first. The header holds the visitor's address and the mapping ID. Then it sends the HTTP request with X-Forwarded-For and X-Forwarded-Proto: https.
  7. The agent reads the mapping ID. It applies the host override and extra headers from the mapping. Then it sends the request to localhost:8080.
  8. The response goes back along the same path.

If the laptop is offline, the server shows a "device offline" page with status 502. If the name has no mapping, the server shows a 404 page.

7. Proxy mode and direct mode

Each mapping has a mode. In both modes, the server first reads the hostname. On port 443 it reads the SNI. On port 80 it reads the Host header. The server keeps the bytes that it read and sends them on unchanged. The mode then decides the next step.

Proxy mode compared with direct mode In proxy mode the server decrypts TLS with the wildcard certificate and sends plain HTTP through the tunnel to the agent, which forwards it to the local service. In direct mode the server sends the encrypted bytes through the tunnel unchanged, and the local service decrypts them with its own certificate. Proxy mode (default) Visitor Serverdecrypts TLS (wildcard) Agentheaders, host Service TLS HTTP in wg HTTP Direct mode Visitor Serverreads SNI only Agentoptional PROXY hdr Serviceown certificate TLS TLS in wg TLS Blue: the bytes stay encrypted from the visitor to the service.
Figure 2. In proxy mode the server can see the HTTP request. In direct mode it sees only the hostname.
Proxy (default)Direct
Port 443The server decrypts TLS and forwards HTTP to the agent.The server forwards the raw TCP stream. The service decrypts TLS itself.
Port 80Serve the site, or redirect to HTTPS. The user chooses.Raw forward to an optional HTTP target. If there is no target, redirect to HTTPS.
Visitor addressX-Forwarded-For headerPROXY protocol v1 or v2, if the user turns it on. Otherwise none.
Host override, extra headersYesNo
ProtocolsHTTP/1.1, HTTP/2, WebSocketAny TLS protocol that sends SNI, for example gRPC over TLS
Server sees plain textYesNo

The hop from server to agent is the same in both modes. The server always sends a PROXY v2 header first. The header holds the visitor's address and two custom fields: the mapping ID and the original port. The agent accepts this header only on the tunnel interface. In direct mode, the agent then removes the header. It sends a new PROXY header to the service only when the user turns that option on.

Certificates in direct mode are the user's job. The private key of the wildcard certificate never leaves the server. The service can get its own certificate with ACME. TLS-ALPN-01 works because the server forwards the TLS handshake unchanged. HTTP-01 works when the mapping has an HTTP target.

8. Certificates

Each zone gets one certificate for *.box.example.com and box.example.com. A wildcard certificate needs DNS-01. The certificate authority asks for a TXT record at _acme-challenge.box.example.com. The certificate has two names, so it needs two TXT values on the same name.

Each zone uses one of three DNS providers:

Certificate issue steps The steps are: ordering, awaiting DNS, validating, finalizing, issued. In manual mode, the step awaiting DNS waits until the admin clicks Proceed. Any step can go to an error state, and the admin can try again from there. ordering awaiting DNS validating finalizing issued manual: wait for "Proceed" automatic: write TXT by API check TXT on public DNS new key, send CSR Any step can fail. The dashboard shows the error, and the admin can try again.
Figure 3. The server saves the state after each step, so a restart does not lose a pending order.

Cloudflare: the box and *.box records must be "DNS only". If Cloudflare proxies them, it decrypts TLS itself, and direct mode stops working. The zone check warns about this.

9. IPv6 on the user's machine

Add and release

An address is always on one device, and it stays on that device. There is no reserved address without a device, and no move between devices. To use an address on another device, release it and add a new one there.

The server sends each address into the tunnel of its device. The WireGuard peer for a device allows two kinds of address: the device's tunnel address, and each public address of the device. The server adds one route for each address.

Release is immediate. On release, the server removes the address from the device's peer and deletes its route. WireGuard drops a packet from a peer if the source address is not allowed for that peer. So the device cannot use the address after the release, even when it is offline and still has the address. Its agent removes the address at the next connection. If the address was the device's outgoing address, that setting goes back to None.

On the device

For each of its addresses, the agent does three things:

Stopping outpost on the device

Any person with admin rights on the device can stop outpost without the dashboard:

The dashboard then shows the device as Paused on device, not Offline. Changes from the dashboard wait until the device is up again.

The block has 16 addresses. The server uses one, so 15 are free for users. Addresses count against the owner's quota. The data model allows more address pools later.

10. Adding a device

  1. In the dashboard, the user clicks Add device and types a name.
  2. The dashboard shows an install command with a one-time token. The token is valid for 15 minutes.
    curl -fsSL https://box.example.com/install.sh | sudo sh -s -- <token>
  3. The agent installs itself as a system service. It makes a WireGuard key pair on the machine. The private key never leaves the machine.
  4. The agent sends the token and the public key to the server. The server returns a long-term device credential and the tunnel settings. The token is now used and no longer works.
  5. The dialog in the dashboard changes to "Connected" as soon as the agent enrolls.

After this, the server pushes the full settings to the agent through a server-sent events stream whenever something changes. The agent compares the settings with the real state of the machine, and it fixes any difference. Every 30 seconds it reports its status: which settings version it applied, and any error. The dashboard shows the device as Offline when no report arrives for 90 seconds. There is no health check for each mapping. If a target is down, visitors get the server's 502 page.

The agent has six commands: outpostd setup <token>, outpostd status, outpostd logs, outpostd down, outpostd up and outpostd uninstall. None of them change settings; settings come only from the dashboard. When an admin or user revokes a device, the server removes its tunnel peer at once. It releases the device's addresses and deletes its mappings.

11. Traffic and device health

Users want to see how much traffic goes through each device, each address and each mapping. They also want to see if a device is up. This section explains what the server counts, where it keeps the numbers, and what the dashboard shows.

What the server counts

All counting happens on the server. The agent counts nothing, so it stays small. The direction is always from the device's side: ↓ to device and ↑ from device.

SeriesSourceValues
Device totalThe byte counters that WireGuard keeps for each peer (read with wgctrl)↓ bytes, ↑ bytes
IPv6 addressKernel nftables counters, one for each address and direction↓ bytes, ↑ bytes
Mapping, proxy modeA counter around each connection in the server edge↓ bytes, ↑ bytes, requests, 2xx, 3xx, 4xx, 5xx
Mapping, direct modeThe copy loop in the server edge. It adds to the counter while it copies, so long connections show a live rate.↓ bytes, ↑ bytes

Every 10 seconds, the server reads all counters. It uses the difference from the last reading to calculate the live rate, and it sends that rate to open dashboards. It does not store the 10-second values. Every minute, it stores one point for each series.

Where the numbers go

We compared three stores for the one-minute points. SQLite works, but deleting old rows every day leaves empty space that needs a vacuum. A single JSON log with no memory copy must be read and parsed for every chart. Memory for recent data plus hourly JSON files for older data gives fast charts, very few writes and easy deletion.

Memory limits

Device health

The dashboard shows health for devices only. It does not check each mapping.

Delete and release

We keep these actions simple. There is no "keep reserved" choice.

12. Dashboard

The dashboard is a Vue 3 app with TypeScript and the frappe-ui component library. It is built into the Go server. It runs on the zone's own name, box.example.com, which the certificate already covers.

PageWhat it does
Home (Devices)A card for each device: name, state (Online or Offline), a 12-hour sparkline and the 12-hour ↓ and ↑ totals. A dashed card adds a device. An alert shows the next setup step for a new user. A strip shows only real problems. Search (⌘K). Top traffic in the last 24 hours.
Device pageThe name, the state and a ⋯ menu are in the top bar. The menu has Disable or Enable. Admins also get Rename, Get command and Delete device. There is no Settings tab.
Device: Traffic tabA 1 h / 6 h / 24 h switch. A rate chart for the device total, a 24-hour status strip, and a small chart for each address and each mapping. Totals for the range.
Device: Addresses tabA list: address, status (Applied, Applying or Error), default, ↓ and ↑. A click on an address copies it. The ⋯ menu has Set as default or Remove default, and Release. Add address asks for a confirmation. Each address allows traffic in both directions.
Device: Mappings tabA list: name, target, ↓ and ↑. A click on a name copies it. The ⋯ menu has Edit and Delete. The form is a dialog: name and zone, Tunnelling mode (TLS termination at edge, or TLS passthrough), target, headers and a Redirect HTTP to HTTPS switch. To stop a mapping, delete it.
AccountName and email with Change password on the same line. The signed-in browsers, each with Sign out in its ⋯ menu.
Admin: usersA list of users (role, IPv6 and mapping quotas) with Edit, Disable and Delete in the ⋯ menu. Open invites, with Copy link and Delete. There is no device limit.
Admin: all devicesOne list of all devices: owner, state, ↓ and ↑ totals for 24 hours, this month or all time, and agent version. Search, owner, state and sort filters, and a total row.
Admin: zonesA list of zones. The zone page shows the certificate end date, an alert when a renewal needs action, and a list of DNS records. DNS provider and the renewal steps open in dialogs.
Admin: activityWho changed what, and when.

13. Screen layouts built

These screenshots show the dashboard as it is built. They use the demo data, so all names and addresses are example data. The dashboard uses frappe-ui 1.0 components: a sidebar, lists, tabs, dialogs, badges and form controls.

The dashboard is device-first. Addresses and mappings are tabs on each device page. Only admins get the sidebar. Other users get a top bar with the logo and a user menu. An action on a list row is in the row's ⋯ menu.

13.1 Home

The home page. Two device cards with a sparkline and 12-hour totals, a dashed Add device card, and the top traffic list.
Figure 4. Home: one card for each device, then the top traffic in the last 24 hours.

13.2 Device page: Traffic tab

The Traffic tab. A range switch, a large rate chart, a 24-hour status strip and small charts for each address and mapping.
Figure 5. Traffic: the device total, the status strip, and one chart for each address and mapping.

13.3 Device page: Addresses tab

The Addresses tab. A list of two IPv6 addresses with status, default, rates and a row menu.
Figure 6. Addresses: a click on an address copies it. The ⋯ menu sets or removes the default, or releases the address.

13.4 Device page: Mappings tab

The Add mapping dialog over the Mappings tab, with name, zone, tunnelling mode, target, host header and a redirect switch.
Figure 7. The mapping form is a dialog. The tunnelling mode is TLS termination at edge or TLS passthrough.

13.5 Admin: All devices

The All devices list with range, search and filters, and a total row.
Figure 8. All devices: one list with filters and a total row. A row opens the device page.

13.6 Admin: Users

The Users list with roles, quotas and row menus, and the open invites.
Figure 9. Users and invites. Edit, Disable and Delete are in the row menu.

13.7 Zone page

The zone page. An alert says the renewal waits for DNS records. The certificate end date, and a list of DNS records.
Figure 10. The zone page shows only what needs attention, the certificate end date and the DNS records.
The renewal dialog with the step, the two TXT records, Check DNS and Proceed.
Figure 11. The renewal dialog. For manual DNS it shows the two TXT records. Proceed is available when both are found.

13.8 On a phone

The home page on a phone, with device cards in one column. The Addresses tab on a phone: address, status, default and the row menu.

On a phone, the cards are in one column, and the lists show fewer columns. The rates move to the Traffic tab.

14. Build order in progress

Each milestone depends on the one before it. The last column shows the status on 28 September 2026.

#MilestoneContentsStatus
1Core and devicesServer, database, invites and passwords, device cards, enrollment, WireGuard manager, settings push, outpostd status. Metrics: sampler, memory buffer, hourly files, device totals and health.Built. Checked in isolated network namespaces.
2Zones and TLSZone page, encrypted credentials, certificate state machine. Manual, Cloudflare and Route53 providers. Renewal. Dashboard over TLS.Built. Checked against Pebble. Let's Encrypt staging and production are not done yet.
3MappingsMappings tab and form. TLS termination at edge and TLS passthrough, SNI reading, PROXY headers, byte counters.Built. Checked through a real WireGuard tunnel.
4IPv6Automatic allocation, add and release, the default outgoing address, counters and cleanup. The Addresses tab.Built. The public test on the server is not done yet.
5HardeningActivity log, quotas, metrics and retention are built. WireGuard over WebSocket, macOS and Windows support, and long load checks are not done yet.In progress.
outpost/
  cmd/outpostd/        device agent: setup, status, logs, down, up, uninstall
  cmd/outpost/         server: API, dashboard, edge, WireGuard, certificates
  internal/api/        shared types: Enroll, DeviceConfig, DeviceStatus
  internal/server/     http, auth, store, alloc, wgmgr, push, firewall, edge, acme, dnsprov, secrets
  internal/agent/      enroll, reconcile, tunnel, netcfg, edge, status, ctl
  web/                 Vue dashboard, built into the server binary
  deploy/              systemd unit, nftables template, install.sh

15. How we check success

Unit tests

Traffic and health tests

Integration tests

Two Linux network namespaces, one for the server and one for a device, with a real WireGuard link between them. Create a mapping through the API. Check that the agent applies it, and that curl --resolve gets the service's reply. Switch the mapping to direct mode. Check that openssl s_client shows the device's certificate, not the wildcard. With PROXY protocol on, check that nginx logs the real client address.

End-to-end on the real server

16. Limits and risks open

Sources