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:
-
In Cisco FMC:
- Create new user:
bunny2fmc_sync - Assign role: Network Admin or Maintenance User
- Permissions needed: Dynamic Objects (Read, Create, Modify)
- Create new user:
-
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
- Fetch IPs: Retrieves current BunnyCDN edge server IPs from their API
- Compare: Checks against existing mappings in FMC Dynamic Object
- Update: Adds new IPs and removes old ones
- 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-keyringorsudo 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
--logscommand, About section in help - v1.1.0 - Added
--startand--stopcommands, API user documentation - v1.0.11 - Initial stable release with password input fix
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bunny2fmc-1.3.10.tar.gz.
File metadata
- Download URL: bunny2fmc-1.3.10.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5c5d6d7995a04d276f94a9277504ccd35b7d287def429ea64439d8c688d82c9
|
|
| MD5 |
b8f769cc427a0fbcbe01ec993ab7b993
|
|
| BLAKE2b-256 |
64503e40c952c8fb19276b42b14e64105522bc5551382812eff8a411ed8fc759
|
File details
Details for the file bunny2fmc-1.3.10-py3-none-any.whl.
File metadata
- Download URL: bunny2fmc-1.3.10-py3-none-any.whl
- Upload date:
- Size: 24.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca583909d7fb4cf771dc78eb6845cd4ea01d6805a99319f0cd08e4aa0c423b05
|
|
| MD5 |
457dd736cc8326b9e649185ea71707ed
|
|
| BLAKE2b-256 |
dadcfd740754e3c03cb245613240e101651f8264b22dbf570e5bcb21ecb06407
|