Image labels, opt-in agent skip-verify, PUID/PGID, system proxy support #6
@@ -57,6 +57,12 @@ WEBUI_PORT=13080
|
||||
BACKEND_PORT=19080
|
||||
NATS_WS_PORT=19222
|
||||
|
||||
# ── Container user ─────────────────────────────────────────────────────────
|
||||
# The backend/webui containers run as this user; remap when bind-mount
|
||||
# ownership needs it.
|
||||
PUID=1000
|
||||
PGID=1000
|
||||
|
||||
# ── Public edge ────────────────────────────────────────────────────────────
|
||||
# The single public https URL served by your existing reverse proxy.
|
||||
PUBLIC_SERVER_URL=https://control.example.com
|
||||
|
||||
+13
-2
@@ -241,10 +241,21 @@ jobs:
|
||||
env:
|
||||
VERSION: ${{ steps.ver.outputs.version }}
|
||||
PREFIX: ${{ steps.ver.outputs.prefix }}
|
||||
SOURCE_URL: ${{ github.server_url }}/${{ github.repository }}
|
||||
run: |
|
||||
set -e
|
||||
docker build -f src/Infra/backend/Dockerfile --build-arg UNIFIED_VERSION="$VERSION" -t "${PREFIX}-backend:$VERSION" .
|
||||
docker build -f src/Infra/webui/Dockerfile --build-arg UNIFIED_VERSION="$VERSION" -t "${PREFIX}-webui:$VERSION" .
|
||||
GIT_COMMIT="$(git rev-parse HEAD)"
|
||||
GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)"
|
||||
BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
for svc in backend webui; do
|
||||
docker build -f "src/Infra/${svc}/Dockerfile" \
|
||||
--build-arg UNIFIED_VERSION="$VERSION" \
|
||||
--build-arg GIT_COMMIT="$GIT_COMMIT" \
|
||||
--build-arg GIT_COMMIT_SHORT="$GIT_COMMIT_SHORT" \
|
||||
--build-arg BUILD_DATE="$BUILD_DATE" \
|
||||
--build-arg SOURCE_URL="$SOURCE_URL" \
|
||||
-t "${PREFIX}-${svc}:$VERSION" .
|
||||
done
|
||||
|
||||
- name: Tag and push
|
||||
env:
|
||||
|
||||
@@ -452,16 +452,19 @@ Caddy / Nginx UI / nginx can bind or trust the files directly and stay
|
||||
current. On **Linux/macOS/containers** the PEM files are the primary store
|
||||
(`TLS_CERT_DIR` overrides; keep it on a persisted volume in containers).
|
||||
|
||||
**Agents** follow automatically: when the server serves the self-signed
|
||||
chain directly (no proxy in between), the Add-Device one-liners and install
|
||||
scripts include TLS skip-verify and set the agent's `TlsSkipVerify` registry
|
||||
value (`/etc/executer/agent.json` on unix) so enrollment and the persistent
|
||||
connection work out of the box — still fully encrypted. The value is
|
||||
**Agents** skip verification only when the operator says so — a
|
||||
self-signed server that later gains a proxy with a real certificate must
|
||||
not leave agents skipping validation needlessly. The Add-Device modal (and
|
||||
the Settings token panel) carry a **Skip TLS verification** checkbox,
|
||||
pre-selected only while the server is serving its self-signed chain
|
||||
directly; when ticked, the one-liner and the served install script include
|
||||
the skip bits and set the agent's `TlsSkipVerify` registry value
|
||||
(`/etc/executer/agent.json` on unix) — still fully encrypted. The value is
|
||||
GPO-manageable (`Skip TLS certificate verification` in the ADMX template,
|
||||
policy key beats local config), `configure --skip-tls-verify` sets it by
|
||||
hand, and the agent MSI wizard has a matching checkbox — unchecked by
|
||||
default (`SKIPTLSVERIFY=1` silently). Behind a proxy with a real
|
||||
certificate none of this engages — agents validate normally.
|
||||
default (`SKIPTLSVERIFY=1` silently). Left unticked, agents validate
|
||||
normally.
|
||||
|
||||
---
|
||||
|
||||
@@ -550,6 +553,7 @@ msiexec /i Agent.msi /qn SERVERURL=https://control.example.com BOOTSTRAPTOKEN=<t
|
||||
| `ALLOWREMOTESHELL` | `AllowRemoteShell` |
|
||||
| `ALLOWSCRIPTEXECUTION` | `AllowScriptExecution` |
|
||||
| `SKIPTLSVERIFY` | `TlsSkipVerify` (self-signed servers; hop stays encrypted) |
|
||||
| `PROXYURL` | `ProxyUrl` (explicit outbound proxy; system proxy otherwise) |
|
||||
|
||||
The installer never overwrites a non-blank existing value with a blank property,
|
||||
preserves configuration on upgrade, and removes runtime credentials only on a
|
||||
@@ -571,6 +575,15 @@ Group Policy templates live in
|
||||
[src/Installer/Policies](src/Installer/Policies) (`ExecuteR.admx` +
|
||||
`en-US/ExecuteR.adml`).
|
||||
|
||||
**Outbound proxy**: the agent honors the system/environment proxy
|
||||
(`HTTP_PROXY`/`HTTPS_PROXY`/`NO_PROXY`, or the Windows system proxy) for
|
||||
enrollment and the persistent WebSocket connection, authenticating to the
|
||||
proxy with the process account's **default credentials** — corporate
|
||||
NTLM/Negotiate proxies work unattended. `ProxyUrl` (registry, GPO, MSI
|
||||
`PROXYURL`, or `configure --proxy`) forces an explicit proxy instead. The
|
||||
server does the same for its outbound HTTP (S3, OIDC, secrets providers,
|
||||
downloads).
|
||||
|
||||
---
|
||||
|
||||
## Bootstrap and URL install
|
||||
|
||||
@@ -95,6 +95,8 @@ services:
|
||||
- '8080'
|
||||
ports:
|
||||
- '${BIND_EXTERNAL_ADDRESS:-0.0.0.0}:${BACKEND_PORT:-19080}:8080'
|
||||
# Operators remap with PUID/PGID when volume ownership requires it.
|
||||
user: "${PUID:-1000}:${PGID:-1000}"
|
||||
environment:
|
||||
ASPNETCORE_URLS: 'http://0.0.0.0:8080'
|
||||
DATABASE_PROVIDER: '${DATABASE_PROVIDER:-sqlite}'
|
||||
@@ -182,6 +184,8 @@ services:
|
||||
- '3000'
|
||||
ports:
|
||||
- '${BIND_EXTERNAL_ADDRESS:-0.0.0.0}:${WEBUI_PORT:-13080}:3000'
|
||||
# Operators remap with PUID/PGID when volume ownership requires it.
|
||||
user: "${PUID:-1000}:${PGID:-1000}"
|
||||
environment:
|
||||
PORT: '3000'
|
||||
NODE_ENV: 'production'
|
||||
|
||||
@@ -144,7 +144,8 @@ ExecuteR standalone server $Version ($rid)
|
||||
roots simply are not distributed, the traffic is still encrypted) or
|
||||
import the root and intermediate to establish trust, re-importing when
|
||||
they rotate at expiry. Follow your organization's security standards.
|
||||
Install commands generated by the UI configure agents accordingly.
|
||||
The Add-Device modal offers a skip-verify checkbox for agents,
|
||||
pre-selected only while serving the self-signed chain directly.
|
||||
2. $exeName
|
||||
Serves the UI + API on http://0.0.0.0:9080 with the NATS sidecar.
|
||||
...or run in the background:
|
||||
|
||||
@@ -117,6 +117,7 @@ public static class AgentCli
|
||||
{
|
||||
string? url = null;
|
||||
string? token = null;
|
||||
string? proxy = null;
|
||||
for (var i = 0; i < args.Length - 1; i++)
|
||||
{
|
||||
switch (args[i])
|
||||
@@ -127,13 +128,16 @@ public static class AgentCli
|
||||
case "--token":
|
||||
token = args[++i];
|
||||
break;
|
||||
case "--proxy":
|
||||
proxy = args[++i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var skipTlsVerify = args.Contains("--skip-tls-verify");
|
||||
if (url is null && token is null && !skipTlsVerify)
|
||||
if (url is null && token is null && proxy is null && !skipTlsVerify)
|
||||
{
|
||||
Console.Error.WriteLine("Usage: configure --url <server-url> [--token <bootstrap-token>] [--skip-tls-verify]");
|
||||
Console.Error.WriteLine("Usage: configure --url <server-url> [--token <bootstrap-token>] [--proxy <proxy-url>] [--skip-tls-verify]");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -148,6 +152,13 @@ public static class AgentCli
|
||||
registry.WriteString(Branding.AgentRegistryKey, Agent.Configuration.AgentConfigurationKeys.BootstrapToken, token);
|
||||
}
|
||||
|
||||
if (proxy is not null)
|
||||
{
|
||||
// Explicit outbound proxy; without it the system/environment
|
||||
// proxy is honored — default credentials either way.
|
||||
registry.WriteString(Branding.AgentRegistryKey, Agent.Configuration.AgentConfigurationKeys.ProxyUrl, proxy);
|
||||
}
|
||||
|
||||
if (skipTlsVerify)
|
||||
{
|
||||
// For servers on the managed self-signed chain without a proxy:
|
||||
|
||||
@@ -19,6 +19,7 @@ public sealed class AgentConfiguration
|
||||
public required ConfigurationValue<bool> AllowRemoteShell { get; init; }
|
||||
public required ConfigurationValue<bool> AllowScriptExecution { get; init; }
|
||||
public required ConfigurationValue<bool> TlsSkipVerify { get; init; }
|
||||
public required ConfigurationValue<string?> ProxyUrl { get; init; }
|
||||
|
||||
/// <summary>Parsed ServerURL; null when unset or invalid.</summary>
|
||||
public ServerUrl? ServerUrl =>
|
||||
@@ -48,6 +49,7 @@ public sealed class AgentConfigurationLoader(IRegistryStore registry, bool allow
|
||||
AllowRemoteShell = ResolveBool(AgentConfigurationKeys.AllowRemoteShell, defaultValue: false),
|
||||
AllowScriptExecution = ResolveBool(AgentConfigurationKeys.AllowScriptExecution, defaultValue: true),
|
||||
TlsSkipVerify = ResolveBool(AgentConfigurationKeys.TlsSkipVerify, defaultValue: false),
|
||||
ProxyUrl = ResolveString(AgentConfigurationKeys.ProxyUrl, AgentConfigurationKeys.EnvironmentNames.ProxyUrl, null),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -20,12 +20,20 @@ public static class AgentConfigurationKeys
|
||||
/// </summary>
|
||||
public const string TlsSkipVerify = "TlsSkipVerify";
|
||||
|
||||
/// <summary>
|
||||
/// Explicit outbound proxy URL (http://proxy:8080). Unset, the agent
|
||||
/// honors the system/environment proxy; either way it authenticates to
|
||||
/// the proxy with the process account's default credentials.
|
||||
/// </summary>
|
||||
public const string ProxyUrl = "ProxyUrl";
|
||||
|
||||
/// <summary>Development-only environment variable names (never override GPO).</summary>
|
||||
public static class EnvironmentNames
|
||||
{
|
||||
public const string ServerUrl = "AGENT_SERVER_URL";
|
||||
public const string BootstrapToken = "AGENT_BOOTSTRAP_TOKEN";
|
||||
public const string LogLevel = "AGENT_LOG_LEVEL";
|
||||
public const string ProxyUrl = "AGENT_PROXY_URL";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Net;
|
||||
|
||||
namespace Agent.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Process-wide outbound proxy. The system/environment proxy is honored by
|
||||
/// default (HTTP_PROXY / HTTPS_PROXY / NO_PROXY, or the Windows system
|
||||
/// proxy), and the agent authenticates to it with the process account's
|
||||
/// default credentials — so corporate NTLM/Negotiate proxies work
|
||||
/// unattended under the service account. ProxyUrl (registry/GPO) forces an
|
||||
/// explicit proxy instead. Applies to every HttpClient and, via
|
||||
/// HttpClient.DefaultProxy, to the NATS WebSocket connection.
|
||||
/// </summary>
|
||||
public static class ProxySetup
|
||||
{
|
||||
public static void Apply(AgentConfiguration configuration)
|
||||
{
|
||||
if (configuration.ProxyUrl.Value is { Length: > 0 } proxyUrl
|
||||
&& Uri.TryCreate(proxyUrl, UriKind.Absolute, out var proxyUri))
|
||||
{
|
||||
HttpClient.DefaultProxy = new WebProxy(proxyUri)
|
||||
{
|
||||
BypassProxyOnLocal = true,
|
||||
Credentials = CredentialCache.DefaultCredentials,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
HttpClient.DefaultProxy.Credentials = CredentialCache.DefaultCredentials;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,23 +37,34 @@ public static class AgentNatsOptionsFactory
|
||||
LoggerFactory = loggerFactory,
|
||||
};
|
||||
|
||||
// TlsSkipVerify (registry/GPO): accept the managed self-signed chain
|
||||
// on the wss connection — the traffic stays TLS-encrypted.
|
||||
if (configuration.TlsSkipVerify.Value)
|
||||
var skipTlsVerify = configuration.TlsSkipVerify.Value;
|
||||
if (skipTlsVerify)
|
||||
{
|
||||
options = options with
|
||||
options = options with { TlsOpts = NatsTlsOpts.Default with { InsecureSkipVerify = true } };
|
||||
}
|
||||
|
||||
options = options with
|
||||
{
|
||||
WebSocketOpts = NatsWebSocketOpts.Default with
|
||||
{
|
||||
TlsOpts = NatsTlsOpts.Default with { InsecureSkipVerify = true },
|
||||
WebSocketOpts = NatsWebSocketOpts.Default with
|
||||
ConfigureClientWebSocketOptions = (_, clientOptions, _) =>
|
||||
{
|
||||
ConfigureClientWebSocketOptions = (_, clientOptions, _) =>
|
||||
// System/override proxy (ProxySetup) with default
|
||||
// credentials — ClientWebSocket does not inherit
|
||||
// HttpClient.DefaultProxy on its own.
|
||||
clientOptions.Proxy = System.Net.Http.HttpClient.DefaultProxy;
|
||||
|
||||
// TlsSkipVerify (registry/GPO): accept the managed
|
||||
// self-signed chain — the traffic stays TLS-encrypted.
|
||||
if (skipTlsVerify)
|
||||
{
|
||||
clientOptions.RemoteCertificateValidationCallback = (_, _, _, _) => true;
|
||||
return ValueTask.CompletedTask;
|
||||
},
|
||||
}
|
||||
|
||||
return ValueTask.CompletedTask;
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,10 @@ public static class AgentHost
|
||||
var registry = Platform.PlatformServices.CreateRegistryStore();
|
||||
var agentConfiguration = new AgentConfigurationLoader(registry, allowEnvironment: !runAsService).Load();
|
||||
|
||||
// System/override proxy with default credentials for all outbound
|
||||
// traffic (enrollment HTTP and the NATS WebSocket alike).
|
||||
ProxySetup.Apply(agentConfiguration);
|
||||
|
||||
var logSettings = LogSettings.FromConfiguration(
|
||||
builder.Configuration,
|
||||
LogDefaults.Agent,
|
||||
|
||||
@@ -27,7 +27,7 @@ public static class InstallEndpoints
|
||||
}
|
||||
|
||||
private static IResult GetInstallScript(
|
||||
HttpContext context, IConfiguration configuration, Backend.Tls.TlsSettings tls, string? token, string? type)
|
||||
HttpContext context, IConfiguration configuration, string? token, string? type, string? skipVerify)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(token))
|
||||
{
|
||||
@@ -36,19 +36,21 @@ public static class InstallEndpoints
|
||||
|
||||
var baseUrl = ResolveBaseUrl(context, configuration);
|
||||
|
||||
// Direct self-signed serving: the roots aren't distributed, so the
|
||||
// installer must skip verification and configure the agent to do the
|
||||
// same (TlsSkipVerify — the hop stays encrypted either way).
|
||||
var skipVerify = tls.IsSelfSignedDirect(context);
|
||||
// Skip-verify is an OPERATOR CHOICE (&skipVerify=1), never inferred:
|
||||
// a self-signed server that later gains a proxy with a real
|
||||
// certificate must not leave agents skipping validation needlessly.
|
||||
// The Add Device modal pre-selects it only while serving the
|
||||
// self-signed chain directly.
|
||||
var skipTlsVerify = skipVerify is "1" or "true";
|
||||
|
||||
// Token is embedded so the operator can paste one command; knowledge of a
|
||||
// valid token is itself the enrollment gate.
|
||||
var script = type?.ToLowerInvariant() switch
|
||||
{
|
||||
"linux" => BuildUnixScript(baseUrl, token!, "linux", skipVerify),
|
||||
"osx" or "mac" or "macos" or "darwin" => BuildUnixScript(baseUrl, token!, "osx", skipVerify),
|
||||
"zip" => BuildZipScript(baseUrl, token!, $"{baseUrl}{ApiRoutes.AgentPackage}?type=zip", skipVerify),
|
||||
_ => BuildMsiScript(baseUrl, token!, $"{baseUrl}{ApiRoutes.AgentPackage}?type=msi", skipVerify),
|
||||
"linux" => BuildUnixScript(baseUrl, token!, "linux", skipTlsVerify),
|
||||
"osx" or "mac" or "macos" or "darwin" => BuildUnixScript(baseUrl, token!, "osx", skipTlsVerify),
|
||||
"zip" => BuildZipScript(baseUrl, token!, $"{baseUrl}{ApiRoutes.AgentPackage}?type=zip", skipTlsVerify),
|
||||
_ => BuildMsiScript(baseUrl, token!, $"{baseUrl}{ApiRoutes.AgentPackage}?type=msi", skipTlsVerify),
|
||||
};
|
||||
|
||||
return Results.Text(script, "text/plain; charset=utf-8");
|
||||
@@ -88,10 +90,13 @@ public static class InstallEndpoints
|
||||
private static string ResolveBaseUrl(HttpContext context, IConfiguration configuration)
|
||||
=> Backend.Proxy.PublicUrl.Resolve(context, configuration);
|
||||
|
||||
// The PS5.1-safe global callback is used instead of -SkipCertificateCheck
|
||||
// (PowerShell 7 only) so the same script works everywhere.
|
||||
// Covers both PowerShell generations: 7+ ignores ServicePointManager
|
||||
// (iwr/irm ride HttpClient and need -SkipCertificateCheck, applied here
|
||||
// as a wildcard default so the whole script inherits it), while 5.1
|
||||
// needs the global callback.
|
||||
private const string PsSkipVerify =
|
||||
"[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }";
|
||||
"if ($PSVersionTable.PSVersion.Major -ge 6) { $PSDefaultParameterValues['*:SkipCertificateCheck'] = $true } " +
|
||||
"else { [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true } }";
|
||||
|
||||
// NOTE: $$""" — interpolations are {{ }}, single braces are literal PowerShell.
|
||||
private static string BuildMsiScript(string baseUrl, string token, string packageUrl, bool skipVerify) => $$"""
|
||||
|
||||
@@ -23,6 +23,12 @@ using Shared.Contracts.Serialization;
|
||||
using Shared.Infrastructure.Logging;
|
||||
using Shared.Infrastructure.Versioning;
|
||||
|
||||
// Corporate proxies: all outbound HTTP (S3, OIDC, secrets providers, the
|
||||
// nats-server download) honors the system/environment proxy and
|
||||
// authenticates to it with the process account's default credentials.
|
||||
// Harmless when no proxy is configured.
|
||||
System.Net.Http.HttpClient.DefaultProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
|
||||
|
||||
// CLI mode: NATS operator/account key generation for the resolver.
|
||||
if (args.Length > 0 && args[0] == "nats-auth")
|
||||
{
|
||||
|
||||
@@ -20,8 +20,22 @@ RUN dotnet publish src/Backend/Backend.csproj -c Release -o /app --no-restore \
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
|
||||
ARG UNIFIED_VERSION=0.0.0.0
|
||||
LABEL org.opencontainers.image.title="Control Plane Backend" \
|
||||
org.opencontainers.image.version="${UNIFIED_VERSION}"
|
||||
# CI supplies these at image build time (empty on plain local builds).
|
||||
ARG GIT_COMMIT=""
|
||||
ARG GIT_COMMIT_SHORT=""
|
||||
ARG BUILD_DATE=""
|
||||
ARG SOURCE_URL="https://prod.git.gracesolution.info/gsadmin/ExecuteR"
|
||||
LABEL org.opencontainers.image.title="ExecuteR Control Plane Backend" \
|
||||
org.opencontainers.image.description="ExecuteR control plane: REST API, enrollment, messaging workers and job dispatch" \
|
||||
org.opencontainers.image.version="${UNIFIED_VERSION}" \
|
||||
org.opencontainers.image.revision="${GIT_COMMIT}" \
|
||||
executer.revision.short="${GIT_COMMIT_SHORT}" \
|
||||
org.opencontainers.image.created="${BUILD_DATE}" \
|
||||
org.opencontainers.image.source="${SOURCE_URL}" \
|
||||
org.opencontainers.image.url="${SOURCE_URL}" \
|
||||
org.opencontainers.image.documentation="${SOURCE_URL}/wiki" \
|
||||
org.opencontainers.image.vendor="ExecuteR" \
|
||||
org.opencontainers.image.licenses="AGPL-3.0"
|
||||
|
||||
# curl is used by the compose health check.
|
||||
RUN apt-get update \
|
||||
|
||||
@@ -14,8 +14,22 @@ RUN npm run build && npm prune --omit=dev
|
||||
|
||||
FROM node:24-alpine
|
||||
ARG UNIFIED_VERSION=0.0.0.0
|
||||
LABEL org.opencontainers.image.title="Control Plane WebUI" \
|
||||
org.opencontainers.image.version="${UNIFIED_VERSION}"
|
||||
# CI supplies these at image build time (empty on plain local builds).
|
||||
ARG GIT_COMMIT=""
|
||||
ARG GIT_COMMIT_SHORT=""
|
||||
ARG BUILD_DATE=""
|
||||
ARG SOURCE_URL="https://prod.git.gracesolution.info/gsadmin/ExecuteR"
|
||||
LABEL org.opencontainers.image.title="ExecuteR Control Plane WebUI" \
|
||||
org.opencontainers.image.description="ExecuteR web console: SvelteKit UI for devices, scripts, jobs and settings" \
|
||||
org.opencontainers.image.version="${UNIFIED_VERSION}" \
|
||||
org.opencontainers.image.revision="${GIT_COMMIT}" \
|
||||
executer.revision.short="${GIT_COMMIT_SHORT}" \
|
||||
org.opencontainers.image.created="${BUILD_DATE}" \
|
||||
org.opencontainers.image.source="${SOURCE_URL}" \
|
||||
org.opencontainers.image.url="${SOURCE_URL}" \
|
||||
org.opencontainers.image.documentation="${SOURCE_URL}/wiki" \
|
||||
org.opencontainers.image.vendor="ExecuteR" \
|
||||
org.opencontainers.image.licenses="AGPL-3.0"
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/build ./build
|
||||
|
||||
@@ -130,5 +130,17 @@
|
||||
<enabledValue><decimal value="1" /></enabledValue>
|
||||
<disabledValue><decimal value="0" /></disabledValue>
|
||||
</policy>
|
||||
|
||||
<!-- ProxyUrl (REG_SZ) -->
|
||||
<policy name="ProxyUrl" class="Machine" displayName="$(string.ProxyUrl)"
|
||||
explainText="$(string.ProxyUrl_Help)"
|
||||
key="SOFTWARE\Policies\ExecuteR"
|
||||
presentation="$(presentation.ProxyUrl)">
|
||||
<parentCategory ref="ExecuteR" />
|
||||
<supportedOn ref="SUPPORTED_ExecuteR_1_0" />
|
||||
<elements>
|
||||
<text id="ProxyUrl_Text" valueName="ProxyUrl" required="true" maxLength="2048" />
|
||||
</elements>
|
||||
</policy>
|
||||
</policies>
|
||||
</policyDefinitions>
|
||||
|
||||
@@ -111,6 +111,15 @@ If you disable or do not configure this policy, the agent uses the locally confi
|
||||
|
||||
Do not enable this for servers reached through a proxy with a publicly trusted certificate — leave validation on there. Always follow your organization's security standards.
|
||||
|
||||
The agent reads configuration at service start; restart the "ExecuteR Agent" service (ExecuteRAgent) to apply a change immediately.</string>
|
||||
|
||||
<string id="ProxyUrl">Outbound proxy URL</string>
|
||||
<string id="ProxyUrl_Help">Routes the agent's outbound traffic (enrollment HTTPS and the persistent WebSocket connection) through an explicit proxy, for example http://proxy.example.com:8080.
|
||||
|
||||
If you enable this policy, the agent uses the configured proxy for all outbound connections, authenticating to it with the machine account's default credentials (NTLM/Negotiate).
|
||||
|
||||
If you disable or do not configure this policy, the agent honors the system or environment proxy configuration (HTTP_PROXY/HTTPS_PROXY/NO_PROXY, or the Windows system proxy) — still authenticating with default credentials when the proxy challenges.
|
||||
|
||||
The agent reads configuration at service start; restart the "ExecuteR Agent" service (ExecuteRAgent) to apply a change immediately.</string>
|
||||
</stringTable>
|
||||
|
||||
@@ -138,6 +147,11 @@ The agent reads configuration at service start; restart the "ExecuteR Agent" ser
|
||||
<label>Seconds or hh:mm:ss (default 60):</label>
|
||||
</textBox>
|
||||
</presentation>
|
||||
<presentation id="ProxyUrl">
|
||||
<textBox refId="ProxyUrl_Text">
|
||||
<label>Proxy URL (http://proxy.example.com:8080):</label>
|
||||
</textBox>
|
||||
</presentation>
|
||||
</presentationTable>
|
||||
</resources>
|
||||
</policyDefinitionResources>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<!--
|
||||
ExecuteR Agent MSI.
|
||||
Public properties (uppercase): SERVERURL BOOTSTRAPTOKEN LOGLEVEL
|
||||
ALLOWREMOTESHELL ALLOWSCRIPTEXECUTION SKIPTLSVERIFY.
|
||||
ALLOWREMOTESHELL ALLOWSCRIPTEXECUTION SKIPTLSVERIFY PROXYURL.
|
||||
Remember-property pattern: existing registry values are read back into
|
||||
the properties at install start, so blank properties never overwrite
|
||||
configured values and upgrades preserve configuration.
|
||||
@@ -70,6 +70,12 @@
|
||||
<RegistrySearch Id="ExistingTlsSkipVerify" Root="HKLM"
|
||||
Key="$(var.AgentRegKey)" Name="TlsSkipVerify" Type="raw" />
|
||||
</Property>
|
||||
<!-- PROXYURL: explicit outbound proxy. Unset, the agent honors the
|
||||
system/environment proxy; default credentials either way. -->
|
||||
<Property Id="PROXYURL">
|
||||
<RegistrySearch Id="ExistingProxyUrl" Root="HKLM"
|
||||
Key="$(var.AgentRegKey)" Name="ProxyUrl" Type="raw" />
|
||||
</Property>
|
||||
|
||||
<StandardDirectory Id="ProgramFiles64Folder">
|
||||
<Directory Id="INSTALLFOLDER" Name="ExecuteR Agent">
|
||||
@@ -137,6 +143,10 @@
|
||||
<RegistryValue Root="HKLM" Key="$(var.AgentRegKey)"
|
||||
Name="TlsSkipVerify" Type="integer" Value="[SKIPTLSVERIFY]" KeyPath="yes" />
|
||||
</Component>
|
||||
<Component Id="RegProxyUrl" Guid="4c7d90b5-31af-4e88-9c56-d0b1f2a6e843" Condition="PROXYURL">
|
||||
<RegistryValue Root="HKLM" Key="$(var.AgentRegKey)"
|
||||
Name="ProxyUrl" Type="string" Value="[PROXYURL]" KeyPath="yes" />
|
||||
</Component>
|
||||
|
||||
</ComponentGroup>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
let token = $state('');
|
||||
let tokenId = $state('');
|
||||
let baseUrl = $state('');
|
||||
let selfSignedDirect = $state(false);
|
||||
let skipTlsVerify = $state(false);
|
||||
let errorText = $state('');
|
||||
let busy = $state(false);
|
||||
let regenTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
@@ -31,7 +31,10 @@
|
||||
.serverInfo()
|
||||
.then((info) => {
|
||||
baseUrl = info.baseUrl ?? location.origin;
|
||||
selfSignedDirect = info.selfSignedDirect ?? false;
|
||||
// Pre-select only while the server serves its self-signed chain
|
||||
// directly; the operator decides either way (a proxy added later
|
||||
// should not leave agents skipping verification needlessly).
|
||||
skipTlsVerify = info.selfSignedDirect ?? false;
|
||||
})
|
||||
.catch(() => (baseUrl = location.origin));
|
||||
|
||||
@@ -90,13 +93,15 @@
|
||||
|
||||
const command = $derived.by(() => {
|
||||
if (!token || !baseUrl) return '';
|
||||
const install = `${baseUrl}/api/enrollment/install?token=${token}`;
|
||||
// Self-signed direct serving: the fetch itself must skip verification
|
||||
// (the install script then configures the agent the same way). The
|
||||
// skipVerify=1 makes the served script configure the agent's
|
||||
// TlsSkipVerify too; the fetch itself gets the same treatment. The
|
||||
// hop is still encrypted — the roots just aren't distributed.
|
||||
const curl = selfSignedDirect ? 'curl -fsSLk' : 'curl -fsSL';
|
||||
const psPrefix = selfSignedDirect
|
||||
? '[Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }; '
|
||||
const install = `${baseUrl}/api/enrollment/install?token=${token}${skipTlsVerify ? '&skipVerify=1' : ''}`;
|
||||
const curl = skipTlsVerify ? 'curl -fsSLk' : 'curl -fsSL';
|
||||
// PS7's iwr/irm need -SkipCertificateCheck (set as a wildcard default
|
||||
// so the fetched script inherits it too); PS5.1 needs the callback.
|
||||
const psPrefix = skipTlsVerify
|
||||
? "if ($PSVersionTable.PSVersion.Major -ge 6) { $PSDefaultParameterValues['*:SkipCertificateCheck'] = $true } else { [Net.ServicePointManager]::ServerCertificateValidationCallback = { $true } }; "
|
||||
: '';
|
||||
switch (platform) {
|
||||
case 'windows':
|
||||
@@ -176,6 +181,11 @@
|
||||
</label>
|
||||
</div>
|
||||
{/if}
|
||||
<label class="radio">
|
||||
<input type="checkbox" bind:checked={skipTlsVerify} />
|
||||
Skip TLS verification
|
||||
<span class="faint">(self-signed server without a proxy — traffic stays encrypted)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{#if errorText}
|
||||
|
||||
@@ -17,14 +17,16 @@
|
||||
let busy = $state(false);
|
||||
let copied = $state(false);
|
||||
let copiedCmd = $state(false);
|
||||
let skipTlsVerify = $state(false);
|
||||
|
||||
// PUBLIC_SERVER_URL (or trusted forwarded headers) beats the browser's own
|
||||
// origin, so the command works even when the admin browses via an internal
|
||||
// hostname the target devices cannot reach. Direct self-signed serving
|
||||
// prefixes a PS5-safe skip-verify (the hop is still encrypted).
|
||||
// hostname the target devices cannot reach. Skip-verify is an operator
|
||||
// choice (pre-selected only while serving the self-signed chain directly);
|
||||
// the hop stays encrypted either way.
|
||||
const installCommand = $derived(
|
||||
newToken?.token
|
||||
? `${serverInfo?.selfSignedDirect ? '[Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }; ' : ''}iwr ${serverInfo?.baseUrl ?? location.origin}/api/enrollment/install?token=${newToken.token} -UseBasicParsing | iex`
|
||||
? `${skipTlsVerify ? "if ($PSVersionTable.PSVersion.Major -ge 6) { $PSDefaultParameterValues['*:SkipCertificateCheck'] = $true } else { [Net.ServicePointManager]::ServerCertificateValidationCallback = { $true } }; " : ''}iwr ${serverInfo?.baseUrl ?? location.origin}/api/enrollment/install?token=${newToken.token}${skipTlsVerify ? '&skipVerify=1' : ''} -UseBasicParsing | iex`
|
||||
: ''
|
||||
);
|
||||
|
||||
@@ -36,7 +38,10 @@
|
||||
void refresh();
|
||||
void api
|
||||
.serverInfo()
|
||||
.then((info) => (serverInfo = info))
|
||||
.then((info) => {
|
||||
serverInfo = info;
|
||||
skipTlsVerify = info.selfSignedDirect ?? false;
|
||||
})
|
||||
.catch(() => (serverInfo = null));
|
||||
});
|
||||
|
||||
@@ -129,6 +134,10 @@
|
||||
<div class="install-block pulse-in">
|
||||
<div class="muted">Deploy on a target device (run in an elevated PowerShell):</div>
|
||||
<div class="install-cmd mono">{installCommand}</div>
|
||||
<label class="faint small">
|
||||
<input type="checkbox" bind:checked={skipTlsVerify} />
|
||||
Skip TLS verification (self-signed server without a proxy — traffic stays encrypted)
|
||||
</label>
|
||||
<button class="btn" onclick={copyCommand}>{copiedCmd ? '✔ Copied' : 'Copy command'}</button>
|
||||
<div class="faint small">
|
||||
Requires Agent.msi in the backend’s AGENT_PACKAGE_PATH. Also usable:
|
||||
|
||||
@@ -82,9 +82,23 @@ public class AgentConfigurationTests
|
||||
Assert.False(config.AllowRemoteShell.Value);
|
||||
Assert.True(config.AllowScriptExecution.Value);
|
||||
Assert.False(config.TlsSkipVerify.Value);
|
||||
Assert.Null(config.ProxyUrl.Value);
|
||||
Assert.Equal("Information", config.LogLevel.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProxyUrlFollowsStringPrecedence()
|
||||
{
|
||||
registry.SetString(Branding.AgentRegistryKey, AgentConfigurationKeys.ProxyUrl, "http://local-proxy:8080");
|
||||
var local = new AgentConfigurationLoader(registry, allowEnvironment: false).Load();
|
||||
Assert.Equal("http://local-proxy:8080", local.ProxyUrl.Value);
|
||||
|
||||
registry.SetString(Branding.AgentPolicyRegistryKey, AgentConfigurationKeys.ProxyUrl, "http://gpo-proxy:8080");
|
||||
var policy = new AgentConfigurationLoader(registry, allowEnvironment: false).Load();
|
||||
Assert.Equal("http://gpo-proxy:8080", policy.ProxyUrl.Value);
|
||||
Assert.True(policy.ProxyUrl.IsPolicyControlled);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TlsSkipVerifyFollowsDwordPrecedence()
|
||||
{
|
||||
|
||||
@@ -128,36 +128,30 @@ public class InstallScriptTests(BackendTestFixture fixture) : IClassFixture<Back
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DirectSelfSignedServingAddsSkipVerifyEverywhere()
|
||||
public async Task SkipVerifyIsAnOperatorChoicePerRequest()
|
||||
{
|
||||
// HTTPS with TLS_SELF_SIGNED on and no forwarded headers = an agent
|
||||
// talking straight to the self-signed listener: every install path
|
||||
// must skip verification and configure the agent to keep doing so.
|
||||
var certDir = Path.Combine(
|
||||
Path.GetTempPath(), "executer-tls-tests", Guid.NewGuid().ToString("N"));
|
||||
await using var factory = fixture.WithWebHostBuilder(builder =>
|
||||
{
|
||||
builder.UseSetting("TLS_SELF_SIGNED", "1");
|
||||
builder.UseSetting("TLS_CERT_DIR", certDir);
|
||||
});
|
||||
using var client = factory.CreateClient(
|
||||
new WebApplicationFactoryClientOptions { BaseAddress = new Uri("https://localhost") });
|
||||
// &skipVerify=1 is the operator opting in (the modal checkbox);
|
||||
// every install path then skips verification and configures the
|
||||
// agent to keep doing so. Without the parameter nothing is inferred
|
||||
// — a self-signed server that later gains a proxy must not leave
|
||||
// agents skipping validation needlessly.
|
||||
using var client = fixture.CreateClient();
|
||||
|
||||
var msi = await (await client.GetAsync("/api/enrollment/install?token=t")).Content.ReadAsStringAsync();
|
||||
Assert.Contains("ServerCertificateValidationCallback", msi);
|
||||
var msi = await (await client.GetAsync("/api/enrollment/install?token=t&skipVerify=1")).Content.ReadAsStringAsync();
|
||||
Assert.Contains("ServerCertificateValidationCallback", msi); // PS 5.1 path
|
||||
Assert.Contains("SkipCertificateCheck", msi); // PS 7 path
|
||||
Assert.Contains("SKIPTLSVERIFY=1", msi);
|
||||
|
||||
var zip = await (await client.GetAsync("/api/enrollment/install?token=t&type=zip")).Content.ReadAsStringAsync();
|
||||
var zip = await (await client.GetAsync("/api/enrollment/install?token=t&type=zip&skipVerify=1")).Content.ReadAsStringAsync();
|
||||
Assert.Contains("ServerCertificateValidationCallback", zip);
|
||||
Assert.Contains("TlsSkipVerify", zip);
|
||||
|
||||
var bash = await (await client.GetAsync("/api/enrollment/install?token=t&type=linux")).Content.ReadAsStringAsync();
|
||||
var bash = await (await client.GetAsync("/api/enrollment/install?token=t&type=linux&skipVerify=1")).Content.ReadAsStringAsync();
|
||||
Assert.Contains("curl -fsSLk", bash);
|
||||
Assert.Contains("--skip-tls-verify", bash);
|
||||
|
||||
// Plain HTTP (the fixture default) stays clean.
|
||||
using var plain = fixture.CreateClient();
|
||||
var script = await (await plain.GetAsync("/api/enrollment/install?token=t")).Content.ReadAsStringAsync();
|
||||
Assert.DoesNotContain("ServerCertificateValidationCallback", script);
|
||||
var plain = await (await client.GetAsync("/api/enrollment/install?token=t")).Content.ReadAsStringAsync();
|
||||
Assert.DoesNotContain("ServerCertificateValidationCallback", plain);
|
||||
Assert.DoesNotContain("SKIPTLSVERIFY", plain);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public class JobPipelineIntegrationTests
|
||||
AllowRemoteShell = new(false, ConfigurationSource.Default),
|
||||
AllowScriptExecution = new(true, ConfigurationSource.Default),
|
||||
TlsSkipVerify = new(false, ConfigurationSource.Default),
|
||||
ProxyUrl = new(null, ConfigurationSource.Default),
|
||||
};
|
||||
|
||||
private sealed class FixedIdentity : IHardwareIdentitySource
|
||||
|
||||
Reference in New Issue
Block a user