Add SANs section and harden INF SAN parsing
This commit is contained in:
17
certy.ps1
17
certy.ps1
@@ -851,6 +851,11 @@ $infCsrOutputLabel.Enabled = $false
|
||||
$infCsrOutputBox.Enabled = $false
|
||||
$y += $rowHeight + $gap
|
||||
|
||||
Add-Label "SANs (from INF)" $xLabel $y $labelWidth $rowHeight
|
||||
$infSanBox = Add-TextBox $xInput $y $inputWidth 80 $true
|
||||
$infSanBox.ReadOnly = $true
|
||||
$y += 82 + $gap
|
||||
|
||||
$useFqdnBox = Add-CheckBox "Input contains FQDNs (otherwise default zone is appended)" $xInput $y $inputWidth $rowHeight
|
||||
$y += $rowHeight + $gap
|
||||
|
||||
@@ -1049,6 +1054,7 @@ $sectionAnchors = @{
|
||||
}
|
||||
|
||||
$script:infRequests = @()
|
||||
$script:infSans = @()
|
||||
|
||||
foreach ($key in $sectionAnchors.Keys) {
|
||||
$label = $navLabels[$key]
|
||||
@@ -1357,6 +1363,7 @@ function Apply-Layout {
|
||||
$infImportBtn.Left = $xInput + $inputWidthCalc - $buttonWidth
|
||||
$infCsrOutputBox.Width = $inputWidthCalc
|
||||
$infCsrOnlyBox.Width = $inputWidthCalc
|
||||
$infSanBox.Width = $inputWidthCalc
|
||||
$zoneBox.Width = $inputWidthCalc
|
||||
$ipBox.Width = $inputWidthCalc - ($buttonWidth + $buttonGap)
|
||||
$ipRefreshBtn.Left = $xInput + $inputWidthCalc - $buttonWidth
|
||||
@@ -1483,6 +1490,7 @@ $infImportBtn.Add_Click({
|
||||
}
|
||||
|
||||
$script:infRequests = @()
|
||||
$script:infSans = @()
|
||||
$infHosts = @()
|
||||
$subjectRemovedCount = 0
|
||||
|
||||
@@ -1510,18 +1518,25 @@ $infImportBtn.Add_Click({
|
||||
CsrInf = $csrInfPath
|
||||
}
|
||||
$infHosts += $hosts
|
||||
$script:infSans += @($reqData.Sans)
|
||||
if ($reqData.CommonName) {
|
||||
$sanList = if ($reqData.Sans.Count -gt 0) { $reqData.Sans -join ", " } else { "none" }
|
||||
$sanList = if (@($reqData.Sans).Count -gt 0) { (@($reqData.Sans) -join ", ") } else { "none" }
|
||||
& $logAction "INF $($infFile.Name): CN=$($reqData.CommonName); SANs=$sanList"
|
||||
}
|
||||
}
|
||||
|
||||
$infHosts = @($infHosts | Where-Object { $_ } | Sort-Object -Unique)
|
||||
$script:infSans = @($script:infSans | Where-Object { $_ } | Sort-Object -Unique)
|
||||
if ($infHosts.Count -gt 0) {
|
||||
$currentHosts = Split-List $hostsBox.Text
|
||||
$merged = Merge-Hostnames -Existing $currentHosts -NewItems $infHosts
|
||||
$hostsBox.Text = ($merged -join [Environment]::NewLine)
|
||||
}
|
||||
if ($script:infSans.Count -gt 0) {
|
||||
$infSanBox.Text = ($script:infSans -join [Environment]::NewLine)
|
||||
} else {
|
||||
$infSanBox.Text = ""
|
||||
}
|
||||
|
||||
& $logAction "Imported $($infFiles.Count) INF file(s), added $($infHosts.Count) hostname(s)."
|
||||
if ($subjectRemovedCount -gt 0) {
|
||||
|
||||
Reference in New Issue
Block a user