Coder Social home page Coder Social logo

snak613 / cloudflare-ip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pigeonburger/cloudflare-ip

0.0 0.0 0.0 29 KB

Script for servers with dynamic IPs that automatically updates Cloudflare DNS records whenever it changes.

License: Apache License 2.0

Python 100.00%

cloudflare-ip's Introduction

Cloudflare DNS Auto IP Updater

This is a script I made that will automatically update my A record's IP address whenever my web server's IP changes.

I don't have (nor can I afford) a static ip, meaning that my IP address constantly changes. Whenever it does change (usually while I'm sleeping), it means that my site becomes completely inaccessible. So, I attempted to create a solution, which is this script. It can also send you an email and log all IP changes to a file to let you know it's been updated.

Be aware, this only works if your site is on the Cloudflare CDN. See the requirements below:

Requirements:

  • Python 3.6 or above
  • Python requests library (install using pip3 install requests)
  • A Cloudflare account with website
  • Cloudflare API Bearer Token
  • Need to know your zone ID
  • The ID of the A record you want to change

Optional:

  • SMTP email, to send an update when the IP changes

Installation:

On your web server, in any directory, clone this repository:

git clone https://github.com/pigeonburger/cloudflare-ip/

Then, open the file cfauth.ini in that folder and replace <YOUR_ZONE_ID> with your actual Cloudflare Zone ID, <YOUR_BEARER_TOKEN> with your API bearer token and <YOUR_DNS_RECORD_ID> with the ID of the DNS record you want to change.

If you want email support, add your SMTP details, otherwise just delete everything at the bottom of the script.

Then, if you've done everything, run the cfautoupdater.py file!

cloudflare-ip's People

Contributors

pigeonburger avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.