Skip to content

Commit afab8d1

Browse files
add root build-info and scripts for internal signing pipeline
1 parent c2dfd3f commit afab8d1

3 files changed

Lines changed: 110 additions & 0 deletions

File tree

build-info.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
product:
2+
name: Crypt
3+
version: ${TIMESTAMP}
4+
developer: Windows Admins Open Source
5+
identifier: ca.ecuad.crypt
6+
description: BitLocker recovery key escrow to Crypt Server with key rotation support
7+
signing_certificate: EmilyCarrU Intune Windows Enterprise Certificate
8+
postinstall_action: none
9+
install_location: 'C:\Program Files\Crypt'

scripts/postinstall.ps1

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Crypt postinstall script
2+
3+
$installPath = 'C:\Program Files\Crypt'
4+
$configDir = 'C:\ProgramData\ManagedEncryption'
5+
$configFile = Join-Path $configDir 'config.yaml'
6+
7+
Write-Host "Crypt - Post-installation" -ForegroundColor Cyan
8+
9+
# Add to system PATH
10+
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'Machine')
11+
if ($currentPath -notlike "*$installPath*") {
12+
$newPath = "$currentPath;$installPath"
13+
[Environment]::SetEnvironmentVariable('PATH', $newPath, 'Machine')
14+
Write-Host "Added $installPath to system PATH" -ForegroundColor Green
15+
} else {
16+
Write-Host "PATH already configured" -ForegroundColor Cyan
17+
}
18+
19+
# Create config directory
20+
if (-not (Test-Path $configDir)) {
21+
New-Item -ItemType Directory -Path $configDir -Force | Out-Null
22+
Write-Host "Created config directory: $configDir" -ForegroundColor Green
23+
}
24+
25+
# Create logs directory
26+
$logsDir = Join-Path $configDir 'logs'
27+
if (-not (Test-Path $logsDir)) {
28+
New-Item -ItemType Directory -Path $logsDir -Force | Out-Null
29+
}
30+
31+
# Configure from environment variable if set
32+
$serverUrl = [Environment]::GetEnvironmentVariable('CRYPT_ESCROW_SERVER_URL', 'Machine')
33+
if ($serverUrl -and -not (Test-Path $configFile)) {
34+
Write-Host "Configuring Crypt server: $serverUrl" -ForegroundColor Cyan
35+
$config = @"
36+
server:
37+
url: $serverUrl
38+
skip_cert_check: false
39+
40+
escrow:
41+
auto_rotate: true
42+
cleanup_old_protectors: true
43+
key_escrow_interval_hours: 24
44+
validate_key: true
45+
46+
logging:
47+
level: Info
48+
file_path: $configDir\logs\crypt.log
49+
"@
50+
Set-Content -Path $configFile -Value $config -Encoding UTF8
51+
Write-Host "Created config file: $configFile" -ForegroundColor Green
52+
}
53+
54+
# Register scheduled task for automatic key rotation
55+
try {
56+
$cryptExe = Join-Path $installPath 'checkin.exe'
57+
if (Test-Path $cryptExe) {
58+
Write-Host "Registering hourly scheduled task..." -ForegroundColor Cyan
59+
& $cryptExe register-task --frequency hourly 2>&1 | Out-Null
60+
if ($LASTEXITCODE -eq 0) {
61+
Write-Host "Scheduled task registered successfully" -ForegroundColor Green
62+
}
63+
}
64+
} catch {
65+
Write-Host "Could not register scheduled task: $_" -ForegroundColor Yellow
66+
}
67+
68+
Write-Host "`nCrypt installation complete!" -ForegroundColor Green
69+
Write-Host "Usage: checkin --help" -ForegroundColor Cyan
70+
if (-not (Test-Path $configFile)) {
71+
Write-Host "Configure: checkin config set server.url https://your-crypt-server" -ForegroundColor Yellow
72+
}

scripts/preinstall.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Crypt preinstall script
2+
3+
Write-Host "Crypt - Pre-installation checks" -ForegroundColor Cyan
4+
5+
# Check for BitLocker support
6+
try {
7+
$tpm = Get-WmiObject -Namespace "Root\CIMv2\Security\MicrosoftTpm" -Class Win32_Tpm -ErrorAction SilentlyContinue
8+
if ($tpm) {
9+
Write-Host "TPM detected: Ready for BitLocker key escrow" -ForegroundColor Green
10+
} else {
11+
Write-Host "No TPM detected - BitLocker may use password-only mode" -ForegroundColor Yellow
12+
}
13+
} catch {
14+
Write-Host "Could not check TPM status" -ForegroundColor Yellow
15+
}
16+
17+
# Stop any existing scheduled tasks
18+
try {
19+
$task = Get-ScheduledTask -TaskName "Crypt*" -ErrorAction SilentlyContinue
20+
if ($task) {
21+
Write-Host "Stopping existing Crypt scheduled task..." -ForegroundColor Cyan
22+
$task | Stop-ScheduledTask -ErrorAction SilentlyContinue
23+
$task | Unregister-ScheduledTask -Confirm:$false -ErrorAction SilentlyContinue
24+
}
25+
} catch {
26+
# Ignore errors
27+
}
28+
29+
Write-Host "Pre-installation checks complete" -ForegroundColor Green

0 commit comments

Comments
 (0)