RELAYLINK

Windows deployment

Server

1. Publishing & Directory ACLs

On your build machine, run scripts/publish.ps1 -RuntimeIdentifier win-x64 -Component Server and install the published output into a protected directory such as C:\Program Files\RelayLink\Server. Place server.json, the clients directory, and TLS private keys under C:\ProgramData\RelayLink:

  • Pre-provisioned TLS private keys must grant read access only to the actual service account and deny read/modify access to non-privileged users (LocalSystem and BuiltinAdministrators may also be granted access for maintenance). Use absolute Windows paths in JSON fields.
  • When RelayLink Server writes client JSON files, server config, or SQLite files, it applies a protected DACL granting access only to the service account, LocalSystem, and BuiltinAdministrators, allowing members of Administrators to perform backups and troubleshooting during maintenance windows. For legacy files owned exclusively by an old service account, ensure maintenance accounts can read them before stopping the service.

2. Registering & Running the Windows Service

In an elevated PowerShell prompt, run:

.\install-server-service.ps1 -ExecutablePath 'C:\Program Files\RelayLink\Server\RelayLink.Server.exe' -ConfigurationPath 'C:\ProgramData\RelayLink\server.json'

install-server-service.ps1 behavior and service requirements:

  • Runs --check-config first, then registers an automatic-start Windows Service (defaulting to NT AUTHORITY\LocalService, adjustable via -ServiceAccount) with service recovery and non-crash failure recovery (failureflag 1).
  • Automatically rolls back and deletes the newly created service if registration or startup fails. If a service with the same name already exists, the script stops and requires explicit administrator handling rather than overwriting a running service.
  • The service account must have read access to server.json, read/write access to clients and the SQLite/log directories, permission to bind configured control, data, proxy, automation, and dashboard ports, and read access to the control TLS private key.
  • Agents must reach tunnel.port and tunnel.dataPort. Because standard data tunnels are unencrypted, protect them with a trusted isolated link or network-layer encryption.
  • The current Server accepts v3, v4, and v5 Agents: you can upgrade the Server first for standard TCP (v3+), while unicast UDP requires v4 and HTTP/HTTPS reverse proxy or preferDirect requires v5. See UDP Forwarding and HTTP Reverse Proxy.

3. Runtime Logs

Server runtime logs default to logs/ inside the configuration directory (for example C:\ProgramData\RelayLink\logs):

  • server-*.jsonl is retained for 14 days and server-error-*.jsonl indefinitely; both rotate daily or at 10 MiB.
  • For manual launches, use --log-directory <protected-directory> (writable by the service account).
  • Runtime logging does not depend on Windows Event Log sources; SQLite auditing remains stored separately.

Agent

1. Building Installers & Prerequisites

Using the installer is recommended for Windows Agents.

  • Minimum OS: Windows Server 2012 R2 x64.
  • Shared Prerequisite: Both installers require Microsoft Visual C++ 2015–2022 Redistributable x64 on the target host.
  • Installer Variants:
    • Self-contained (self-contained): Bundles the .NET 10 runtime.
    • Framework-dependent (framework-dependent): Also requires .NET 10 ASP.NET Core Runtime x64 pre-installed on the target host.

On a Windows build machine with Inno Setup 6.3 or newer (ISCC.exe installed), run:

.\scripts\build-agent-installer.ps1 -Version 1.0.0

Build outputs:

  • Installers: artifacts/installer/RelayLink-Agent-win-x64-self-contained-1.0.0.exe and RelayLink-Agent-win-x64-framework-dependent-1.0.0.exe.
  • Publish staging directories: artifacts/installer-publish/<build-id>/win-x64/self-contained/RelayLink.Agent and .../framework-dependent/RelayLink.Agent (neither bundles real configurations, secrets, or certificates).
  • The same build also emits two program ZIP archives in artifacts/release/ (self-contained and framework-dependent); GitHub Releases attach all four Windows Agent artifacts.

Unsigned Binary Notice: Released .exe installers and archives do not have Authenticode code signatures. The build pipeline verifies only the Inno Setup compiler's SHA-256 and publisher signature and does not sign RelayLink outputs. Until code signing is wired in, always verify integrity using the published SHA256SUMS file (note that SHA256SUMS verifies file integrity only, not publisher identity).

2. First-Time Interactive Installation

  1. Run the installer as Administrator. The prerequisite check page reports OS, x64 architecture, VC++, and .NET status; the self-contained installer reports .NET as bundled, whereas the framework-dependent installer blocks installation if .NET 10 ASP.NET Core Runtime x64 is missing (silent installs enforce the same check).
  2. First-time installation requires selecting an existing new-format Agent JSON configuration (servers[] containing at least one entry, with TLS trust embedded as trustedCaPemBase64 so no separate PEM file is needed). Missing, nonexistent, or wrong-extension files block installation.
  3. The installer validates the configuration, copies it to C:\ProgramData\RelayLink\Agent\agent.json (with ACLs restricted to LocalService, SYSTEM, and Administrators), and registers RelayLinkAgent as an automatic-start Windows Service running as LocalService via the Win32_Service CIM API (compatible with both Windows PowerShell and PowerShell 7), then starts it immediately. Service registration or startup failures abort the install and surface the underlying error.
  4. On success, an "RelayLink Agent Monitor" shortcut is created on the public desktop for all users, opening http://127.0.0.1:dashboardPort/ in the default browser (defaults to 18081; skipped if dashboardPort is 0).
  5. Verbose installer logs are enabled by default and copied to C:\ProgramData\RelayLink\Agent\installer-logs on exit (recording dependency checks, phases, script exit codes, and error reasons—never the Agent JSON body, client secrets, or CA content).

Configuration Boundary: Agent configs contain only server host/port, client ID, client secret, CA certificate, and local settings—never channels or target addresses. LocalService must be able to reach the Server's control/data ports and local business targets. Convert legacy single-server JSON files first with RelayLink.Agent.ConfigMigrator.exe --input <old-file> --output <new-file>; the installer rejects legacy configs directly and does not delete original JSON or legacy PEM files—protect or securely clean them up yourself.

3. Update & Reconfigure Modes

When an existing installation is detected, the wizard prompts for Update Software Only or Reconfigure. Both modes briefly stop and restart the currently installed service without taking over same-named services in other directories:

  • Update Software Only (/MODE=update): Stops the service, cleans known Agent binaries, runtime files, and legacy wwwroot assets in C:\Program Files\RelayLink\Agent, writes the full new version without requiring a new JSON file, cleans any legacy program subdirectory while restoring the root service path, and preserves Inno uninstall metadata and scripts. Before starting the new Agent, it runs RelayLink.Agent.ConfigMigrator.exe to migrate legacy configs (including UTF-8 BOM files written by Windows PowerShell), E2E identity, and port state into the new format and state/primary/, preserving originals as a protected fallback; if migration fails, the service remains stopped. This mode also supports switching between self-contained and framework-dependent builds.
  • Reconfigure (/MODE=reconfigure): Requires a new-format JSON file. Preflight rejects legacy single-server files before stopping the existing service; once full validation passes, it cleans Agent-managed config, old identity/port state, and state/<profileId>/ (taking delete ownership over legacy service-account-only identity files), writes the new config, and updates the desktop shortcut for the new dashboardPort. Unknown files, unrelated directories, and Windows Event Logs are untouched. Rebuilding identity may change the Agent fingerprint and local entry ports (follow identity rotation on the Server if fingerprint pinning is enabled). Back up any config or logs you want to retain before proceeding.

4. Silent Installation & Uninstallation

First-time silent installation requires an explicit configuration path:

.\RelayLink-Agent-win-x64-self-contained-1.0.0.exe /VERYSILENT /SUPPRESSMSGBOXES '/CONFIG=C:\path\agent.json'

Silent upgrades and reconfiguration on an existing installation:

  • Silent update: Pass /MODE=update (no /CONFIG required).
  • Silent reconfigure: Pass /MODE=reconfigure /CONFIG=C:\path\new-agent.json (passing /MODE=reconfigure explicitly confirms clearing local state; interactive installs still show a confirmation prompt).
  • Silent installs return a non-zero exit code if any script step fails.

Uninstall Behavior: The uninstaller stops and removes the Windows Service, program files, and installer-created desktop shortcut, while intentionally preserving configuration, CA material, and identity/port state in C:\ProgramData\RelayLink\Agent (these contain sensitive secrets—back up or purge them manually). The installer does not test Server reachability or client authentication; after installation, confirm the client shows Online in the Server Admin UI and inspect the local Agent status page.

5. Manual Archive Deployment (Including Server 2012 R2 Legacy Script)

You can also build unpacked Agent packages with scripts/publish.ps1:

  • Self-contained: scripts/publish.ps1 -RuntimeIdentifier win-x64 -Component Agent -WindowsAgentMode SelfContained
  • Framework-dependent: scripts/publish.ps1 -RuntimeIdentifier win-x64 -Component Agent -WindowsAgentMode FrameworkDependent

Outputs are placed under artifacts/publish/win-x64/<mode>/RelayLink.Agent. Copy the chosen build into a protected C:\Program Files\RelayLink\Agent directory (cleaning older binaries and runtime files before switching build modes), then run in an elevated PowerShell prompt:

.\install-agent-service.ps1 -ExecutablePath 'C:\Program Files\RelayLink\Agent\RelayLink.Agent.exe' -ConfigurationPath 'C:\path\agent.json'

Important notes:

  • install-agent-service.ps1 validates the new-format config, copies it into place, and registers an automatic-start Windows Service with failure recovery; first-time installation requires a config file and will not implicitly overwrite an existing service.

  • When copying install or uninstall scripts manually, also copy agent-monitor-shortcut.ps1 and RelayLink.Agent.ConfigMigrator.exe from the same directory.

  • For manual debugging, run RelayLink.Agent.ConfigMigrator.exe first and then start the Agent with --config 'C:\ProgramData\RelayLink\Agent\agent.json'.

  • Windows Server 2012 / 2012 R2 Legacy Registration: On older hosts whose built-in Windows PowerShell cannot run install-agent-service.ps1, copy the binaries and configuration into place and run the WMI + sc.exe compatibility script as Administrator:

    Set-ExecutionPolicy -Scope Process Bypass
    .\register-agent-service-legacy.ps1
    

    By default it uses C:\Program Files\RelayLink\Agent\RelayLink.Agent.exe and C:\ProgramData\RelayLink\Agent\agent.json and runs --check-config before registering. If an earlier failure left a stale service, verify its target with sc.exe qc RelayLinkAgent and pass -ReplaceExisting explicitly to stop and recreate it. For custom paths, pass -ExecutablePath and -ConfigurationPath and ensure LocalService has read access to the executable/config and write access to the state directory.

6. Local Status UI & Peer Entry Ports

  • By default, the Agent serves a per-server local status UI on http://127.0.0.1:18081/ (set dashboardPort in agent.json, or 0 to disable UI and API). No admin password is required; write endpoints validate local origin and a page-session CSRF token. Never proxy this UI to a public network.
  • Adding or updating server connections only accepts single-server new-format JSON downloaded from a Server. Registered profiles can be disabled (disconnects and stops reconnecting while preserving config, secrets, and identity across restarts), re-enabled, or deleted locally.
  • Local peer entry ports are automatically allocated from outboundPortRangeStart–outboundPortRangeEnd (default 20000–59999) and persisted in state/<profileId>/ports.json inside the config directory, reused across restarts and rotated on conflict. The service account must have write access to that directory and permission to bind those local ports.

Assisted Upgrades via Dashboard

  1. Download and verify the target package from Version Status in the Server Admin UI or local Agent UI.
  2. In an elevated PowerShell prompt, copy verified files to a protected staging directory and re-check the copy with Get-FileHash -Algorithm SHA256 (Windows releases currently lack Authenticode signatures—always verify against SHA256SUMS from the release page).
  3. New update cache directories grant access to the service account, SYSTEM, and Administrators; existing directories must pass ACL validation first. Generated upgrade commands stage under C:\ProgramData\RelayLink (accessible only to Administrators and SYSTEM), verify the package and extracted entrypoint, swap the program directory, and keep a backup for rollback.
  4. Choose the workflow matching your deployment:
    • Inno Setup installer deployments: Run the staged installer with /MODE=update (or copy the silent command shown in the version details panel); inspect logs in C:\ProgramData\RelayLink\Agent\installer-logs.
    • ZIP archive or custom service-name deployments: Verify the actual SCM service name, stop the service, back up config, binaries, and full Server SQLite data, replace binaries, run RelayLink.Agent.ConfigMigrator.exe (for Agent) and --check-config, then start the service and verify the reported version and tunnel connectivity.

Repository source