18 lines
738 B
PowerShell
18 lines
738 B
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory = $true)][uri]$FrontendUrl,
|
|
[Parameter(Mandatory = $true)][uri]$ApiUrl
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
foreach ($url in @($FrontendUrl, $ApiUrl)) {
|
|
if ($url.Scheme -ne 'https') { throw "HTTPS URL required: $url" }
|
|
$response = Invoke-WebRequest -Uri $url -Method Get -MaximumRedirection 0 -UseBasicParsing
|
|
$hsts = $response.Headers['Strict-Transport-Security']
|
|
if ([string]::IsNullOrWhiteSpace($hsts) -or $hsts -notmatch 'max-age=\d+') {
|
|
throw "HSTS missing or invalid: $url"
|
|
}
|
|
Write-Host "HSTS verified: $($url.Host)"
|
|
}
|
|
Write-Host 'HSTS checks passed. TLS protocol and cipher suite checks require an external TLS scanner against both public hosts.'
|