RELAYLINK

Linux deployment

Server

1. Publishing & Directory Permissions

On your build machine, run scripts/publish.ps1 -RuntimeIdentifier linux-x64 -Component Server, then place the published output in /opt/relaylink/server. Store the Server configuration, client directory, and TLS private keys under /etc/relaylink using a dedicated relaylink system account with strict permissions:

  • /etc/relaylink, /etc/relaylink/clients, and /var/lib/relaylink must be 0700 (accessible only to relaylink).
  • server.json, client JSON files, and TLS private keys must be 0600.
  • When RelayLink Server writes client JSON files, server config, or SQLite files, it restricts permissions to owner read/write only. If group or world read permissions are detected on startup, it writes a SECURITY warning to the error log and stderr.
  • Newly created database directories use 0700. The Server refuses to open a database inside /tmp, system temp directories, or existing world-writable directories without modifying their permissions.
  • Database paths are resolved across symlinks before opening: startup refuses if the file itself is a symlink, if it resolves to the filesystem root, or if file permissions on a newly created database cannot be tightened. relaylink-server.service enforces UMask=0077.

Create the directories and install server.json:

sudo install -d -o relaylink -g relaylink -m 0700 /etc/relaylink /etc/relaylink/clients /var/lib/relaylink /var/lib/relaylink/logs
sudo install -o relaylink -g relaylink -m 0600 ./server.json /etc/relaylink/server.json

2. Logging & systemd Service

relaylink-server.service configures /var/lib/relaylink/logs as the runtime log directory:

  • server-*.jsonl is retained for 14 days and server-error-*.jsonl is retained indefinitely; both rotate daily or at 10 MiB.
  • journalctl -u relaylink-server captures startup output and stderr diagnostics.
  • --check-config does not create log files. Existing deployments upgrading from older versions must update ExecStart and UMask in the systemd unit and run systemctl daemon-reload.

Validate and start the service:

sudo -u relaylink /opt/relaylink/server/RelayLink.Server --config /etc/relaylink/server.json --check-config
sudo install -m 0644 deploy/linux/relaylink-server.service /etc/systemd/system/relaylink-server.service
sudo systemctl daemon-reload
sudo systemctl enable --now relaylink-server

3. Networking & Protocol Compatibility

  • Restarting the Server drops all active control sessions and proxy connections.
  • Agents must be able to reach the control port tunnel.port and the separate data port tunnel.dataPort (defaults to tunnel.port + 1). If Server-hosted STUN (peerDirect.stunListenPort) is enabled, also allow that UDP port in your firewall.
  • Proxy listener ports and the Admin Dashboard port should only be reachable on private/intranet interfaces. Standard data tunnels (tunnel.dataPort) are currently unencrypted—restrict access to trusted Agent source IPs and protect them with an isolated link or network-layer encryption. Security groups provide ACLs only, not confidentiality.
  • The current Server accepts wire protocol v3, v4, and v5 Agents: you can upgrade the Server first while keeping v3 Agents for raw TCP, whereas unicast UDP requires v4 and HTTP/HTTPS reverse proxy or preferDirect requires v5. See UDP Forwarding and HTTP Reverse Proxy.

Agent

The Linux Agent shares the same configuration schema, protocol, peer channels, and local read-only status UI as the Windows and macOS Agents.

1. Building & Installing

Build or download the linux-x64 self-contained Agent package:

pwsh ./scripts/publish.ps1 -RuntimeIdentifier linux-x64 -Component Agent

Create a dedicated non-login system account (relaylink-agent). Because the Agent persists per-server identities, port allocations, and diagnostic logs under state/<profileId>/ inside its configuration directory, the configuration directory must be owned and writable only by relaylink-agent, while the binary directory is owned by root and kept read-only to the service user. Legacy single-server configs must first be converted by RelayLink.Agent.ConfigMigrator.

sudo useradd --system --home-dir /var/lib/relaylink-agent --shell /usr/sbin/nologin relaylink-agent
sudo install -d -o root -g root -m 0755 /opt/relaylink/agent
sudo tar -xzf RelayLink-Agent-linux-x64-<version>.tar.gz -C /opt/relaylink/agent
sudo chown -R root:root /opt/relaylink/agent
sudo chmod 0755 /opt/relaylink/agent/RelayLink.Agent
sudo chmod 0755 /opt/relaylink/agent/RelayLink.Agent.ConfigMigrator
sudo install -d -o relaylink-agent -g relaylink-agent -m 0700 /var/lib/relaylink-agent
sudo install -o relaylink-agent -g relaylink-agent -m 0600 ./relaylink-agent-<clientId>.json /var/lib/relaylink-agent/agent.json
sudo -u relaylink-agent /opt/relaylink/agent/RelayLink.Agent.ConfigMigrator --config /var/lib/relaylink-agent/agent.json
sudo -u relaylink-agent /opt/relaylink/agent/RelayLink.Agent --config /var/lib/relaylink-agent/agent.json --check-config
sudo install -m 0644 deploy/linux/relaylink-agent.service /etc/systemd/system/relaylink-agent.service
sudo systemctl daemon-reload
sudo systemctl enable --now relaylink-agent

2. Status, Logs & Local Dashboard

  • Check process status with systemctl status relaylink-agent; inspect launcher, RelayLink.Agent.ConfigMigrator, and stderr logs via journalctl -u relaylink-agent.
  • Runtime logs live in /var/lib/relaylink-agent/logs/: agent-*.jsonl is retained for 14 days and error-*.jsonl indefinitely, rotating daily or at 10 MiB (see Installation & Usage Guide).
  • The local Agent status UI listens by default on http://127.0.0.1:18081/ (configured via dashboardPort; set to 0 to disable).
  • relaylink-agent.service runs RelayLink.Agent.ConfigMigrator in ExecStartPre on every start (new-format configs are validated in place; migration errors prevent startup). During upgrades, replace only binaries in /opt/relaylink/agent and restart the service—never overwrite /var/lib/relaylink-agent. Keep the Agent state directory outside /var/lib/relaylink/ so Server directory permissions do not block traversal.

3. preferDirect & the libmsquic Dependency

For authorized raw TCP and unicast UDP channels configured with preferDirect, the Linux Agent requires the native MsQuic runtime library (libmsquic) (for example, libmsquic 2.x from Microsoft's Linux package repository or your distribution packages) to establish encrypted QUIC direct connections.

If libmsquic is not installed on the host:

  • The Agent still starts normally, automatically degrades peerDirectQuicReady to false during capability negotiation, and falls back gracefully to encrypted Server relay.
  • If a raw channel explicitly disables inner encryption and both sides are reachable over TCP, plaintext ICE-TCP direct (or plaintext relay) remains independently available. See Peer Direct & Relay Fallback.

Accessing the Server Admin UI via Peer Tunnel

No separate management protocol is required. Run a standard Linux Agent on the same host as RelayLink Server and expose the dashboard through an authorized peer channel:

  1. Keep the Server's dashboard.listenAddress set to 127.0.0.1 and port set to 18080 (the default in example and Docker starter configs). The dashboard serves plaintext HTTP and does not host TLS directly; binding to a non-loopback address logs a SECURITY warning to error logs and stderr.
  2. Create an enabled authorized peer channel on the co-located Linux Agent targeting 127.0.0.1:18080 (for example with channel ID server-dashboard), with "Authorized clients only" enabled.
  3. Add a peer access mapping for the authorized operator's client pointing to that Linux Agent and the server-dashboard channel.
  4. Read the assigned local entry port in the caller Agent's local status UI and open http://127.0.0.1:<entry-port>/ from a browser on the caller machine.

Security Boundaries: Browser-to-caller-Agent traffic stays on local loopback; the two Agents communicate over inner TLS with target certificate fingerprint pinning and access-key proofs; the co-located Linux Agent connects to the Server dashboard over server-side loopback. Never rebind the caller's entry point to a LAN or public address. If the co-located Agent connects to the Server's TLS domain name, ensure that hostname resolves locally to a reachable address matching the certificate SAN—do not replace serverHost with 127.0.0.1 just to bypass name validation.

Upgrading with Verified Release Packages

  1. Inspect the target update and host upgrade commands under Version Status in the Server Admin UI or local Agent UI.
  2. Copy the verified archive and checksum files to a root-owned staging directory (the generated commands stage under /var/tmp), verify the copy with sha256sum -c, and extract/validate the entrypoint before stopping the service.
  3. Back up state before swapping binaries:
    • Server: Stop the service, then back up server.json, clients/, the SQLite database, and any -wal / -shm files (excluding update caches and logs).
    • Agent: Configuration, E2E identity, and port state remain intact in /var/lib/relaylink-agent.
  4. Update cache directories are owned by the service account with 0700 permissions (alongside the audit database for Server, and alongside the configuration directory for Agent).
  5. Stop the appropriate systemd unit while retaining the previous binary tree for rollback. After replacing /opt/relaylink/server or /opt/relaylink/agent, run RelayLink.Agent.ConfigMigrator (for Agent) followed by --check-config under the service account.
  6. Start the service and verify the reported version and active tunnel connectivity. For foreground processes not managed by systemd, follow the manual stop workflow shown in the version details panel.

Repository source