Hi
I am trying to automate deployment of a new VSX firewall and I am having trouble getting the Checkpoint management server to accept my input. The firewall management is version 80.20 and I have no trouble logging in and getting the session-id. I have made it so that awk reads a file (default-host-objects.csv) containing object-names,ip-address and then executes a cURL command:
My test-script look like this:
cp_api_url="https://mgmt-station.net/web_api"
SID=`curl -s -k -H "Content-Type: application/json" -H "Accept: bla" -X POST "$cp_api_url/login" -d "{\"user\":\"admin-user\",\"password\":"\"admin-password"",\"domain\":\"test-domain\"}" | awk -F\" '/sid/ {print $4}'`
awk -F, -v aSID="$SID" -v cpurl="$cp_api_url" '{ system("curl -k -H \"Content-Type: application/json\" -H \"X-chkp-sid: "aSID"\" -X POST -d \"{ \"name\": \""$1"\", \"ip-address\": \""$2"\" }\" "cpurl"/add-host") }' default-host-objects.csv
The result I get is this:
{
"code" : "generic_err_invalid_syntax",
"message" : "Payload is not a valid JSON"
}
---
I also tried manually to create the objects by these commands:
curl -k -H Content-Type: application/json -H X-chkp-sid: <insert sid> -X POST -d { name: testserver1, ip-address: 1.2.3.4 } https://mgmt-station.net/web_api/add-host
or
curl -k -H "Content-Type: application/json" -H "<insert sid>" -X POST -d "{ "name": "testserver1", "ip-address": "1.2.3.4" }" https://mgmt-station.net/web_api/add-host
Both with the same result:
{
"code" : "generic_err_invalid_syntax",
"message" : "Payload is not a valid JSON"
}
What am I doing wrong?