Skip to content

Uses ipify to get your public ip and Cloudflare API to update a DNS record.

Notifications You must be signed in to change notification settings

KLONE23UK/Cloudflare-Public-DNS-Update

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Cloudflare Public DNS Update

Description

Uses ipify to get your public ip and Cloudflare API to update a DNS record.

Instructions

Note; you will need an existing record in order to change it. Does not create records

Create .env file and add your GLOBAL_KEY, ZONE_ID, RECORD_ID, EMAIL and NAME in the same direcotry as main.py

GLOBAL_KEY="<GLOBAL_KEY>"
ZONE_ID="<ZONE_ID>"
RECORD_ID="<RECORD_ID>"
EMAIL="<EMAIL>"
NAME="<NAME>"

Run the script and you'll see the DNS record has changed

» python3 main.py
DNS record changed for <NAME> to <public ip>

Additions

See Overwrite DNS Record for list of options availabe that can be updated. Add these to the data dictionary.

data = {
    'content': public_ip,
    'name': NAME,
    'type': 'A',
    'id': RECORD_ID,
    'comment': 'Updated automatically via script'
}

About

Uses ipify to get your public ip and Cloudflare API to update a DNS record.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages