From 11a531003e7bd4c45b9f940c4c2f084eac4fda1a Mon Sep 17 00:00:00 2001 From: nocode Date: Wed, 8 Jul 2026 03:21:02 +0200 Subject: [PATCH] feat(gameboot-windows): add auto-login and game launch task to fws gameboot installer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhance Install-FwsGameboot.ps1 with automatic login and game launch capabilities: - Add -Password parameter for optional auto-login password configuration - Verify prerequisites: local admin account and password requirements - Deploy games.json configuration file alongside scripts - Implement auto-login via Windows registry (AutoAdminLogon settings) - Add scheduled task for auto-launching fws-play at user logon - Tighten file ACLs on deployment directory (SYSTEM/Admins full, Users read-only) - Replace hibernation note with full reboot explanation - Enhance documentation with parameter descriptions and prerequisite validation details - Update user warnings to reflect auto-login kiosk security implications Workflow: boot → auto-login → fws-play launch → game execution → return to FWS. --- .../gameboot-windows/Install-FwsGameboot.ps1 | 110 +++++++++++++----- 1 file changed, 83 insertions(+), 27 deletions(-) diff --git a/configs/releng/airootfs/usr/local/share/fws/gameboot-windows/Install-FwsGameboot.ps1 b/configs/releng/airootfs/usr/local/share/fws/gameboot-windows/Install-FwsGameboot.ps1 index 83b9392..a38f370 100644 --- a/configs/releng/airootfs/usr/local/share/fws/gameboot-windows/Install-FwsGameboot.ps1 +++ b/configs/releng/airootfs/usr/local/share/fws/gameboot-windows/Install-FwsGameboot.ps1 @@ -1,44 +1,100 @@ <# - Install-FwsGameboot.ps1 — installe le composant de RETOUR FWS dans Windows. + Install-FwsGameboot.ps1 — installe le composant de RETOUR + LANCEMENT AUTO. - A lancer UNE FOIS, EN ADMIN, dans le Windows gaming. Deploie les scripts, - desactive l'hibernation/Fast Startup de Windows (pour un reboot PLEIN → NTFS - jamais "sale"), et cree une tache ONSTART (SYSTEM) qui arme le boot suivant - vers FWS des le demarrage — filet anti-crash : si Windows redemarre tout seul - (Windows Update, plantage) sans passer par fws-play, le boot suivant repart - vers FWS. + A lancer UNE FOIS, EN ADMIN, dans le Windows gaming. Met en place le + "sans login, jeu lance tout seul" : + - AUTO-LOGIN du compte gaming (pas d'ecran de mot de passe) ; + - tache AU LOGON qui lance fws-play (lit le jeton, lance le bon jeu, retour) ; + - tache ONSTART qui arme le boot suivant vers FWS (filet anti-crash) ; + - powercfg /h off (reboot PLEIN → NTFS jamais "sale"). - Empreinte minimale et SANS interference avec Vanguard : aucune injection, - aucun pilote/hook noyau — juste des scripts, une tache planifiee et un reglage - d'alimentation. + PREREQUIS VERIFIES par ce script (echec explicite sinon) : + - le compte courant est ADMINISTRATEUR local (bcdedit + taches SYSTEM) ; + - le compte n'a PAS de mot de passe, OU -Password est fourni. + + Empreinte minimale, SANS interference avec Vanguard (aucune injection/hook noyau). + + Parametres : + -Password Mot de passe du compte pour l'auto-login. OMETTRE si le + compte n'a pas de mot de passe. Fourni => stocke EN CLAIR + dans le registre (limitation AutoAdminLogon) : preferer + Sysinternals Autologon.exe (secret LSA chiffre). #> #Requires -RunAsAdministrator +param([string]$Password) $ErrorActionPreference = 'Stop' +# --- Prereq 1 : le compte gaming DOIT etre admin local (SID, locale-independant) --- +try { + $adminGrp = (Get-LocalGroup -SID 'S-1-5-32-544').Name # "Administrators"/"Administrateurs" + $members = Get-LocalGroupMember -Group $adminGrp -ErrorAction Stop + $isAdmin = $members | Where-Object { $_.Name -ieq "$Env:COMPUTERNAME\$Env:USERNAME" -or $_.Name -ieq $Env:USERNAME } +} catch { $isAdmin = $null } +if (-not $isAdmin) { + throw "Le compte '$Env:USERNAME' doit etre ADMINISTRATEUR local : fws-play appelle bcdedit et pilote des taches SYSTEM. Ajoute-le au groupe administrateurs puis relance." +} + +# --- Prereq 2 : auto-login fiable => compte sans mot de passe OU -Password fourni --- +$pwdRequired = $true +try { $pwdRequired = (Get-LocalUser -Name $Env:USERNAME).PasswordRequired } catch { } +if ($pwdRequired -and -not $PSBoundParameters.ContainsKey('Password')) { + throw "Le compte '$Env:USERNAME' exige un mot de passe : relance avec -Password '', ou retire le mot de passe du compte. Sinon l'auto-login echoue -> ecran de connexion -> la boucle gameboot se bloque." +} + +# --- Deploiement des scripts + durcissement ACL (exe potentiellement lance ELEVE) --- $dest = Join-Path $Env:ProgramData 'FWS' New-Item -ItemType Directory -Force -Path $dest | Out-Null -Copy-Item (Join-Path $PSScriptRoot 'fws-return.ps1') $dest -Force -Copy-Item (Join-Path $PSScriptRoot 'fws-play.ps1') $dest -Force +foreach ($f in 'fws-return.ps1','fws-play.ps1','games.json') { + Copy-Item (Join-Path $PSScriptRoot $f) $dest -Force +} +# SYSTEM + Administrateurs = plein controle ; Utilisateurs = lecture seule ; heritage retire. +& icacls $dest /inheritance:r /grant:r 'SYSTEM:(OI)(CI)F' '*S-1-5-32-544:(OI)(CI)F' '*S-1-5-32-545:(OI)(CI)RX' | Out-Null -# (1) Pas d'hibernation Windows / Fast Startup : reboot PLEIN → volumes propres. +# (1) Reboot PLEIN : pas de Fast Startup → volumes propres. & powercfg /h off 2>$null -# (2) Tache ONSTART (SYSTEM) : armer le boot suivant vers FWS au demarrage. -$action = New-ScheduledTaskAction -Execute 'powershell.exe' ` +# (2) AUTO-LOGIN du compte courant. +$winlogon = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' +Set-ItemProperty $winlogon 'AutoAdminLogon' '1' -Force +Set-ItemProperty $winlogon 'ForceAutoLogon' '1' -Force +Set-ItemProperty $winlogon 'DefaultUserName' $Env:USERNAME -Force +Set-ItemProperty $winlogon 'DefaultDomainName' '.' -Force # '.' = local, immune au renommage +if ($PSBoundParameters.ContainsKey('Password')) { + Set-ItemProperty $winlogon 'DefaultPassword' $Password -Force + Write-Warning "Mot de passe stocke EN CLAIR dans le registre. Preferer Sysinternals Autologon.exe (LSA chiffre)." +} else { + Remove-ItemProperty $winlogon 'DefaultPassword' -ErrorAction SilentlyContinue + Write-Host "Auto-login sans mot de passe stocke (compte sans mot de passe verifie)." +} + +# (3) Tache AU LOGON : lancer fws-play (lit le jeton, lance le jeu, gere le retour). +$playAction = New-ScheduledTaskAction -Execute 'powershell.exe' ` + -Argument ('-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "{0}\fws-play.ps1"' -f $dest) +$playTrigger = New-ScheduledTaskTrigger -AtLogOn -User $Env:USERNAME +$playPrincipal = New-ScheduledTaskPrincipal -UserId $Env:USERNAME -LogonType Interactive -RunLevel Highest +$playSettings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries +Register-ScheduledTask -TaskName 'FWS-Play-OnLogon' -Action $playAction -Trigger $playTrigger ` + -Principal $playPrincipal -Settings $playSettings -Force | Out-Null + +# (4) Tache ONSTART (SYSTEM) : armer le boot suivant vers FWS au demarrage. +# Filet anti-crash : si Windows redemarre seul (WU, plantage) sans fws-play, +# le boot suivant repart vers FWS. fws-play RE-AFFIRME Windows apres lancement +# (gere la course avec cette tache — voir fws-play.ps1). +$retAction = New-ScheduledTaskAction -Execute 'powershell.exe' ` -Argument ('-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "{0}\fws-return.ps1" -Target FWS' -f $dest) -$trigger = New-ScheduledTaskTrigger -AtStartup -$principal = New-ScheduledTaskPrincipal -UserId 'SYSTEM' -LogonType ServiceAccount -RunLevel Highest -$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -Register-ScheduledTask -TaskName 'FWS-Return-OnStart' -Action $action -Trigger $trigger ` - -Principal $principal -Settings $settings -Force | Out-Null +$retTrigger = New-ScheduledTaskTrigger -AtStartup +$retPrincipal = New-ScheduledTaskPrincipal -UserId 'SYSTEM' -LogonType ServiceAccount -RunLevel Highest +$retSettings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries +Register-ScheduledTask -TaskName 'FWS-Return-OnStart' -Action $retAction -Trigger $retTrigger ` + -Principal $retPrincipal -Settings $retSettings -Force | Out-Null Write-Host "" -Write-Host "Composant FWS installe dans $dest et tache 'FWS-Return-OnStart' creee." -ForegroundColor Green +Write-Host "Composant FWS installe dans $dest." -ForegroundColor Green +Write-Host "Auto-login + lancement auto du jeu configures. Flux : boot -> login auto -> jeu." -ForegroundColor Green Write-Host "" Write-Host "RAPPELS IMPORTANTS :" -ForegroundColor Yellow -Write-Host " - NE PAS activer BitLocker (Device Encryption) sans sauvegarder la cle :" -Write-Host " le passage de Secure Boot OFF->ON cote FWS change PCR7 et declencherait" -Write-Host " l'ecran de recuperation BitLocker. (Verifie : manage-bde -status)" -Write-Host " - Pour un lancement AUTO de Valorant : ajouter fws-play.ps1 au demarrage" -Write-Host " de session du compte gaming (autologin), sinon lance-le a la main." -Write-Host " - Vanguard exige Secure Boot + TPM 2.0 + VBS/HVCI : ne les desactive pas." +Write-Host " - POSTE KIOSQUE : auto-login + taches non-UAC => acces physique = bureau admin." +Write-Host " - NE PAS activer BitLocker sans sauvegarder la cle (flip Secure Boot cote FWS" +Write-Host " change PCR7 -> ecran de recuperation). Verifie : manage-bde -status" +Write-Host " - Ne desactive pas Secure Boot / TPM / VBS-HVCI : Vanguard les exige." +Write-Host " - Ajouter des jeux : editer $dest\games.json (id en [a-z0-9_-])."