Unable to invoke REST API when Component Server is hardened

Unable to invoke REST API when Component Server is hardened

124
Created On 11/10/26 10:58 AM - Last Modified 11/10/26 15:56 PM


Symptom


Unable to invoke REST API when Component Server is hardened.
 
PS C:\> Invoke-RestMethod -Uri "https://epvone.cyber-ark.demo/AIMWebService/api/Accounts?AppID=Database&Safe=108_Safe_Database&Object=sql02-sa2" -UseDefaultCredentials
Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.
At line:1 char:1
+ Invoke-RestMethod -Uri "https://epvone.cyber-ark.demo/AIMWebService/a ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand


Environment


10.1;10.2;10.3;10.4;10.5;10.6;10.7;10.8;10.9 PVWA and/or CCP AIMWebService is installed on Windows Server hardened with PVWA_Hardening.ps1.

Cause


Component Server is hardened with TLS 1.2 and causing the connection connection to be closed.

Resolution


Resolution 1 for Powershell 5
Execute REST API using PS1 script with Security Protocol set to TLS 1.2 instead of executing the Powershell command directly.

See syntax below:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Uri $uri
See sample below:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Uri "https://epvone.cyber-ark.demo/AIMWebService/api/Accounts?AppID=Database&Safe=108_Safe_Database&Object=sql02-sa2"

Resolution 2 for Powershell 6
Execute REST API using PS1 script with -SslProtocol flag
See syntax below:
Invoke-RestMethod -SslProtocol Tls1.2 -Uri $uri
See sample below:
Invoke-RestMethod -SslProtocol Tls1.2 -Uri "https://epvone.cyber-ark.demo/AIMWebService/api/Accounts?AppID=Database&Safe=108_Safe_Database&Object=sql02-sa2"


Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj00000012ZPCAY&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail