forked from mtusi2026/mtusi2026lab7
Модель угроз, worker bounds и полный TLS аудит
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$EnvFile = '.env',
|
||||
[string]$BaseUrl = 'https://localhost:8443',
|
||||
[string]$Python = 'python',
|
||||
[switch]$SkipWorkerUnitTests,
|
||||
[switch]$SkipPublicSecurity,
|
||||
[switch]$IncludeFreshOpenBaoPolicy
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Set-Location (Join-Path $PSScriptRoot '..')
|
||||
|
||||
& "$PSScriptRoot\test-mtls.ps1" -EnvFile $EnvFile
|
||||
if($LASTEXITCODE -ne 0){ throw 'LB-to-API mTLS audit failed' }
|
||||
|
||||
if(-not $SkipPublicSecurity) {
|
||||
$ca = (Resolve-Path 'secrets\pki\public-ca\ca.crt').Path
|
||||
& $Python tests/security.py --base-url $BaseUrl --ca-file $ca
|
||||
if($LASTEXITCODE -ne 0){ throw 'Public TLS/ACL negative audit failed' }
|
||||
}
|
||||
|
||||
# Includes server CA/hostname checks for every declared internal TLS endpoint,
|
||||
# no-cert/foreign-CA checks, DB/Redis/RabbitMQ ACLs and exact role gateways.
|
||||
& "$PSScriptRoot\test-internal-tls.ps1" -EnvFile $EnvFile
|
||||
if($LASTEXITCODE -ne 0){ throw 'Internal TLS/ACL audit failed' }
|
||||
|
||||
& docker compose --env-file $EnvFile --profile verification run --rm private-bucket-check
|
||||
if($LASTEXITCODE -ne 0){ throw 'MinIO private-bucket/API-worker ACL audit failed' }
|
||||
|
||||
& "$PSScriptRoot\test-openbao-runtime-boundaries.ps1" -EnvFile $EnvFile -SkipLivePolicy
|
||||
if($LASTEXITCODE -ne 0){ throw 'OpenBao runtime-boundary audit failed' }
|
||||
if($IncludeFreshOpenBaoPolicy) {
|
||||
# SecretID deliberately has a 24 h TTL. Never substitute an operator/root
|
||||
# token when it expires: refresh it through the documented bootstrap first.
|
||||
& "$PSScriptRoot\test-openbao-policies.ps1" -EnvFile $EnvFile
|
||||
if($LASTEXITCODE -ne 0){ throw 'OpenBao policy audit failed; refresh the scoped AppRole SecretID' }
|
||||
} else {
|
||||
Write-Host 'INFO: scoped OpenBao allow/deny test skipped; pass -IncludeFreshOpenBaoPolicy after refreshing the 24 h AppRole SecretID.'
|
||||
}
|
||||
|
||||
& "$PSScriptRoot\test-worker-resource-bounds.ps1" -EnvFile $EnvFile `
|
||||
-SkipUnitTests:$SkipWorkerUnitTests
|
||||
if($LASTEXITCODE -ne 0){ throw 'Upload worker resource-bound audit failed' }
|
||||
|
||||
& "$PSScriptRoot\test-telemetry-redaction.ps1" -EnvFile $EnvFile -BaseUrl $BaseUrl
|
||||
if($LASTEXITCODE -ne 0){ throw 'Telemetry redaction audit failed' }
|
||||
|
||||
Write-Host 'PASS: level-4 audit covered the declared TLS matrix, same/foreign/no-cert identity failures, data-plane ACLs, bounded upload worker and end-to-end telemetry non-disclosure.'
|
||||
Reference in New Issue
Block a user