If the info I originally included about versions etc. is incomplete, I could use help to obtain more precise information.
I was trying to use this API call, through the 'uri' module:
https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/add-opsec-application~v1.4%20
================================================================================
My most recent attempts use this playbook with the domain specified.
---
- name: Test CP Access
hosts: checkpoint
connection: httpapi
tasks:
- name: Login
uri:
url: https://10.10.10.45:443/web_api/login
validate_certs: no
method: POST
headers:
Content_Type: "application/json"
body:
"name" : "admin"
"password" : "somepassword"
"domain" : "Lab-Domain"
body_format: json
return_content: yes
================================================================================
I cannot figure out the correct syntax so that I can actually achieve a login. On each attempt, there are errors like this in the api.elg file:
--------------------------------------
2020-05-21 10:49:21,168 ERROR com.checkpoint.management.web_api.utils.LoginRequestValidator.fromStream:47 [qtp-389546900-33] - Request body contains unknown fields or invalid syntax
2020-05-21 10:49:21,172 WARN com.checkpoint.management.web_api_is.utils.helpers.RequestHeadersHelper.getMediaType_aroundBody6:9 [qtp-389546900-33] - No Accept header received. Falling back to default media type [application/json].
2020-05-21 10:49:21,173 ERROR com.checkpoint.management.web_api_is.utils.helpers.ThreadLocalStore$1.initialValue:7 [qtp-389546900-33] - ThreadLocalStore.requestedVersion was requested before initialization! Initializing it with the latest API version: 1.3
2020-05-21 10:49:21,177 INFO org.apache.cxf.interceptor.LoggingInInterceptor.log:250 [qtp-389546900-33] - Inbound Message
----------------------------
ID: 31489
Address: http://127.0.0.1:50276/web_api/login
Encoding: ISO-8859-1
Http-Method: POST
Content-Type: application/json
Headers: {accept-encoding=[identity], connection=[keep-alive], Content-Length=[64], content-type=[application/json], Content_Type=[application/json], Host=[127.0.0.1:50276], User-Agent=[ansible-httpget], X-Chkp-Sid=[], X-Forwarded-For=[10.10.10.120], X-Forwarded-Host=[10.10.10.45:443], X-Forwarded-Host-Port=[443], X-Forwarded-Server=[10.10.10.45]}
--------------------------------------
2020-05-21 10:49:21,181 INFO org.apache.cxf.interceptor.LoggingOutInterceptor.log:250 [qtp-389546900-33] - Outbound Message
---------------------------
ID: 31489
Response-Code: 400
Content-Type: application/json
Headers: {Content-Type=[application/json], Date=[Thu, 21 May 2020 15:49:21 GMT]}
Payload: {
"code" : "generic_err_invalid_syntax",
"message" : "Login request message processing failed"
}
--------------------------------------
================================================================================
Full output from 'api status':
API Settings:
---------------------
Accessibility: Require all granted
Automatic Start: Enabled
Processes:
Name State PID More Information
-------------------------------------------------
API Started 1154
CPM Started 6150 Check Point Security Management Server is running and ready
FWM Started 21443
APACHE Started 5065
Port Details:
-------------------
JETTY Internal Port: 50276
APACHE Gaia Port: 443
--------------------------------------------
Overall API Status: Started
--------------------------------------------
API readiness test SUCCESSFUL. The server is up and ready to receive connections
Notes:
------------
To collect troubleshooting data, please run 'api status -s <comment>'
================================================================================