# domicile

> Give your VPS agents a home-network exit. domicile sends the domains you choose through your own residential connection and checks what sites see on the other end. Free and open source (Apache-2.0), Linux and macOS.

Source: https://github.com/avinash-1707/domicile · Site: https://domicile.avnsh.me · Index for agents: https://domicile.avnsh.me/llms.txt

## Why

Agents that run around the clock on a VPS browse from a datacenter IP. Many sites score the IP's network before they look at the browser, so a script that works on your laptop gets CAPTCHAs, 403s or refused logins from the VPS. Patching the browser fingerprint does not help when the decision is made at the network layer.

domicile lets the agent use a connection you already have. A small agent on a device at home (a Raspberry Pi, an old laptop, a machine at a relative's place, with their consent) dials out to your VPS. A proxy on the VPS sends only the domains you choose through that device. Everything else, including LLM API calls, git and SSH, goes out directly as before.

```
agent browser → domicile on the VPS → rule matches? → tunnel → your home device → site
                                    → no match      → direct from the VPS
```

## How it works

The home agent opens a QUIC connection to the VPS and pins the server's certificate fingerprint from the join code. On the VPS, a local proxy port speaks SOCKS5 and HTTP CONNECT and also forwards plain HTTP. It is bound to `127.0.0.1` and requires a credential. Each connection's destination is matched against your rules. A matched connection becomes a stream on the tunnel, and the home agent resolves the name and connects to the site, so DNS for routed domains is resolved at home too. Unmatched connections are dialled directly from the VPS.

domicile does not intercept TLS. It sees the hostnames you connect to and never the page content.

## Who this is for

domicile is free for solo developers who already have a device on a residential connection. It does not create IPs.

It works well when your agent uses your own accounts at low volume (reading pages, logging in, scheduled checks) and one stable IP is enough. A personal home IP is often cleaner than a shared proxy pool.

You still need a paid proxy for rotating IPs, high volume or IPs in countries where you have no device, or if you have no residential connection. domicile will not add rotation or pooling.

## Limitations

- A residential IP fixes IP reputation only. Browser fingerprint, TLS fingerprint, behavior and per-account rate limits are separate problems.
- Your home IP becomes associated with your agent's activity.
- Results depend on your ISP and your IP's history.
- Hosted cloud browsers (Browser Use Cloud, Browserbase and similar) are not supported in v1.
- Windows is not supported.

Use your own connection for your own agents. domicile is not meant for large-scale scraping, account creation or getting around a platform's rules.

## Requirements

- A VPS running Linux or macOS, where your agent runs. Exits reach it over UDP, so open the port you give `init -public-addr` (4433 in the quick start) in both the VPS's firewall and your provider's security group.
- A device at home running Linux or macOS that stays on, such as a Raspberry Pi or an old laptop. It dials out, so you open no ports at home.
- Both machines on amd64 or arm64.

## Install

Run this on both the VPS and the home device:

```sh
curl -fsSL https://raw.githubusercontent.com/avinash-1707/domicile/main/install.sh | sh
```

The script downloads the latest release binary, checks it against the release's `SHA256SUMS` and installs it to `/usr/local/bin`. It asks before using sudo, and on Linux it offers to raise the UDP buffer limits that QUIC needs.

| Variable | Effect |
|---|---|
| `DOMICILE_BIN_DIR` | Install somewhere other than `/usr/local/bin` |
| `DOMICILE_YES=1` | Answer yes to every question, for unattended installs |

With Go 1.26.5 or later you can install it with `go install` instead:

```sh
go install github.com/avinash-1707/domicile/cmd/domicile@latest
```

domicile follows semantic versioning. Before 1.0, a minor release may change flags or file formats.

## Quick start

### 1. Set up the VPS

Create the server state, pair a device, add a rule and start the server:

```sh
domicile init -public-addr vps.example.com:4433  # prints your proxy URL and password, once
domicile add home                                # prints a one-time join code
domicile rule add reddit.com -via home
domicile server
```

The server listens on the port from `-public-addr`, here UDP 4433, because an unprivileged user cannot bind port 443 on Linux. Open UDP 4433 on the VPS.

### 2. Pair the home device

Paste the join code that `add` printed:

```sh
domicile agent join dj1.…
```

You can also install and pair in one step. The script then offers to set the agent up as a service:

```sh
curl -fsSL https://raw.githubusercontent.com/avinash-1707/domicile/main/install.sh | sh -s -- join dj1.…
```

### 3. Check the exit

Back on the VPS, confirm the device is connected and see what sites see through it:

```sh
domicile status
domicile verify
```

### 4. Point your agent at the proxy

Use the proxy URL `init` printed (`socks5h://agent:…@127.0.0.1:1080`, or the same with `http://`), or let `domicile connect` configure your tools (see below). Requests to reddit.com now leave through your home connection, and everything else leaves from the VPS.

## Run as a service

To keep both sides running across reboots, install them as services:

```sh
sudo domicile service install server     # on the VPS
sudo domicile service install agent      # on a Linux home device
domicile service install agent           # on a macOS home device (no sudo)
```

On Linux this writes a hardened systemd unit that runs domicile as your user, never as root. The service listens on the same port as `-public-addr`, so a device you paired in the quick start keeps working. Only the server gets an extra permission, the one it needs to bind port 443, so you can use `init -public-addr vps.example.com:443` when you run it as a service. On macOS it writes a launchd agent in `~/Library/LaunchAgents`.

`-print` shows the unit and the commands without changing anything, and `service uninstall` removes it (see [Revoke and uninstall](#revoke-and-uninstall)). If the server revokes a device, the agent stops instead of retrying in a loop.

## Troubleshooting

**`domicile server` fails with `permission denied`.** The tunnel port is below 1024 (usually 443) and you are a normal user. Pick a higher port in `init -public-addr`, as the quick start does, or install the service, which has the permission it needs.

**Pairing fails or the home device never connects.**
- UDP is the usual cause. Open the tunnel port in the VPS firewall (`ufw allow 4433/udp`) and in your provider's security group. Most providers block inbound UDP by default.
- The host and port in `-public-addr` must be reachable from the home network. Check `domicile status` on the VPS while the agent runs.
- A join code works once and expires. If `agent join` exits with code 4, run `domicile add <name>` again for a fresh code.
- Some networks block outbound UDP. Try the agent from another connection to confirm.

**`verify` or a request says the exit is offline.** Matched traffic is refused while the exit is down, by design. Check that the agent is running on the home device (installing it as a [service](#run-as-a-service) keeps it up across reboots) and that `domicile status` lists it as connected.

**QUIC is slow or drops on Linux.** The kernel's UDP buffers are too small. The installer offers to raise them; see quic-go's [UDP buffer size note](https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes).

## Connect your agent's tools

Most agent browser tools already accept a proxy. `domicile connect` writes the setting for you, gives each tool its own proxy credential, and can undo the change.

| Tool | Command | What it does |
|---|---|---|
| Playwright MCP | `domicile connect playwright-mcp` | Writes a Playwright config with the proxy into the state directory and prints the `claude mcp add` command; `-file .mcp.json` instead updates the existing `@playwright/mcp` entry in an MCP client file |
| agent-browser | `domicile connect agent-browser` | Sets the proxy in `~/.agent-browser/config.json` |
| curl, Python, Go, most CLIs | `domicile connect shell` | Writes `ALL_PROXY` / `HTTPS_PROXY` / `NO_PROXY` exports, in both cases, to `shell.env` in the state directory, a private file you source |
| Anything else | `domicile run -- <command>` | Runs the command with the proxy in its environment, including Node's built-in `fetch` (Node 22.21+ or 24+) |

Running `connect` again reuses the tool's password, so other configs holding it keep working; add `-rotate` to issue a new one. `domicile connect <tool> -undo` revokes the tool's credential, restores any tool config file it edited (such as `.mcp.json` or `~/.agent-browser/config.json`) byte for byte with its original permissions, and deletes the files domicile itself wrote in the state directory (`shell.env`, `playwright-mcp.json`), since they hold the password. Those two paths are reserved for domicile: do not keep your own files there.

### MCP server

`domicile mcp` is a stdio MCP server with four tools, none of which can change routing. Through it an agent can check which exit it is on, run `verify`, list blocked hosts and report a site that blocked it. A report is recorded so later sessions see it in the blocked-host list, and it comes back as a suggested `domicile rule add` command for you to run; the agent itself cannot add rules. To add it to Claude Code on the VPS:

```sh
claude mcp add domicile -- domicile mcp
```

## Rules

A rule sends a domain and its subdomains through an exit. The first matching rule wins, and a domain with no rule goes direct from the VPS.

```sh
domicile rule add reddit.com -via home                  # reddit.com and *.reddit.com
domicile rule add login.example.com -via home -exact    # only this name
domicile rule add example.org -via home -fallback-direct -note "public pages only"
domicile rule list
domicile rule remove reddit.com
```

When the exit is offline, matched traffic is refused by default so it never leaves from the datacenter IP by accident. `-fallback-direct` lets that rule go direct instead.

Rules live in `domicile.json` in the state directory. A running server picks up changes within a second. If the file becomes unreadable or names an exit that does not exist, the server keeps the last good rules and `status` shows the error.

## Checking the exit

Run `domicile verify` on the VPS while the server is running. It is a health check of each exit: it sends its requests straight through the exit, so it does not test your rules or your tools' proxy settings. For each exit it reports:

- the public IP sites see, compared with the VPS's own IP
- whether that IP's network is listed as residential, hosting or proxy (a best-effort hint from ip-api.com)
- whether DNS for routed domains is resolved on the home side
- the exit's timezone, so you can launch browsers with a matching one
- how long the first request through the tunnel took

It prints a table, or JSON with `-json`. `-exit <name>` checks one exit. It exits 0 when every check passes, 1 when one fails, and 5 when nothing failed but the IP or DNS comparison could not be measured (for example, a DNS probe timed out), so it works in scripts and health checks.

To check a rule end to end, send a request through the proxy, for example `domicile run -- curl -sI https://reddit.com`, and look for `via=home` on that host's line in the server log.

`domicile status` shows the connected exits, the server's addresses and fingerprint, and the active rules, also with `-json`.

## Security

- The home agent refuses to connect to private, loopback, link-local and cloud-metadata addresses, so an agent on the VPS cannot reach your router or other devices on your LAN. The check runs on the resolved address, so DNS tricks do not get around it. It also covers the device's own networks (including IPv6 global addresses) and the public address the VPS sees, which on many connections is the router itself. `domicile agent -allow 192.168.1.50` opens a specific address if you want one reachable. This check is a backstop, not the boundary: see [Isolating the home device](#isolating-the-home-device).
- The proxy listens on loopback only and every client needs a credential. Each connected tool gets its own, so you can revoke one without touching the others. `domicile server -proxy` can bind another address, but SOCKS5 and HTTP proxy passwords cross that connection unencrypted, so reach a remote proxy through SSH port forwarding or WireGuard instead. When the proxy is not on loopback, direct connections to the VPS's interface addresses and to private ranges are refused.
- Join codes work once and expire. domicile generates every secret itself and stores only their hashes.
- Agents' MCP tools cannot change routing. Only you can add rules.
- `domicile remove <exit>` revokes a device, and the server disconnects it within a second.

### Isolating the home device

The agent only learns the one public address the VPS sees. If the tunnel runs over IPv6, it never sees your public IPv4, and some routers answer on that address from inside the LAN. Your ISP may also give the router IPv6 addresses outside the device's own subnet. Put the boundary in the network, covering both address families:

- **Best:** run the exit on a guest Wi-Fi or VLAN that your router isolates from the rest of the LAN and from its own admin interface.
- **Otherwise:** run `domicile agent` as a dedicated user and block that user's outbound traffic on the device. On Linux with nftables, for example:

```sh
sudo useradd --system domicile-exit
sudo nft -f - <<'NFT'
table inet domicile_exit {
  chain out {
    type filter hook output priority 0; policy accept;
    meta skuid != "domicile-exit" accept
    # DNS, if your resolver is the router; drop these lines if you use a public resolver.
    ip daddr 192.168.1.1 udp dport 53 accept
    ip daddr 192.168.1.1 tcp dport 53 accept
    # Private ranges, CGNAT, link-local, and your router's public IPv4 (replace 203.0.113.7).
    ip daddr { 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 100.64.0.0/10, 169.254.0.0/16, 203.0.113.7 } reject
    # ULA, link-local, and your ISP's delegated IPv6 prefix (replace 2001:db8:1234::/56).
    ip6 daddr { fc00::/7, fe80::/10, 2001:db8:1234::/56 } reject
  }
}
NFT
```

Allow the VPS address before the `reject` lines if it falls in one of those ranges. Test it by running `curl` as that user against your router's addresses before you rely on it. The rules above do not survive a reboot unless you add them to `/etc/nftables.conf`.

## Revoke and uninstall

Revoke one device with `domicile remove <exit>` on the VPS. Remove one tool's proxy credential with `domicile connect <tool> -undo`.

To remove domicile from a machine:

1. Run `domicile connect <tool> -undo` for each connected tool, so their config files are restored.
2. Stop and remove the service, and wait for it to print `Removed …`. If it fails, stop here: the service is still running.
3. Delete the binary and the state.

```sh
sudo domicile service uninstall server   # or: agent (no sudo for the agent on macOS)
sudo rm /usr/local/bin/domicile          # or wherever DOMICILE_BIN_DIR put it
rm -r ~/.local/state/domicile            # state, certificate and credentials
```

## Reporting problems

Bugs and questions go to [GitHub Issues](https://github.com/avinash-1707/domicile/issues). For security problems, use [private vulnerability reporting](https://github.com/avinash-1707/domicile/security/advisories/new) instead. See [SECURITY.md](https://github.com/avinash-1707/domicile/blob/main/SECURITY.md).

## Reference

### Commands

| Command | Where | Description |
|---|---|---|
| `domicile init [-public-addr host:port]` | VPS | Create state, the server certificate and the first proxy user |
| `domicile add <exit>` | VPS | Print a one-time join code for a home device |
| `domicile remove <exit>` | VPS | Revoke an exit; the server disconnects it within a second |
| `domicile user add\|remove\|list` | VPS | Manage proxy users |
| `domicile rule add\|remove\|list` | VPS | Manage routing rules |
| `domicile server` | VPS | Run the server and the local proxy |
| `domicile status [-json]` | VPS | Show exits, connections and active rules |
| `domicile verify [-exit name] [-json]` | VPS | Health-check each exit: what sites see through it |
| `domicile connect <tool> [-undo]` | VPS | Point a tool at the proxy |
| `domicile run -- <command>` | VPS | Run a command with the proxy in its environment |
| `domicile mcp` | VPS | MCP tools for agents, over stdio: inspect exits and record blocked hosts; they cannot change routing |
| `domicile agent join <code>` | Home | Pair with the server, then run |
| `domicile agent [-allow ip,...]` | Home | Run the exit after pairing |
| `domicile service install\|uninstall server\|agent` | Both | Run under systemd (Linux) or launchd (macOS) |
| `domicile version` | Both | Print the version |

Run `domicile <command> -h` for a command's flags.

### Files

Everything lives in the state directory, `~/.local/state/domicile` by default (`$XDG_STATE_HOME/domicile` when that is set). Every command takes `-state-dir` to use another one.

| File | Side | Contents |
|---|---|---|
| `state.json` | VPS | Exits and proxy users, stored as hashes of their secrets |
| `server.crt`, `server.key` | VPS | The server's TLS certificate, pinned by every exit |
| `domicile.json` | VPS | Routing rules |
| `control.sock` | VPS | Local socket that `status`, `verify` and `mcp` talk to |
| `agent.json` | Home | This device's credential and the server's fingerprint |

### Exit codes

| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error, or a `verify` check failed |
| 2 | Bad command or flags |
| 3 | `verify` could not run |
| 4 | The agent's credential was revoked or its join code was already used |
| 5 | `verify` was inconclusive: no check failed, but the IP or DNS comparison could not be measured |

## Building from source

You need Go 1.26.5 or later.

```sh
git clone https://github.com/avinash-1707/domicile.git
cd domicile
go build -o domicile ./cmd/domicile
go test -race ./...
```

## License

[Apache-2.0](https://github.com/avinash-1707/domicile/blob/main/LICENSE)
