fix(server): keep Windows secrets private and the service out of user folders

On Windows the data folder sits in %ProgramData%, whose ACL let every local
user read the database, the password-less TLS key and the temporary admin
password, and create a server.json the LocalSystem service would load
(SRS-02, SRV-2). The folder now gets a protected DACL (SYSTEM,
Administrators, the server's account) at every start when it names anyone
else, which also replaces what the files inside inherited; server.pfx and
initial-admin-password.txt are written with their own protected DACL, and
with mode 0600 elsewhere. A folder whose ACL cannot be changed stops the
start with a clear message.

--install-service registered a LocalSystem service from any folder, so a
per-user install or an unpacked zip handed SYSTEM to that user (SRS-06). It
now refuses, with a localized one-line reason, unless the program folder is
inside Program Files and no account besides SYSTEM, Administrators,
TrustedInstaller or the registering administrator can change it or any file
below it (under dotnet, the host's folder too).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 09:27:06 +00:00
1 parent c11c996bc6
commit 047cddfe7b
10 files changed
+398 -10

No files matched your search

+2
View File
@@ -108,6 +108,8 @@
<data name="Server.Role.Uploader" xml:space="preserve"><value>Uploader</value></data>
<data name="Server.Role.Viewer" xml:space="preserve"><value>Viewer</value></data>
<data name="Server.Service.Description" xml:space="preserve"><value>Titano time-lapse archive, uploads, jobs and rendering server.</value><comment>long</comment></data>
<data name="Server.Service.NotProgramFiles" xml:space="preserve"><value>Titano Server is not in Program Files ({0}), so it cannot run as a service; install it for all users and register the service from there.</value><comment>long</comment></data>
<data name="Server.Service.Writable" xml:space="preserve"><value>Users who are not administrators can change {0}, so Titano Server cannot run as a service from there; reinstall it for all users and register the service again.</value><comment>long</comment></data>
<data name="Server.Setting.Aspect" xml:space="preserve"><value>Aspect</value></data>
<data name="Server.Setting.Auto" xml:space="preserve"><value>auto</value></data>
<data name="Server.Setting.Batch" xml:space="preserve"><value>Batch list</value></data>
+2
View File
@@ -106,6 +106,8 @@
<data name="Server.Role.Uploader" xml:space="preserve"><value>Caricatore</value></data>
<data name="Server.Role.Viewer" xml:space="preserve"><value>Visualizzatore</value></data>
<data name="Server.Service.Description" xml:space="preserve"><value>Server Titano per archivio time-lapse, caricamenti, job e rendering.</value></data>
<data name="Server.Service.NotProgramFiles" xml:space="preserve"><value>Titano Server non è in Programmi ({0}), quindi non può funzionare come servizio; installalo per tutti gli utenti e registra il servizio da lì.</value></data>
<data name="Server.Service.Writable" xml:space="preserve"><value>Anche utenti non amministratori possono modificare {0}, quindi Titano Server non può funzionare come servizio da lì; reinstallalo per tutti gli utenti e registra di nuovo il servizio.</value></data>
<data name="Server.Setting.Aspect" xml:space="preserve"><value>Proporzioni</value></data>
<data name="Server.Setting.Auto" xml:space="preserve"><value>auto</value></data>
<data name="Server.Setting.Batch" xml:space="preserve"><value>Elenco batch</value></data>