willfore / cp_mgmt

A lightweight wrapper for using the Check Point Management API in your elixir projects

Home Page:https://hex.pm/packages/cp_mgmt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check Point Management - Elixir

CircleCI

This is a very light wrapper to help simplify working with the Check Point Web API in R80.10 and above. Currently not all options from the API are available but I plan on adding them going forward. This project depends heavily on Tesla so you can technically run any Tesla based command inside this project as well. It has been developed using the 1.3 Version of the Check Point Management API. I would recommend using the API Documentation as a reference as some of the functions accept an options map. You will need to reference this documentation to discover which options can be passed.

Note that this is in very early stages and is being developed on often. I would recommend not running the master branch unless you are willing to expierence outages or behavioral issues.

Installation

If available in Hex, the package can be installed by adding cp_mgmt to your list of dependencies in mix.exs:

def deps do
  [
    {:cp_mgmt, "~> 1.0"}
  ]
end

Setup

Specify the following in your config/config.exs or config/<env>.exs config file:

config :cp_mgmt, mgmt_server_url: "https://some.ip.address"
config :cp_mgmt, mgmt_user: "<username>"
config :cp_mgmt, mgmt_pass: "<user_password>"
config :cp_mgmt, mgmt_domain: "<domain_name_on_mds>"

Note that it is usually a better practice to use env variables in place of staticly coding passwords via config.exs. If you are not using an MDS simply set mgmt_domain to nil.

Currently this supports the following basic API actions:

  • Loging In/Out (This is automatic)
  • Hosts CpMgmt.Host
  • Networks CpMgmt.Network
  • Access Layer CpMgmt.AccessLayer
  • Access Rules CpMgmt.AccessRule
  • Verify Policy CpMgmt.verify_policy
  • Install Policy CpMgmt.install_policy

Basic Usage

All requests will return a struct with the function status as well as the data returned from the API server and its web API status:

Successful Request:

{:ok, %CpMgmt.Host{data: %{request_data}, status: 200}

Failed Request:

{:error, %Cpmgmt.Host{status: 402, data: %{error_data}}} Each Module has the same naming convention to make usage easy. The Documentation is pretty thorough at this point with examples of each function and its return. Below is an example of adding a host.

CpMgmt.Host.add("test-host", "1.1.1.1")

Please view the Documentation for usage details and examples.

About

A lightweight wrapper for using the Check Point Management API in your elixir projects

https://hex.pm/packages/cp_mgmt

License:Apache License 2.0


Languages

Language:Elixir 100.0%