@keeftraum/cloudflare-update-ip
v1.2.4
Published
A Python utility for batch updating, backing up, and restoring DNS records across one or more Cloudflare zones.This tool is designed for sysadmins and developers who need to automate DNS management tasks, such as updating IP addresses, replacing old recor
Downloads
9
Maintainers
Readme
Cloudflare Update IP
Easily update all Cloudflare DNS records (A, AAAA, CNAME, TXT, SRV, MX, NS, PTR, CAA, CERT, DNSKEY, DS, LOC, NAPTR, SMIMEA, SSHFP, SVCB, TLSA, URI, and more) to a new IP address using a simple script. Ideal for server migrations, dynamic IP environments, or bulk DNS changes.
The tool can also be installed globally from npm as @keeftraum/cloudflare-update-ip.
🚀 Features
- Bulk Update: Updates all supported DNS record types across all zones or a single zone.
- Flexible Matching: Replaces any occurrence of the old IP in record content with the new IP (not just A records).
- .env Configuration: Simple environment variable setup for credentials and options.
- Dry Run & Debug: Preview changes and get detailed logs before applying updates.
- Backup & Restore: Easily backup and restore DNS records for safety.
- Colorful Output: Clear, color-coded console output for easy tracking.
- HTML Report: Use
--html-report report.htmlto generate a visual summary of all changes. - Windows Friendly: Built for Windows, but works cross-platform with Python.
- Self-Update Check: Automatically checks GitHub for a newer version and offers to update before running.
- Interactive Prompts: Missing environment variables are asked for at runtime.
- NPM CLI: Install globally with
npm i -g @keeftraum/cloudflare-update-ipand run the tool usingcloudflare-update-ip.
📦 Requirements
- Python 3.7+
requests,python-dotenv,colorama,pyfiglet(install viapip install -r requirements.txt)- Cloudflare API token with DNS edit permissions
- (Optional) Node.js 14+ for using the npm-based CLI
⚡ Quick Start
Clone the repository:
git clone https://github.com/SkyLostTR/Cloudflare-Update-IP.git cd Cloudflare-Update-IPInstall dependencies:
pip install -r requirements.txtConfigure your environment:
cp .env.example .env # use `copy` on WindowsEdit
.envand set:CLOUDFLARE_API_TOKEN– your Cloudflare API tokenNEW_IP– the new IP address to assignOLD_IP– (optional) the current IP address to search/replaceTARGET_DOMAIN– (optional) domain to update (default: all zones)DRY_RUN– (optional) set to1to preview changesDEBUG– (optional) set to1for verbose loggingCENSOR– (optional) set to0to disable censoring of log output
Run the script:
python CloudflareUpdate.py --html-report report.htmlThe script will check GitHub for updates before executing. Run
python CloudflareUpdate.py -hto see all available options and environment variables.Backup / Restore:
python CloudflareUpdate.py --backup python CloudflareUpdate.py --restore
Use via npm
Alternatively, install the CLI globally from npm and run it anywhere:
npm install -g @keeftraum/cloudflare-update-ip
cloudflare-update-ip --html-report report.htmlThe npm package runs a postinstall script that installs the required Python
dependencies using pip, so make sure Python is available on your system.
🛠️ Usage
- By default, every supported DNS record (A, AAAA, CNAME, TXT, SRV, MX, NS, PTR, CAA, CERT, DNSKEY, DS, LOC, NAPTR, SMIMEA, SSHFP, SVCB, TLSA, URI, etc.) in all zones will be updated if their content matches the old IP.
- Set
TARGET_DOMAINin.envto limit updates to a single zone. - Use
DRY_RUN=1to preview changes without applying them. - Use
DEBUG=1for detailed logs indebug_output.txt. - Use
--html-report report.htmlto generate a visual report of all record changes. - Use
CENSOR=0to display uncensored environment values in output. - If installed via npm, run the tool with
cloudflare-update-ipinstead of the Python file. - Always keep your
.envfile private. Never commit it to version control.
✅ Tests
Run the automated checks with:
npm testThis compiles the Python script and verifies the Node CLI wrapper.
📚 Documentation
- GitHub Wiki: Full documentation and usage guides are available at: https://github.com/SkyLostTR/Cloudflare-Update-IP/wiki
🙏 Credits
Created and maintained by @SkyLostTR (@Keeftraum) ASCII banner generated with pyfiglet
🪪 License
Released under the MIT License. See LICENSE.
⚠️ Disclaimer
This project is provided as-is, without any warranty or guarantee of fitness for a particular purpose. Use at your own risk. The author (@SkyLostTR) is not responsible for any data loss, misconfiguration, downtime, or other issues that may arise from using this script. Always backup your DNS records before making bulk changes and review all changes in dry-run mode before applying them.
