Skip to main content

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

Metadata

Release files for pfcli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pfcli 0.2.0
File Size Uploaded
pfcli-0.2.0.tar.gz 16.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pfcli 0.2.0
File Interpreter ABI Platform
pfcli-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.9 kB

Release files / pfcli-0.2.0.tar.gz

Download URL pfcli-0.2.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d745bcb0baf7e1feb2df424589438843c0e392ac6c4e1e2888cd498d92ba94cb
BLAKE2b-256 checksum
How to use checksums
ed482a1d3b4fb2fb1480b53f0da5188c6b932c08668e582e1933e063c897afcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

Release files / pfcli-0.2.0-py3-none-any.whl

Download URL pfcli-0.2.0-py3-none-any.whl
Size 28.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cb6d8062587a717c756204b9a847f248359bd8216f5bcffa1292b132ca960dd
BLAKE2b-256 checksum
How to use checksums
d9dfac1d8e420ee1d5392decc429c6b28bb1d422c26725d55d4c44d5626a8667
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page