b2aa8a1a13
New TlsSkipVerify agent setting (DWORD, GPO policy key beats local registry, ADMX template included) accepts the server certificate without validation on both the enrollment HTTP call and the NATS websocket — for servers on the managed self-signed chain with no proxy in front; the connection stays fully TLS-encrypted. Set it via configure --skip-tls-verify, the agent MSI SKIPTLSVERIFY=1 property (remember-pattern like the rest), GPO, or the registry directly. The server detects direct self-signed serving (HTTPS + no forwarded headers) and the UI one-liners plus all generated install scripts pick the correct scheme and add the skip-verify bits automatically — PS5-safe callback on Windows, curl -k on unix — and configure the agent to match. Proxied deployments are untouched: agents validate the edge certificate normally. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
49 lines
1.9 KiB
C#
49 lines
1.9 KiB
C#
using Agent.Configuration;
|
|
|
|
namespace Agent.Tests;
|
|
|
|
/// <summary>In-memory IRegistryStore for configuration tests.</summary>
|
|
public sealed class InMemoryRegistryStore : IRegistryStore
|
|
{
|
|
private readonly Dictionary<(string Key, string Name), object> values = new(
|
|
EqualityComparer<(string, string)>.Create(
|
|
(a, b) => string.Equals(a.Item1, b.Item1, StringComparison.OrdinalIgnoreCase)
|
|
&& string.Equals(a.Item2, b.Item2, StringComparison.OrdinalIgnoreCase),
|
|
key => HashCode.Combine(
|
|
key.Item1.ToUpperInvariant(),
|
|
key.Item2.ToUpperInvariant())));
|
|
|
|
public void SetString(string keyPath, string valueName, string value)
|
|
=> values[(keyPath, valueName)] = value;
|
|
|
|
public void SetDword(string keyPath, string valueName, int value)
|
|
=> values[(keyPath, valueName)] = value;
|
|
|
|
public string? ReadString(string keyPath, string valueName)
|
|
=> values.TryGetValue((keyPath, valueName), out var value) ? value as string : null;
|
|
|
|
public int? ReadDword(string keyPath, string valueName)
|
|
=> values.TryGetValue((keyPath, valueName), out var value) && value is int i ? i : null;
|
|
|
|
public void WriteString(string keyPath, string valueName, string value)
|
|
=> values[(keyPath, valueName)] = value;
|
|
|
|
public void WriteDword(string keyPath, string valueName, int value)
|
|
=> values[(keyPath, valueName)] = value;
|
|
|
|
public void DeleteValue(string keyPath, string valueName)
|
|
=> values.Remove((keyPath, valueName));
|
|
|
|
public void DeleteKeyTree(string keyPath)
|
|
{
|
|
foreach (var key in values.Keys.Where(k =>
|
|
k.Key.StartsWith(keyPath, StringComparison.OrdinalIgnoreCase)).ToList())
|
|
{
|
|
values.Remove(key);
|
|
}
|
|
}
|
|
|
|
public bool Contains(string keyPath, string valueName)
|
|
=> values.ContainsKey((keyPath, valueName));
|
|
}
|