Files
mtusi2026lab7/scripts/init-env.ps1
T

11 lines
550 B
PowerShell

$ErrorActionPreference = 'Stop'
Set-Location (Split-Path -Parent $PSScriptRoot)
if (!(Test-Path -LiteralPath secrets)) {
New-Item -ItemType Directory -Path secrets | Out-Null
$identity = [Security.Principal.WindowsIdentity]::GetCurrent().User.Value
icacls.exe secrets /inheritance:r /grant:r "*${identity}:(OI)(CI)F" "*S-1-5-18:(OI)(CI)F" | Out-Null
if ($LASTEXITCODE -ne 0) { throw 'Could not restrict the local private directory' }
}
py -3 scripts/init_env.py
if ($LASTEXITCODE -ne 0) { throw 'PKI/configuration bootstrap failed' }