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 (
LocalSystemandBuiltinAdministratorsmay 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, andBuiltinAdministrators, allowing members ofAdministratorsto 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-configfirst, then registers an automatic-start Windows Service (defaulting toNT 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 toclientsand 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.portandtunnel.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
preferDirectrequires 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-*.jsonlis retained for 14 days andserver-error-*.jsonlindefinitely; 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.
- Self-contained (
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.exeandRelayLink-Agent-win-x64-framework-dependent-1.0.0.exe. - Publish staging directories:
artifacts/installer-publish/<build-id>/win-x64/self-contained/RelayLink.Agentand.../framework-dependent/RelayLink.Agent(neither bundles real configurations, secrets, or certificates). - The same build also emits two program ZIP archives in
artifacts/release/(self-containedandframework-dependent); GitHub Releases attach all four Windows Agent artifacts.
Unsigned Binary Notice: Released
.exeinstallers 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 publishedSHA256SUMSfile (note thatSHA256SUMSverifies file integrity only, not publisher identity).
2. First-Time Interactive Installation
- 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).
- First-time installation requires selecting an existing new-format Agent JSON configuration (
servers[]containing at least one entry, with TLS trust embedded astrustedCaPemBase64so no separate PEM file is needed). Missing, nonexistent, or wrong-extension files block installation. - The installer validates the configuration, copies it to
C:\ProgramData\RelayLink\Agent\agent.json(with ACLs restricted toLocalService,SYSTEM, andAdministrators), and registersRelayLinkAgentas an automatic-start Windows Service running asLocalServicevia theWin32_ServiceCIM 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. - 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 to18081; skipped ifdashboardPortis0). - Verbose installer logs are enabled by default and copied to
C:\ProgramData\RelayLink\Agent\installer-logson 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.
LocalServicemust be able to reach the Server's control/data ports and local business targets. Convert legacy single-server JSON files first withRelayLink.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 legacywwwrootassets inC:\Program Files\RelayLink\Agent, writes the full new version without requiring a new JSON file, cleans any legacyprogramsubdirectory while restoring the root service path, and preserves Inno uninstall metadata and scripts. Before starting the new Agent, it runsRelayLink.Agent.ConfigMigrator.exeto migrate legacy configs (including UTF-8 BOM files written by Windows PowerShell), E2E identity, and port state into the new format andstate/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, andstate/<profileId>/(taking delete ownership over legacy service-account-only identity files), writes the new config, and updates the desktop shortcut for the newdashboardPort. 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/CONFIGrequired). - Silent reconfigure: Pass
/MODE=reconfigure /CONFIG=C:\path\new-agent.json(passing/MODE=reconfigureexplicitly 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.ps1validates 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.ps1andRelayLink.Agent.ConfigMigrator.exefrom the same directory.For manual debugging, run
RelayLink.Agent.ConfigMigrator.exefirst 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.execompatibility script as Administrator:Set-ExecutionPolicy -Scope Process Bypass .\register-agent-service-legacy.ps1By default it uses
C:\Program Files\RelayLink\Agent\RelayLink.Agent.exeandC:\ProgramData\RelayLink\Agent\agent.jsonand runs--check-configbefore registering. If an earlier failure left a stale service, verify its target withsc.exe qc RelayLinkAgentand pass-ReplaceExistingexplicitly to stop and recreate it. For custom paths, pass-ExecutablePathand-ConfigurationPathand ensureLocalServicehas 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/(setdashboardPortinagent.json, or0to 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(default20000–59999) and persisted instate/<profileId>/ports.jsoninside 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
- Download and verify the target package from Version Status in the Server Admin UI or local Agent UI.
- 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 againstSHA256SUMSfrom the release page). - New update cache directories grant access to the service account,
SYSTEM, andAdministrators; existing directories must pass ACL validation first. Generated upgrade commands stage underC:\ProgramData\RelayLink(accessible only toAdministratorsandSYSTEM), verify the package and extracted entrypoint, swap the program directory, and keep a backup for rollback. - 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 inC:\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.
- Inno Setup installer deployments: Run the staged installer with