Dynamic DNS (DDNS) service based on Cloudflare! Access your home network remotely via a custom domain name without a static IP! Written in pure BASH~
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rui Coelho a23f3414d3
Update README.md
1 year ago
LICENSE Initial commit 5 years ago
README.md Update README.md 1 year ago
cloudflare-template.sh Use functions 1 year ago
cloudflare-templatev6.sh Create cloudflare-templatev6.sh 2 years ago
config.ini Add config.ini 1 year ago

README.md

Cloudflare Dynamic DNS IP Updater

GitHub GitHub last commit (branch) GitHub contributors

This script is used to update Dynamic DNS (DDNS) service based on Cloudflare! Access your home network remotely via a custom domain name without a static IP! Written in pure BASH.

Support Me

Donate Via Paypal

Table of Contents

Installation

git clone https://github.com/K0p1-Git/cloudflare-ddns-updater.git

Usage

This script is used with crontab. Specify the frequency of execution through crontab.

# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday 7 is also Sunday on some systems)
# │ │ │ │ │ ┌───────────── command to issue                               
# │ │ │ │ │ │
# │ │ │ │ │ │
# * * * * * /bin/bash {Location of the script}

Local variables

If you want to use your variables inside the script fill the script with them and execute it like the following example:

./cloudflare-template.sh local

Configuration file

If you want to use the configuration file to store your credentials execute the following commands:

mkdir -p ~/.cloudflare
cp config.ini ~/.cloudflare/config.ini

./cloudflare-template.sh file

Pass

If you want to use Pass you can execute the following commands:

gpg2 --full-generate-key

Fll the prompts:

Please select what kind of key you want:

   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)

Your selection? 1

RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
Requested keysize is 4096 bits

Please specify how long the key should be valid.

        0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years

Key is valid for? (0) 2y
Key expires at Sat 18 Mar 2023 15:03:38 CET
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: John Doe
Email address: john.doe@example.com
Comment: 
You selected this USER-ID:
    "John Doe <john.doe@example.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O

List secret keys:

gpg2 --list-secret-keys --keyid-format LONG

sec   4096R/AAAA2222CCCC4444 2021-03-18 [expires: 2023-03-18] uid         John Doe <jdoe@example.com>

Init pass:

pass init 'AAAA2222CCCC4444'

mkdir: created directory ‘/home/myhome/.password-store’ Password store initialized for AAAA2222CCCC4444.

Execute:

pass insert -m credentials/cloudflare

Add your variables:

auth_email=""                                       # The email used to login 'https://dash.cloudflare.com'
auth_method=""                                      # Set to "global" for Global API Key or "token" for Scoped API Token
auth_key=""                                         # Your API Token or Global API Key
zone_identifier=""                                  # Can be found in the "Overview" tab of your domain
record_name=""                                      # Which record you want to be synced
ttl="3600"                                          # Set the DNS TTL (seconds)
proxy="false"                                       # Set the proxy to true or false
sitename=""                                         # Title of site "Example Site"
slackchannel=""                                     # Slack Channel #example
slackuri=""                                         # URI for Slack WebHook "https://hooks.slack.com/services/xxxxx"
discorduri=""                                       # URI for Discord WebHook "https://discordapp.com/api/webhooks/xxxxx"

Tested Environments:

macOS Mojave version 10.14.6 (x86_64)
AlmaLinux 9.3 (Linux kernel: 5.14.0 | x86_64)
Debian Bullseye 11 (Linux kernel: 6.1.28 | aarch64)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Reference

This script was made with reference from Keld Norman video.

License

MIT