Ariadne 0.1.7: system-wide collision policy is runtime-switchable

Feature. The daemon now hot-reloads C:\ProgramData\Ariadne\policy.json every
5 s (fs.stat mtime check, only opens the file when it actually changed) and
flips its DNS collision policy between bcnr-first and icann-first in place.
Every browser on the machine follows within seconds -- no daemon restart,
no reinstall, no UAC. The next Ariadne panel in Theseus will edit this file
directly; a text editor works too.

install.ps1 seeds the file with the current -Policy default on FIRST install
only (an upgrade never clobbers a user's later flip) and grants BUILTIN\Users
Modify on it so an unprivileged app can rewrite it. Invalid values keep the
last good policy (logged). File deleted -> daemon falls back to the CLI
policy the scheduled task was registered with.

Also fixes an intermittent "config unreadable" on daemon startup when
ariadne.config.json had a UTF-8 BOM -- same class of PS-writes-BOM bug 0.1.6
fixed in the TLD-sync path, this time in bnsd.js's own config loader.

Verified live on this box with a second daemon running on port 15353:
  bnsd policy: bcnr-first -> icann-first (from C:\ProgramData\Ariadne\policy.json)
  bnsd policy: icann-first -> bcnr-first (from C:\ProgramData\Ariadne\policy.json)
  bnsd policy: ... has invalid policy 'cash-first' -- keeping bcnr-first
ACL check: BUILTIN\Users has Modify on policy.json, non-elevated write succeeds.

Deployed
- dl.silentmode.st/AriadneResolver-Setup-0.1.7.exe
- s3://bns/silentmode/dl/AriadneResolver-Setup-0.1.7.exe
- silentmode.st manifest advertises 0.1.7
- sha256 742f8005c2dfb47929287c009cddf7738f0d12bd56fb8f8a837df3e9b435f47f

Theseus UI wiring for this file NOT touched -- settings-preload.js has 31
lines of uncommitted work from another session; a Theseus panel selector
belongs in that session's next commit so it doesn't collide.
This commit is contained in:
Local Dev 2026-09-28 01:18:47 +02:00
parent 9c8b2bfafe
commit 0a698d58d6

View file

@ -38,6 +38,25 @@ $LogDir = Join-Path $env:ProgramData 'Ariadne'
try { New-Item -ItemType Directory -Force -Path $LogDir | Out-Null } catch {}
$LogFile = Join-Path $LogDir 'install.log'
$ErrFile = Join-Path $LogDir 'install-error.log'
# Collision-policy override, hot-reloaded by the daemon and edited from the
# Ariadne's Thread panel in Theseus. Seed with the -Policy install-time choice
# ONLY on first install so an upgrade doesn't clobber a user's later flip;
# grant BUILTIN\Users Modify so Theseus can rewrite it without a UAC prompt.
$PolicyFile = Join-Path $LogDir 'policy.json'
if (-not (Test-Path $PolicyFile)) {
$seed = if ($Policy -eq 'bns-first') { 'bcnr-first' } else { $Policy }
ConvertTo-Json @{ policy = $seed } | Set-Content -Path $PolicyFile -Encoding utf8
}
try {
$acl = Get-Acl $PolicyFile
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule(
[System.Security.Principal.SecurityIdentifier]::new('S-1-5-32-545'), # BUILTIN\Users
'Modify','Allow')
$acl.SetAccessRule($rule)
Set-Acl -Path $PolicyFile -AclObject $acl
} catch {}
try { Start-Transcript -Path $LogFile -Append -Force -IncludeInvocationHeader | Out-Null } catch {}
Write-Host ""
Write-Host ("==== install.ps1 " + (Get-Date -Format 's') + " Mode=$Mode Policy=$Policy Indexer=$Indexer ====")