Skip to main content

OPNsense CLI written in python.

Project description

opnsense-cli

CI

OPNsense CLI written in python.

Install

pip install opn_cli

Configure

  1. Generate an api_key and api_secret. See: https://docs.opnsense.org/development/how-tos/api.html#creating-keys.

  2. Create the default config file ~/.opn_cli/conf.yaml

---
api_key: your_api_key
api_secret: your_api_secret
url: https://opnsense.example.com/api
timeout: 60
ssl_verify: true
ca: ~/.opn-cli/ca.pem

Usage

$ opn_cli --help

Usage: opn_cli [OPTIONS] COMMAND [ARGS]...

  OPNsense CLI - interact with OPNsense via the API

  You need a valid API key and secret to interact with the API. Open your
  browser and go to System->Access->Users and generate or use an existing
  Api Key.

  If you use ssl verification (--ssl-verify), make sure to specify a valid
  ca with --ca <path_to_bundle>.

  You can set the required options as environment variables. See --help
  "[env var: [...]"

  Or use a config file passed with -c option.

  The configuration cascade from highest precedence to lowest:

  1. argument & options

  2. environment variables

  3. config file

Options:
  -c, --config FILE               path to the config file  [env var:
                                  OPN_CONFIG; default: ~/.opn_cli/conf.yaml]

  --ca FILE                       path to the ca bundle file for ssl
                                  verification  [env var: OPN_SSL_VERIFY_CA;
                                  default: ~/.opn_cli/ca.pem]

  -k, --api-key TEXT              Your API key for the OPNsense API  [env var:
                                  OPN_API_KEY]

  -s, --api-secret TEXT           Your API secret for the OPNsense API  [env
                                  var: OPN_API_SECRET]

  -u, --url TEXT                  The Base URL for the OPNsense API  [env var:
                                  OPN_API_URL]

  -t, --timeout INTEGER           Set timeout for API Calls in seconds.  [env
                                  var: OPN_API_TIMEOUT; default: 60]

  --ssl-verify / --no-ssl-verify  Enable or disable SSL verification for API
                                  communication.  [env var: OPN_SSL_VERIFY;
                                  default: True]

  -h, --help                      Show this message and exit.

Commands:
  firewall  Manage the OPNsense firewall
  plugin    Manage OPNsense plugins
  version   Show the CLI version and exit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opn_cli-0.2.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

opn_cli-0.2.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file opn_cli-0.2.0.tar.gz.

File metadata

  • Download URL: opn_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for opn_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8544c192cc14564336ac6f246821098f9fa32c75b86d490373edc957b097e739
MD5 4abee9e673b390cbb6c3393b03c7bfa3
BLAKE2b-256 59683ec1d8178b77368ded5595766f9280ccc20318298207489b857265fafcc9

See more details on using hashes here.

File details

Details for the file opn_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: opn_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for opn_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 607e329b64c59c6e5954c8598a81614bf519a510f9d32fe3b3af52e7e63002d5
MD5 3421cc86a8a2264ce1a3145f128c70e7
BLAKE2b-256 2b8abe90612e5ed5f8d42474dd33335eb0a703c169c37c33b40e8a3ece128c3f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page