Skip to content

Commit 3470b9c

Browse files
committed
Fixed a couple minor bugs related to switching profiles when creating new orders that match existing orders.
1 parent e0f0c0b commit 3470b9c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Posh-ACME/Public/New-PACertificate.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ function New-PACertificate {
128128
# - has different SANs
129129
# - has different CSR
130130
# - has different Lifetime
131+
# - has different Profile
131132
$order = Get-PAOrder -Name $Name -Refresh
132133
$oldOrder = $null
133134
$SANs = @($Domain | Where-Object { $_ -ne $Domain[0] }) | Sort-Object
@@ -138,7 +139,8 @@ function New-PACertificate {
138139
('CertKeyLength' -in $psbKeys -and $CertKeyLength -ne $order.KeyLength) -or
139140
($SANs -join ',') -ne (($order.SANs | Sort-Object) -join ',') -or
140141
($csrDetails -and $csrDetails.Base64Url -ne $order.CSRBase64Url ) -or
141-
($LifetimeDays -and $LifetimeDays -ne $order.LifetimeDays) )
142+
($LifetimeDays -and $LifetimeDays -ne $order.LifetimeDays) -or
143+
($Profile -and $Profile -ne $order.Profile) )
142144
{
143145

144146
$oldOrder = $order

Posh-ACME/Public/New-PAOrder.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ function New-PAOrder {
125125

126126
$oldDomains = (@($order.MainDomain) + @($order.SANs) | Sort-Object) -join ','
127127

128-
# skip confirmation if the Domains or KeyLength are different regardless
129-
# of the original order status or if the order is pending but expired
128+
# skip confirmation if the Domains, KeyLength, or Profile are different
129+
# regardless of the original order status or if the order is pending but expired
130130
if ( ($order -and ($KeyLength -ne $order.KeyLength -or
131131
($oldDomains -ne ($Domain | Sort-Object) -join ',') -or
132+
($Profile -and $Profile -ne $order.Profile) -or
132133
($order.status -eq 'pending' -and (Get-DateTimeOffsetNow) -gt ([DateTimeOffset]::Parse($order.expires))) ))) {
133134
# do nothing
134135

0 commit comments

Comments
 (0)