====== PAN-OS API Certificates ======
Prefix all commands with
https://10.1.1.1/api/?key=API_KEY
=====Certificates=====
RSA Algorithm Options
* 512
* 1024
* 2048
* 3072
* 4096
ECDSA Algorithm Options
* 256
* 384
Digest Options
* md5
* sha1
* sha256
* sha384
* sha512
=====Generate Certificates=====
====Generate Certificate Signing Request (Not CA====
&type=op&cmd=sha2562048270externalFW-01.example.localFW-011.1.1.1CERT_MGT_FW-01FW-01.example.local
====Generate Certificate Signing Request (CA====
&type=op&cmd=yessha2562048270externalFW-01.example.localFW-011.1.1.1CERT_MGT_FW-CAFW-01.example.local
====Generate Certificate (Not CA) Using CA on Firewall====
&type=op&cmd=sha2562048270GPCERTFW-01.example.localFW-011.1.1.1SelfSignedNotCAFW-01.example.local
====Generate Certificate (Subordinate CA) Using CA on Firewall====
&type=op&cmd=yessha2562048270GPCERTFW-01.example.localFW-011.1.1.1SubCAFW-01.example.local
====Generate Certificate (CA) Self Signed====
&type=op&cmd=yessha2562048270FW-01.example.localFW-011.1.1.1SelfSignedCAFW-01.example.local
====Show Certificate Details====
&type=op&cmd=CERTIFICATE_NAME
====Set Trust and Untrust Certificates====
===Shared===
In this example, the certificates are DECRYPT and DECRYPECDSA. Delete the ECDSA or RSA elements as required.
&type=config&action=set&xpath=/config/shared&element=DECRYPTDECRYPTECDSADECRYPTDECRYPTECDSA
===VSYS===
In this example, the certificates are DECRYPT and DECRYPECDSA. Delete the ECDSA or RSA elements as required.
&type=config&action=set&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']&element=DECRYPTDECRYPTECDSADECRYPTDECRYPTECDSA
=====Export Certificates=====
For Panorama, currently I import/export all certificates to Panorama (mgmt) itself and then load partial to copy the signed certificates into specific templates. The 'import' and 'export' commands do not have a documented way of interfacing with Templates directly.
====Export Certificate Signing Request====
&type=export&category=certificate&certificate-name=CERT_MGT_FW-01&format=pkcs10&include-key=no
You can add the following to cURL to send to a file
> CSR_FILE.csr
====Export Certificate (Public Key Only====
&type=export&category=certificate&certificate-name=CERTIFICATE_NAME&format=pem&include-key=no
You can add the following to cURL to send to a file
> CERTIFICATE_PUB_ONLY.crt
====Export Certificate (Public and Private Key====
&type=export&category=certificate&certificate-name=CERTIFICATE_NAME&format=pem&include-key=yes&passphrase=the_passphrase
You can add the following to cURL to send to a file
> CERTIFICATE_WITH_KEY.crt
=====Import Certificates=====
Remember to put the following cURL command before the HTTPS request
curl --insecure --form file=@cert.pem
====Import Certificate (Signed Public Certificate Base64====
&type=import&category=certificate&format=pem&certificate-name=ImportedCert
====Import Certificate (Password Protected Public Key Only====
&type=import&category=certificate&format=pem&passphrase=password&certificate-name=ImportedCert
====Import Certificate (Password Protected Public and Private Key====
&type=import&category=keypair&format=pem&passphrase=password&certificate-name=ImportedCert
====Import Private Key (Where Public Key Already Imported====
&type=import&category=private-key&format=pem&passphrase=password&certificate-name=ImportedCert
=====Panorama=====
====Load Panorama Certificate into Template (VSYS Specific====
&type=op&cmd=running-config.xml/config/panorama/certificate/entry[@name='CERTIFICATE_NAME']/config/devices/entry[@name='localhost.localdomain']/template/entry[@name='TEMPLATE_NAME']/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/certificate/entry[@name='CERTIFICATE_NAME']merge
====Load Panorama Certificate into Template (Shared====
&type=op&cmd=running-config.xml/config/panorama/certificate/entry[@name='CERTIFICATE_NAME']/config/devices/entry[@name='localhost.localdomain']/template/entry[@name='TEMPLATE_NAME']/config/shared/certificate/entry[@name='CERTIFICATE_NAME']merge
====HA Certificates====
===Import HA Key===
curl --insecure --form file=@haKey.txt "&type=import&category=high-availability-key"