Finalize Assignment 7 evidence and local manual builds (refs #19)
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good

This commit is contained in:
2026-10-28 16:23:42 -04:00
parent 34c4c7488a
commit 4d1996c0ab
11 changed files with 271 additions and 50 deletions
+39
View File
@@ -0,0 +1,39 @@
param(
[Parameter(Mandatory)][string]$NetworkDescription,
[string]$OutputDirectory = 'build/evidence/assignment7-port-tests'
)
# Run on an external Windows client, outside the droplet's SSH session.
# Use a generic network description; do not include a personal address or SSID.
$targets = @('147.182.178.136', '2604:a880:400:d1:0:5:22d:6001')
$results = @()
foreach ($target in $targets) {
foreach ($port in @(443, 80, 3000, 3001, 8080, 9090, 9100, 9115, 50000)) {
Write-Host "Testing $target port $port..."
$test = Test-NetConnection -ComputerName $target -Port $port `
-InformationLevel Detailed -WarningAction SilentlyContinue
$reachable = [bool]$test.TcpTestSucceeded
$expected = $port -in @(80, 443)
$result = [pscustomobject]@{
TimeUTC = (Get-Date).ToUniversalTime().ToString('o')
Network = $NetworkDescription
Target = $target
Port = $port
ExpectedReachable = $expected
TcpTestSucceeded = $reachable
Result = if ($port -eq 443 -and !$reachable) {
'INCONCLUSIVE: HTTPS control failed'
} elseif ($reachable -eq $expected) { 'MATCH' } else { 'UNEXPECTED' }
}
$results += $result
$result | Format-Table Target, Port, TcpTestSucceeded, Result -AutoSize
if ($port -eq 443 -and !$reachable) {
Write-Host 'Skipping remaining ports for this address.'
break
}
}
}
New-Item -ItemType Directory -Force -Path $OutputDirectory | Out-Null
$file = Join-Path $OutputDirectory ("ports-{0}.csv" -f (Get-Date -Format 'yyyyMMdd-HHmmss'))
$results | Export-Csv -LiteralPath $file -NoTypeInformation
Write-Host "Results saved to $file"