Skip to main content

Sync BunnyCDN edge IPs to Cisco FMC Dynamic Objects with secure credential management and scheduling

Project description

bunny2fmc

Automatically sync BunnyCDN IP ranges to Cisco FMC Dynamic Objects.

Overview

bunny2fmc is a command-line tool that automatically synchronizes the latest BunnyCDN IP address ranges to a Dynamic Object in Cisco FMC. It supports both on-demand and scheduled execution via cron.

Key Features

  • 🔄 Automatic synchronization - Fetch latest IPs from BunnyCDN's API
  • 🔐 Secure credentials - Stored in OS keyring (Windows Credential Manager / Linux Secret Service)
  • Scheduled execution - Run on-demand or set up automatic syncs via cron
  • 📊 Intelligent updates - Only adds/removes changed IPs (no unnecessary deployments)
  • 📝 Real-time logging - Monitor sync activity and troubleshoot issues
  • 🎯 Easy control - Start/stop scheduled syncs without reconfiguration

Installation

From PyPI (Recommended)

# Create virtual environment
python3 -m venv .venv

# Activate virtual environment
source .venv/bin/activate    # Linux/macOS
.venv\Scripts\activate       # Windows

# Install bunny2fmc
pip install bunny2fmc

# Verify installation
bunny2fmc --version
bunny2fmc --help

From Source (Development)

git clone <repository-url>
cd Bunny_Sync_FMC

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate    # Linux/macOS
# or
venv\Scripts\activate       # Windows

# Install in editable mode
pip install -e .

Quick Start

1. Initial Setup

bunny2fmc --setup

This will guide you through:

  • FMC IP/hostname
  • FMC username (use dedicated API user, see below)
  • FMC password
  • Dynamic Object name to create/update
  • Sync interval (in minutes)

Credentials are securely stored in your OS keyring.

2. Configure Dedicated API User (Recommended)

To avoid being logged out of FMC during syncs, create a dedicated API user:

  1. In Cisco FMC:

    • Create new user: bunny2fmc_sync
    • Assign role: Network Admin or Maintenance User
    • Permissions needed: Dynamic Objects (Read, Create, Modify)
  2. Use this user in bunny2fmc --setup (not your admin account)

3. Run Sync

# Sync once
bunny2fmc --run

# View logs
bunny2fmc --logs          # Last 20 lines
bunny2fmc --logs follow   # Follow in realtime (Ctrl+C to stop)

# Show configuration
bunny2fmc --config

# Stop scheduled syncs
bunny2fmc --stop

# Restart scheduled syncs
bunny2fmc --start

Commands

bunny2fmc --setup        # First-time interactive configuration
bunny2fmc --run          # Execute sync immediately
bunny2fmc --config       # Show current configuration
bunny2fmc --logs         # View last 20 log lines
bunny2fmc --logs follow  # Follow logs in real-time
bunny2fmc --start        # Re-enable scheduled syncs
bunny2fmc --stop         # Disable scheduled syncs
bunny2fmc --clear        # Clear all configuration and credentials
bunny2fmc --version      # Show version
bunny2fmc --help         # Show help text

Log File

Logs are stored at: ~/.local/share/bunny2fmc/logs/bunny2fmc.log

View logs:

bunny2fmc --logs         # View last 20 lines
bunny2fmc --logs follow  # Follow in real-time

How It Works

  1. Fetch IPs: Retrieves current BunnyCDN edge server IPs from their API
  2. Compare: Checks against existing mappings in FMC Dynamic Object
  3. Update: Adds new IPs and removes old ones
  4. Log: Records all changes to log file

No deployment needed - Dynamic Object updates are immediate.

Requirements

  • Python 3.8+
  • Cisco FMC (with API access)
  • BunnyCDN account
  • Virtual environment (venv) - highly recommended

Troubleshooting

Credentials Not Stored?

  • Ensure OS keyring service is running (Linux: secret-service, Windows: Credential Manager)
  • On Linux, install: sudo apt-get install gnome-keyring or sudo apt-get install pass

Sync Fails?

  • Check FMC connectivity: ping <fmc-ip>
  • Verify API user has correct permissions
  • Review logs: bunny2fmc --logs follow

Cron Not Running?

  • Verify cron is active: crontab -l
  • Check cron logs (Linux): grep CRON /var/log/syslog
  • Reinstall with: bunny2fmc --stop && bunny2fmc --start

Development

Setup Development Environment

git clone <repository-url>
cd Bunny_Sync_FMC
python3 -m venv venv
source venv/bin/activate
pip install -e ".[dev]"

Running Tests

pytest

Contributing

Report issues on GitHub or contact the maintainer.

License

See LICENSE file for details.

Support

For issues, questions, or suggestions:

  • GitHub Issues: /issues
  • Email:

Version History

  • v1.2.0 - Added --logs command, About section in help
  • v1.1.0 - Added --start and --stop commands, API user documentation
  • v1.0.11 - Initial stable release with password input fix

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

bunny2fmc-1.3.11.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

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

bunny2fmc-1.3.11-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file bunny2fmc-1.3.11.tar.gz.

File metadata

  • Download URL: bunny2fmc-1.3.11.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bunny2fmc-1.3.11.tar.gz
Algorithm Hash digest
SHA256 66ce20a0eeb2801097794c9feb43054d574ec6da233d12d966fe2925f6f51603
MD5 136eca119fd5de4b44b620388c576a96
BLAKE2b-256 1fde17d98edd92511bab2098b1c2b76243e839941dbaa99f2a91b3013083f8d9

See more details on using hashes here.

File details

Details for the file bunny2fmc-1.3.11-py3-none-any.whl.

File metadata

  • Download URL: bunny2fmc-1.3.11-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bunny2fmc-1.3.11-py3-none-any.whl
Algorithm Hash digest
SHA256 ad295b02839ae5ce18b71916af856bb1340e3aceeac8658aede9e1554c86ff32
MD5 c970a7ebe98276a0146e671b218a48fc
BLAKE2b-256 5c54d6051091cd2ccd48250c06c36ab89c81e2e7133a6e41849834961f687c22

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