CCP AIM - Certificate Authentication while running REST API call from Unix

CCP AIM - Certificate Authentication while running REST API call from Unix

91
Created On 11/10/26 11:00 AM - Last Modified 11/10/26 15:57 PM


Objective


API calls to the CCP can be performed directly from a Unix CLI using the 'curl' command.
This article will show an example of how application certificate authentication can be performed with a client certificate presented in the call.
This KB assumes the following:
  1. The client certificate is available with a private key and can be exported from windows
  2. The IIS SSL settings for the AIMWEBService website have been set to "Accept" or "Require"
  3. The certificate SN has been added to the application authentication methods via the PVWA
  4. Certificate authentication has been confirmed to work for the app/certificate combination via Windows (PowerShell or Postman) already


Environment


12.1;12.4;12.6;14.0 Privileged Access Manager (PAM, self-hosted) Central Credential Provider

Procedure


Step 1 - Certificate praperation

In order to use the private certificate with the curl command, we will first need to export it from windows in PKCS#12, and then convert it to three separate parts in pem format (using openssl commands). the parts are: client-certificate, private-key, and ca-certificate.
  1. Export the certificate from windows as a .pfx file. Make sure to select "export the private key", and provide a password.image.png
  2. Once the certificate is exported, transfer it to the Unix host with a tool such as WinSCP image.png
  3. Next, log into the Unix host via ssh, and use the following commands to convert the .pfx certificate into the three .pem files required for the call (provide the certificate password entered in the previous step when prompted): 
    openssl pkcs12 -in cert.pfx -out ca.pem -cacerts -nokeys
    openssl pkcs12 -in cert.pfx -out client.pem -clcerts -nokeys
    openssl pkcs12 -in cert.pfx -nocerts -nodes | openssl rsa -out privkey.pem
  4. We now have 3 new .pem files in our directory to work with: ca.pem, client.pem and privkey.pemimage.png
Step 2 - Making the API call

Now that we have the proper files, we can move on to make the call.
Since the API parameters are specified in the url, all we need to do is add the certificate part in the call as follows:
 
curl -k -v --insecure --cert ./client.pem --key ./privkey.pem 'https://ccp.web.address/aimwebservice/api/accounts?appid=sampleapp&safe=DemoApp&UserName=demo&Address=1.1.1.1'


Or with the CA cert:
 

curl -k -v --cacert ca.pem --cert ./client.pem --key ./privkey.pem 'https://ccp.web.address/aimwebservice/api/accounts?appid=sampleapp&safe=DemoApp&UserName=demo&Address=1.1.1.1'
 

Note-
The -k option enables skipping certificate validation and is good for testing, the command does not require it.
The -v option enables verbose output, and is also not required

Example:
image.png

 

 

 

 


Actions
  • Print
  • Copy Link

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