Skip to content

Targets from the console

From agent 0.9.0, what an agent may reach (its targets) is kept in the console. An admin changes it on the agent’s Targets tab and the agent applies it within seconds, with no restart and no shell on its host. After the install, the host needs no further changes for day-to-day work.

An agent runs in one of two modes, set on its host:

Mode Set by Targets come from
Managed (the default) nothing: every agent 0.9.0 and later The console. Each save is a new version the agent applies live
Hardened HG_MODE=hardened on the agent host (or --hardened after the image name) The host only, exactly as before 0.9.0. The console shows the targets read-only

Only a shell on the agent host can change the mode: the console cannot switch a Hardened agent to Managed or back. Hardened suits a host whose owner wants every change to go through their own change process. It also turns off remote updates. The console’s install command does not set a mode; to install an agent as Hardened, see Hardened mode and a ceiling.

Agents older than 0.9.0 keep working as before; the console shows Update to manage from the console.

Agents → agent → Targets shows:

  • the mode and version line, for example Managed · Config v42 · applied 2 min ago;
  • Web targets: each hostname (or *.domain) and the address the agent reaches it at, with the previews that use it;
  • TCP targets: each name:port, its address and the usernames a Houseguest SSH certificate may name for it;
  • the history of versions, who saved each and what changed.

People with View agents see the tab. Saving needs Configure agents for the whole workspace (Owners and Admins hold it; a custom role can carry it, granted workspace-wide).

Edit targets takes one entry per line, in the same form as the host settings:

app.example.com = 10.0.0.5:443
*.staging.example.com = dns
ha.example.com = http://192.168.1.20:8123
db.example.com:5432 = 10.0.0.6:5432
ssh.example.com:22 = 10.0.0.7:22 ; users=deploy+ops

The address rules are those of allow-lists: host:port, dns or dns:PORT, and http:// for plain HTTP to a private address only. Advanced holds plain HTTP from the console, extra plain-HTTP ports and public DNS answers.

Save stores a new version. A change that lets the agent reach more (a new target, a broader wildcard, a target at another address, new certificate usernames or ports, public DNS answers) first shows what widens and how many open previews and viewers could reach it, and saves only once confirmed.

Targets a new version removes stop at once: their previews show the app as unavailable, and open TCP sessions to a removed service end. Requests already under way finish first.

Every save gets the agent’s next version number. To go back, use Save again on an earlier version in the history: it is saved as a new version, so the agent never runs an older number than the one it has.

The line shows the agent’s answer:

Line Meaning
Managed · Config v42 · applied 2 min ago The agent runs the latest version
Managed · Config v43 · waiting for the agent Saved; the agent has not answered yet (it applies it when it reconnects, if it is offline)
Managed · Config v43 refused The agent refused it and keeps running the version before. The tab says why
Hardened · set on the agent host HG_MODE=hardened: read-only

An agent checks every version before it applies anything:

  • The signature. The console signs each version with your workspace’s key. The agent trusts that key only because a Houseguest key built into the agent (or set as HG_CONFIG_ROOT) vouches for it; the edges carry both and cannot change either.
  • The agent. A version is for one agent only.
  • The version number. It must be newer than the one the agent runs, so an old version cannot be replayed.
  • Each entry. The agent parses it as it would its own host setting, and checks plain-HTTP addresses are private.
  • The host’s limit, HG_CEILING, when the host sets one (below).

A refused version changes nothing on the agent. Fix the entry and save again, or save an earlier version again.

The workspace’s signing key is kept on Houseguest’s central server, sealed, and never reaches an edge, so an edge cannot change what an agent reaches. For a limit that holds whatever the console signs, set HG_CEILING on the agent’s host, or use Hardened mode.

The agent host can set a limit that no version from the console can exceed:

Terminal window
HG_CEILING='*.example.com:443, npm:443, demo-*:22 users=demo'

List the hostnames and the addresses the agent reaches them at: above, the web names under example.com go to a reverse proxy called npm, so npm:443 is listed too.

Entries are comma-separated HOST:PORT, optionally followed by users=NAME+NAME (or users=*). A * matches within one label of a name (*.example.com covers a.example.com, not a.b.example.com); a port may be *. A pattern made of numbers and * (10.0.*.*:443) matches IP addresses only, never a name that looks like one. Add public-dns to allow public DNS answers.

A version is within the limit when every hostname (at port 443) and every address it would reach match an entry, and every certificate username is listed in users= of an entry matching its service. Anything else is refused with the entry that falls outside, for example TCP db.example.com:5432: address 10.0.0.9:5432 is outside HG_CEILING.

Addresses an agent never reaches by default

Section titled “Addresses an agent never reaches by default”

A Managed agent refuses loopback (127.0.0.1, ::1), link-local (169.254.0.0/16, which includes cloud metadata services, and fe80::/10), other cloud metadata addresses (fd00:ec2::254, 100.100.100.200, 168.63.129.16), unspecified and multicast addresses, whatever the console saves, and checks this each time it connects, after DNS. To allow one, list the address itself in HG_CEILING, for example 127.0.0.1:8080 for an app on the agent’s own host; a wildcard never covers these. The console refuses such a target unless the agent’s HG_CEILING lists it. With HG_CEILING set, the agent also checks that every address a name resolves to is covered by an address entry, or the name by a name entry.

Agent releases carry a Houseguest public key that vouches for each workspace’s key; agents of the hosted service always use it. An agent of a self-hosted edge needs that edge’s key instead, as HG_CONFIG_ROOT: the install command of a self-hosted console includes it, and the edge’s installer prints it. An agent with neither runs on its host settings and cannot be managed from the console.

On its first start as 0.9.0, an agent without HG_MODE=hardened:

  1. runs on its host settings exactly as before;
  2. sends them to the console, which stores them as version 1, Imported from the agent host;
  3. applies that version (no change in what it forwards) and keeps it in its data volume.

From then on the console’s versions count, also after a restart when the console cannot be reached. The host settings HG_ALLOW, HG_UPSTREAM, HG_ALLOW_TCP, HG_PLAIN_HTTP, HG_PLAIN_HTTP_PORTS and HG_ALLOW_PUBLIC_DNS are then ignored, and the agent’s log says so once at start. Remove them from the host when convenient.

Header values stay on the host in this release: HG_HEADERS_FILE keeps working as before, also for a Managed agent, and the console shows only the header names. HG_IDENTITY_FILE and HG_UPSTREAM_CA_FILE also stay on the host.

A new agent installed from the console starts the same way: the hostnames in its install command become version 1. A Managed agent may also start with no targets at all and wait for the console.