Hey guys,
I am getting errors when adding my server certificate for inbound inspection using the R80.40 API. Here is the output:
{
"code" : "err_server_certificate_operation_failed",
"message" : "Certificate import failed. Make sure the encoded certificate is valid and the password matches that of the certificate."
}
I created a simple shell script to test. Here is what I'm using:
PASS='Ctm2AEhEvYh359+9DJKw4-r7' #Not my real pass, just a random one. Also tried without symbols, no luck
PASSBASE64=$(echo $PASS | base64)
openssl pkcs12 -export -in cert.pem -inkey privkey.pem -certfile fullchain.pem -out server.p12 -passout pass:${PASS}
#I also tried with -certfile chain.pem and without -certfile. No luck
CERTBASE64=$(base64 -w 0 server.p12) # -w 0 to disable line wrapping
curl -k -X POST https://10.0.0.200/web_api/add-server-certificate -H 'Content-Type: application/json' -H "X-chkp-sid: ${SID}" -d "{ \"name\":\"myserver202008\", \"base64-certificate\":\"${CERTBASE64}\",\"base64-password\":\"${PASSBASE64}\" }"
#Not my real IP
I did the reverse process to the certificate in the documentation example and it seems to be correct, but when I try to add the certificate to my managemente, I get a different error:
{
"code" : "generic_error",
"message" : "Runtime error: An internal error has occurred."
}
Does anybody see what is going wrong?
Is it correct to convert the P12 cert using base64 command or should I encode the file using "openssl base64" command?