Skip to main content

A CLI for managing pfSense configurations

Project description

PfCLI

License: MPL 2.0 Build PyPI security: bandit

:warning: No guarantees of any kind: this is a work in progress, only a few features are implemented, and none of them are under automated testing. The application depends on private pfSense API functionality, so the application might break, or mess up your pfSense appliance's config

Allows you to access PfSense machines through CLI, which should make headless management easier. The application uses the XML-RPC interface provided natively by PfSense.

Requirements

  • Python >= 3.11 - older versions might work, but are not supported
  • Netgate pfSense Plus, 23.09-RELEASE :warning: this is the only version that I tested

Installation

pipx install pfcli

Configuration

The following environment variables are available to configure the application:

Name Default Description
PFCLI_PFSENSE_SCHEME https What scheme does the pfSense web interface listen on?
PFCLI_PFSENSE_HOSTNAME 192.168.0.1 To what hostname or IP address does the pfSense web interface respond?
PFCLI_PFSENSE_USERNAME admin What is the username for your pfSense web interface?
PFCLI_PFSENSE_PASSWORD pfsense What is the password for your pfSense web interface?

Want to use config from a file instead?

Step 1 Create a file .env, with contents as described below - adjust for your situation

PFCLI_PFSENSE_SCHEME=https
PFCLI_PFSENSE_HOSTNAME=192.168.0.1
PFCLI_PFSENSE_USERNAME=admin
PFCLI_PFSENSE_PASSWORD=pfsense

Step 2 Load the variables from .env

export $(xargs < .env)

Examples

List all domain overrides

pfcli unbound list-host-overrides --output json

Example output:

[
  {
    "domain": "yourdomain.tld",
    "host": "yourhost",
    "ip": "x.x.x.x",
    "aliases": [
      {
        "host": "youraliashost",
        "domain": "somedomain.tld",
        "description": "your host override alias description"
      }
    ],
    "description": "your host override description"
  }
]

Print version information

pfcli firmware version --output text

Example output:

config:
 version: 23.3

kernel:
 version: 14.0

platform: Netgate pfSense Plus

version: 23.09-RELEASE

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

Code of Conduct

Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

License

MPL-2.0

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

pfcli-0.1.2.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

pfcli-0.1.2-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file pfcli-0.1.2.tar.gz.

File metadata

  • Download URL: pfcli-0.1.2.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for pfcli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 73d691f8657ef3ac0e1a85ca75c2c60ba45c8d654e080ea11fd9d5162d8ebcbe
MD5 0e2086f3363a1783dac76f41af60f132
BLAKE2b-256 9a44769347959cebf89e76f4828b6f5c00cadd7501eef87ad6c68202215aa707

See more details on using hashes here.

File details

Details for the file pfcli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pfcli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for pfcli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d4988c97c39d0c49b3ed5ec4b7ba88f3bffe57eb89efc68a42764eb83e2d34
MD5 c62f654d3c6e4f1554f4e495d9955c2d
BLAKE2b-256 f5725657c554b193bb1e59d4a66d05e7b51ecaedaa582d4f3a3fa1360993523a

See more details on using hashes here.

Supported by

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