Skip to main content

Allows to synchronize NetBox IPAM DNS information to a pfSense instance

Project description

pfsense-netbox-sync

Allows to synchronize NetBox IPAM DNS information to a pfSense instance. This allows automatic DNS resolution on the pfSense based on the DNS names stored in Netbox.

How does it work?

This script work by pulling IP addresses with DNS name from NetBox (source of truth) and create/update/delete corresponding DNS entries on pfSense DNS resolver.

Installation

Configuration

On NetBox

You'll need to create a dedicated user (ex: pfsense-netbox-sync) on your NetBox instance and then create a read only API token.

The following env variables will need to be set:

  • NB_API_URL: The URL to your NetBox instance. (ex: https://netbox.example.org)
  • NB_API_TOKEN: The token created previously. (ex: f74cb99cf552b7005fd1a616b53efba2ce0c9656)

On pfSense

pfSense does not provide any REST API out of the box. Therefore, you'll first need to install the pfrest package.

Once it's done you can create a user dedicated for this application (ex: pfsense-netbox-sync). You'll then need to grant the account all permissions for /api/v2/services/dns_resolver/* (Effective Privileges in the user page).

Note: You should restrict API access to the IP who are using it.

The following env variables will need to be set:

  • PF_API_URL: The URL to your pfSense instance. (ex: https://fw.example.org)
  • PF_API_USER: The username of the account created previously. (ex: pfsense-netbox-sync)
  • PF_API_PASS: The password of the account created previously. (ex: MQILv21OJIJ_x4dO0hZgJtwl)

Executing the script

You can then execute the script using the following command:

PF_API_URL=xx PF_API_USER=xx PF_API_PASS=xx NB_API_URL=xx NB_API_TOKEN=xx python3 -m app

The script will indicate any change made.

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

pfsense_netbox_sync-0.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pfsense_netbox_sync-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file pfsense_netbox_sync-0.1.0.tar.gz.

File metadata

  • Download URL: pfsense_netbox_sync-0.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pfsense_netbox_sync-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c7fce053284039fc862308e5910485230c257e6d52d02827ffc57f5ba1df82c
MD5 c362b0b02507a91aab50bd8583053e1c
BLAKE2b-256 94b8b7ccae7f41747d18110fac4321d2f6d3d750091621de1a137f6c1104392d

See more details on using hashes here.

File details

Details for the file pfsense_netbox_sync-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pfsense_netbox_sync-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67d5d311d374b3ab4978679a37eb218380069e14087f227268e4a0c50ed4b0ca
MD5 df63c34f5f7952f21d45f229ae77249e
BLAKE2b-256 d1676cfa2734fc064874408074174155dffc67296f6f22dffcc677bbe98f286a

See more details on using hashes here.

Supported by

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