feat: add the frps and frpc roles and the relay host #42

Merged
aleksei merged 10 commits from feat/frps-role into main 2026-11-29 16:06:18 +00:00
Owner

What changes

  • inventory.ini: the relay host at relay.lan.
  • host_vars/relay.yaml: the root login and the deploy key, plus the frp server
    token and the dashboard password, kept as vault values.
  • roles/frps: the frp server. The release archive of frp v0.72.0 is pinned and
    checked by sha256 (the release ships the whole toolkit, so the role installs
    frps out of it), the configuration is /etc/frp/frps.yaml, and the service
    runs as a dedicated frp account with a hardened unit. The dashboard is
    served on port 80.
  • roles/frpc: the frp client. The same pinned archive, the client binary at
    /usr/local/bin/frpc, and the frpc_config mapping rendered as YAML to
    /etc/frp/frpc.yaml. The rendered file is checked with frpc verify before
    the handler restarts the service, and the role requires serverAddr, the
    server token under auth.method: token, and at least one proxy or visitor.
  • playbooks/relay.yaml: bash, profile, ssh and frps for the host.

Both roles are host-independent (adr/role.md): addresses, secrets and the
published proxies come from host_vars. The two roles do not touch the same
files, so they merge in either order.

Why

The relay host joins the inventory before it runs anything, so the role is in
place for the first converge. The server role covers the relay; a declared
client makes the other end of the tunnel reproducible instead of a hand-written
config on each host behind NAT.

Verification

  • ansible-playbook playbooks/relay.yaml --syntax-check passes; both secrets
    decrypt and resolve through host_vars.
  • frps verify -c frps.yaml → the configuration file ... syntax is ok.
  • A local run of the rendered frps config listens on *:7000 and
    127.0.0.1:7500; /api/serverinfo answers 401 without the dashboard
    credentials and 200 with them.
  • frpc verify -c frpc.yaml accepts the rendered file.
  • End-to-end on a scratch pair: frps with allowPorts: 33901-33999, a local
    HTTP server on :33950, the rendered client config publishing it as
    remotePort: 33901 with transport.tls.enable: true. The client logged in,
    registered the proxy, and curl http://127.0.0.1:33901/ answered 200 through
    the tunnel; the dashboard reported one client.
  • systemd-analyze verify accepts both units (it only reports the
    not-yet-installed /usr/local/bin/frps and /usr/local/bin/frpc).
## What changes - `inventory.ini`: the `relay` host at `relay.lan`. - `host_vars/relay.yaml`: the root login and the deploy key, plus the frp server token and the dashboard password, kept as vault values. - `roles/frps`: the frp server. The release archive of frp v0.72.0 is pinned and checked by sha256 (the release ships the whole toolkit, so the role installs `frps` out of it), the configuration is `/etc/frp/frps.yaml`, and the service runs as a dedicated `frp` account with a hardened unit. The dashboard is served on port 80. - `roles/frpc`: the frp client. The same pinned archive, the client binary at `/usr/local/bin/frpc`, and the `frpc_config` mapping rendered as YAML to `/etc/frp/frpc.yaml`. The rendered file is checked with `frpc verify` before the handler restarts the service, and the role requires `serverAddr`, the server token under `auth.method: token`, and at least one proxy or visitor. - `playbooks/relay.yaml`: `bash`, `profile`, `ssh` and `frps` for the host. Both roles are host-independent (`adr/role.md`): addresses, secrets and the published proxies come from `host_vars`. The two roles do not touch the same files, so they merge in either order. ## Why The relay host joins the inventory before it runs anything, so the role is in place for the first converge. The server role covers the relay; a declared client makes the other end of the tunnel reproducible instead of a hand-written config on each host behind NAT. ## Verification - `ansible-playbook playbooks/relay.yaml --syntax-check` passes; both secrets decrypt and resolve through `host_vars`. - `frps verify -c frps.yaml` → `the configuration file ... syntax is ok`. - A local run of the rendered frps config listens on `*:7000` and `127.0.0.1:7500`; `/api/serverinfo` answers 401 without the dashboard credentials and 200 with them. - `frpc verify -c frpc.yaml` accepts the rendered file. - End-to-end on a scratch pair: frps with `allowPorts: 33901-33999`, a local HTTP server on `:33950`, the rendered client config publishing it as `remotePort: 33901` with `transport.tls.enable: true`. The client logged in, registered the proxy, and `curl http://127.0.0.1:33901/` answered 200 through the tunnel; the dashboard reported one client. - `systemd-analyze verify` accepts both units (it only reports the not-yet-installed `/usr/local/bin/frps` and `/usr/local/bin/frpc`).
aleksei changed title from feat: add the frps role and the sunduk host to feat: add the frps and frpc roles and the relay host 2026-11-14 22:37:31 +00:00
aleksei deleted branch feat/frps-role 2026-11-29 16:06:18 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
zoo/infra!42
No description provided.