Update vCenter-SSL.ps1

This commit is contained in:
2025-11-15 20:05:59 -06:00
parent 22472383be
commit a23e855b66

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env pwsh #!/usr/bin/env pwsh
# ----------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------
# vCenter + Posh-ACME Script using PowerCLI (Final Corrected) # vCenter + Posh-ACME Script using PowerCLI (Final Working Version)
# ----------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------
. /opt/idssys/nodemgmt/conf/powerwall/settings.ps1 . /opt/idssys/nodemgmt/conf/powerwall/settings.ps1
@@ -92,7 +92,7 @@ $certName = "vcenter-cert"
$certSuccess = $false $certSuccess = $false
try { try {
Write-Host "Requesting certificate via Posh-ACME..." -ForegroundColor Cyan Write-Host "Requesting certificate via Posh-ACME..." -ForegroundColor Cyan
New-PACertificate -Domain $VCENTERHOST -DnsPlugin PowerDNS -PluginArgs $pArgs -Contact $ACMEEMAIL -AcceptTOS -Verbose -Force New-PACertificate -Domain $VCENTERHOST -DnsPlugin PowerDNS -DnsSleep 15 -PluginArgs $pArgs -Contact $ACMEEMAIL -AcceptTOS -Verbose -Force
$certSuccess = $true $certSuccess = $true
} catch { } catch {
Write-Host "ACME certificate request failed: $($_.Exception.Message)" -ForegroundColor Yellow Write-Host "ACME certificate request failed: $($_.Exception.Message)" -ForegroundColor Yellow
@@ -100,11 +100,12 @@ try {
} }
# ---------------------------- # ----------------------------
# Collect certificate paths # Collect certificate paths dynamically
# ---------------------------- # ----------------------------
if ($certSuccess) { if ($certSuccess) {
$paAccount = Get-PAAccount # Get the folder for this specific domain
$certFolder = $paAccount.CertFolder $certFolder = (Get-PAOrder -Domain $VCENTERHOST).CertFolder
$certPath = Join-Path $certFolder "$certName\cert.pem" $certPath = Join-Path $certFolder "$certName\cert.pem"
$keyPath = Join-Path $certFolder "$certName\privkey.pem" $keyPath = Join-Path $certFolder "$certName\privkey.pem"
$chainPath = Join-Path $certFolder "$certName\chain.pem" $chainPath = Join-Path $certFolder "$certName\chain.pem"