feat: add the frpc role #43

Closed
aleksei wants to merge 1 commit from feat/frpc-role into main
Owner

What changes

roles/frpc: the frp client, the counterpart of the frps role. The release
archive is pinned and checked by sha256 (the same archive as the server role),
the client binary goes to /usr/local/bin/frpc, and the whole configuration is
the frpc_config mapping rendered as YAML to /etc/frp/frpc.yaml, the way the
server role handles frps_config.

The rendered file is checked with frpc verify before the handler restarts the
service, and the role refuses to run without serverAddr, without the server
token under auth.method: token, and without at least one proxies or
visitors entry — a client with neither does nothing.

The unit runs the client as a dedicated frp account with a hardened unit; the
client only dials out and listens on no port, so it needs no capability.

Why

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.
Both roles stay host-independent (adr/role.md): addresses, secrets and the
published proxies come from host_vars.

This is a separate branch from the open server PR: the two roles do not touch
the same files, so they merge in either order.

Verification

  • frpc verify -c frpc.yaml accepts the rendered file (syntax is ok).
  • 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 the unit (it only reports the missing
    /usr/local/bin/frpc, which the role installs).
  • --syntax-check of a playbook that includes the role passes.
## What changes `roles/frpc`: the frp client, the counterpart of the `frps` role. The release archive is pinned and checked by sha256 (the same archive as the server role), the client binary goes to `/usr/local/bin/frpc`, and the whole configuration is the `frpc_config` mapping rendered as YAML to `/etc/frp/frpc.yaml`, the way the server role handles `frps_config`. The rendered file is checked with `frpc verify` before the handler restarts the service, and the role refuses to run without `serverAddr`, without the server token under `auth.method: token`, and without at least one `proxies` or `visitors` entry — a client with neither does nothing. The unit runs the client as a dedicated `frp` account with a hardened unit; the client only dials out and listens on no port, so it needs no capability. ## Why 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. Both roles stay host-independent (`adr/role.md`): addresses, secrets and the published proxies come from `host_vars`. This is a separate branch from the open server PR: the two roles do not touch the same files, so they merge in either order. ## Verification - `frpc verify -c frpc.yaml` accepts the rendered file (`syntax is ok`). - 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 the unit (it only reports the missing `/usr/local/bin/frpc`, which the role installs). - `--syntax-check` of a playbook that includes the role passes.
Author
Owner

Superseded by #42: the frpc role is now part of the combined frps/frpc PR.

Superseded by #42: the frpc role is now part of the combined frps/frpc PR.
aleksei closed this pull request 2026-11-14 22:37:35 +00:00

Pull request closed

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!43
No description provided.