Package: chkp-harmony-endpoint-management-sdk
Check Point - Harmony Endpoint Management Python SDKThis is the Harmony Endpoint management SDK for Python ecosystem.The SDK is based on the publicHarmony Endpoint management OpenAPIspecifications.With the SDK, you do not have to manage log in, send keep alive requests, worry about session expiration or pull long processing jobs.💡 The Harmony Endpoint SDK supports simultaneous instances with different tenants.🚧🚧🚧Note that the SDK package is in Early Availability (EA). Use with caution, as it may undergo changes and improvements. Feedback and contributions are highly encouraged.To report a bug, please go toReport BugFor feedback, please get in touch with us atCheck Point Software Technologies Ltd.🚧🚧🚧⬇️ SDK installationTo start using this SDK, add the SDK package to your projectVia PIP (PyPi registry)pipinstallchkp-harmony-endpoint-management-sdk🚀 Getting startedFirst, import theHarmonyEndpointobject from the package.fromchkp_harmony_endpoint_management_sdkimportHarmonyEndpointThen, create a new instance ofHarmonyEndpoint, which provides CloudInfra API credentials and a gateway to connect to.To obtain CloudInfra credentials, open the Infinity Portal and create a suitable API Key. Make sure to selectEndpointin theServicefield. For more information, seeInfinity Portal Administration Guide.Once the Client ID, Secret Key, and Authentication URL are obtained, Harmony Endpoint SDK can be used.All API operations can be explored with theHarmonyEndpointinstance, notice to the documentation on each API operation, what and where are the arguments it requires.All API's can be also explored inSwaggerHubA complete example:fromchkp_harmony_endpoint_management_sdkimportHarmonyEndpoint,InfinityPortalAuth# Create a new instance of HarmonyEndpoint (we do support multiple instances in parallel)he=HarmonyEndpoint()# Connect to management using CloudInfra API credentialshe.connect(infinity_portal_auth=InfinityPortalAuth(client_id="place here your CI client-id",# The "Client ID"access_key="place here your CI access-key",# The "Secret Key"gateway="https://cloudinfra-gw-us.portal.checkpoint.com/auth/external"# The "Authentication URL"))# Query the API operationrules_metadata_res=he.policy_general_api.get_all_rules_metadata(header_params={"x-mgmt-run-as-job":'off'})print(rules_metadata_res.payload)# Your rulebase metadata# Also you can query this operation using job, no extra logic required, in the background, it will trigger a job and will pull the status till it finish and return the final results.rules_metadata_res=he.policy_general_api.get_all_rules_metadata(header_params={"x-mgmt-run-as-job":'on'})print(rules_metadata_res.is_job)# Trueprint(rules_metadata_res.payload)# Your rulebase metadata# Once finish, disconnect to stop all background session management.he.disconnect()🏠 On-premise🛠️🛠️🛠️Under Development🛠️🛠️🛠️Harmony Endpoint On-premise instances are also supported.Pay attention! Not all cloud operations are available for on-premise, also need to specify the SDK version to comply with your Gaia / JHF versionfromchkp_harmony_endpoint_management_sdkimportHarmonyEndpointPremise,OnPremisePortalAuth# Create a new instance of HarmonyEndpoint (we do support multiple instances in parallel)hep=HarmonyEndpointPremise()# Connect to management using CloudInfra API credentialshep.connect(on_premise_portal_auth=OnPremisePortalAuth(username="xxxx",password="xxxx",url="https://x.x.x.x",disable_tls_chain_validation=False# Set it true only if you fully trust this URL (e.g. case of internal but not verified https certificate)))# Query the API operationrules_metadata_res=hep.policy_general_api.get_all_rules_metadata(header_params={"x-mgmt-run-as-job":'off'})print(rules_metadata_res.payload)# Your rulebase metadata# Once all finish, disconnect to stop all background session management.hep.disconnect()On-Premises API can be explored inSwaggerHub☁️ Cloud & MSSP services APIsHarmony Endpoint also provides APIs for MSSP and Cloud service management (relevant to SaaS customers only)The usage is similar to the management APIfromchkp_harmony_endpoint_management_sdkimportHarmonyEndpointSaaS,InfinityPortalAuthhe_saas=HarmonyEndpointSaaS()# Connect to management using CloudInfra API credentialshe_saas.connect(infinity_portal_auth=InfinityPortalAuth(client_id="place here your CI client-id",# The "Client ID"access_key="place here your CI access-key",# The "Secret Key"gateway="https://cloudinfra-gw-us.portal.checkpoint.com/auth/external"# The "Authentication URL"))# Query the cloud API operationinstance_status_res=he_saas.self_service_api.public_machines_single_status()print(instance_status_res.payload)# Your instance statushe_saas.disconnect()API available atSwaggerHub🔍 Troubleshooting and loggingThe full version and build info of the SDK is available byHarmonyEndpoint.info()see example:fromchkp_harmony_endpoint_management_sdkimportHarmonyEndpoint,HarmonyEndpointSDKInfosdk_info:HarmonyEndpointSDKInfo=HarmonyEndpoint.info()print(sdk_info)# sdk_build:"9728283", sdk_version:"1.0.2", spec:"web-mgmt-external-api-production", spec_version:"1.9.159", released_on:"2023-09-10T18:14:38.264Z"Harmony Endpoint Management SDK uses the official python logger package for logging.There are 3 loggers, for general info, errors and to inspect network.As default they will be disabled, in order to enable logging, set to theHARMONY_ENDPOINT_SDK_LOGGERenvironment variable the following string:HARMONY_ENDPOINT_SDK_LOGGER="*"And for a specific/s logger set the logger name followed by a command as following:HARMONY_ENDPOINT_SDK_LOGGER="info,error,network"🐞 Report BugIn case of an issue or a bug found in the SDK, please open anissueor report to usCheck Point Software Technologies Ltd.🤝 ContributorsHaim Kastner -chkp-haimkYuval Pomerchik -chkp-yuvalpo