Update vCenter-SSL.ps1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env pwsh
|
||||
# -----------------------------------------------------------------------------------
|
||||
# vCenter + Posh-ACME Script (Linux/macOS-safe, HttpClient login)
|
||||
# vCenter + Posh-ACME Script (Linux/macOS-safe, TLS 1.2 enforced)
|
||||
# -----------------------------------------------------------------------------------
|
||||
|
||||
. /opt/idssys/nodemgmt/conf/powerwall/settings.ps1
|
||||
@@ -11,6 +11,11 @@
|
||||
$global:helpme = $null
|
||||
$global:responseBody = $null
|
||||
|
||||
# ----------------------------
|
||||
# Force TLS 1.2 globally
|
||||
# ----------------------------
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
# ----------------------------
|
||||
# Error handler
|
||||
# ----------------------------
|
||||
@@ -87,7 +92,7 @@ $EmailContact = $ACMEEMAIL
|
||||
|
||||
[PSCredential]$Credential = New-Object System.Management.Automation.PSCredential -ArgumentList $VCENTERUSER, (ConvertTo-SecureString $VCENTERPASS -AsPlainText -Force)
|
||||
|
||||
# PowerDNS plugin args (plain string API key!)
|
||||
# PowerDNS plugin args (plain string API key)
|
||||
$pArgs = @{
|
||||
PowerDNSApiHost = $WDNSHOST
|
||||
PowerDNSApiKey = $PDNSAPI
|
||||
@@ -105,12 +110,13 @@ if (-not (Get-Module -ListAvailable -Name Posh-ACME)) {
|
||||
Import-Module Posh-ACME -ErrorAction Stop
|
||||
|
||||
# ----------------------------
|
||||
# Connect to vCenter API using HttpClient (robust)
|
||||
# Connect to vCenter API using HttpClient (TLS 1.2 enforced)
|
||||
# ----------------------------
|
||||
Write-Host "Connecting to vCenter at $vCenterURL ..." -ForegroundColor Cyan
|
||||
|
||||
try {
|
||||
$handler = [System.Net.Http.HttpClientHandler]::new()
|
||||
$handler.SslProtocols = [System.Security.Authentication.SslProtocols]::Tls12
|
||||
$handler.ServerCertificateCustomValidationCallback = { $true }
|
||||
|
||||
$client = [System.Net.Http.HttpClient]::new($handler)
|
||||
|
||||
Reference in New Issue
Block a user