Skip to main content

Yet another Cloudflare DDNS

Project description

cflare-ddns

This is yet another Cloudflare Dynamic DNS application.

PyPI - Version Docker Pulls Docker Image Size (tag) Python Cloudflare License

Installation

pip install cflare-ddns

Usage

First is you need to create a config file. You can place it in the default location /etc/cflare-ddns.json or anywhere in your filesystem that is readable by the script. You'll need to pass that config location in the cli if it's not the default location.

Edit the config file, you'll need to provide the following:

  • api_key - You can get this in your cloudflare dashboard. Follow this link to get full instructions.
  • email - The email account you use in cloudflare.
  • zone_id - Zone ID of your domain name.
  • domain - The domain name. Example: example.com
  • record_name - The sub domain you want to update with your public ip. This subdomain should be an A record type. Example: www

Configuration file example:

{
  "api_key": "xxxx",
  "email": "xxxx@gmail.com",
  "records": [
    {
      "zone_id": "xxxx",
      "domain": "example.xyz",
      "record_name": "vpn"
    },
    {
      "zone_id": "xxxx",
      "domain": "example.sh",
      "record_name": "www"
    }
  ]
}

Running the script with config in the default location:

cflare-ddns

Running the script with config in non-default location:

cflare-ddns -c /opt/somewhere/config.json

You can add this to your cronjobs to run periodically.

* * * * * cflare-ddns
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)

To run every 15 minutes:

*/15 * * * * cflare-ddns

CLI Reference

usage: cflare-ddns [-h] [-c CONFIG_FILE] [-i INTERVAL] [-v]

options:
  -h, --help            show this help message and exit
  -v, --version         App version
  -c CONFIG_FILE, --config CONFIG_FILE
                        Path to your configuration file.
                        Default paths:
                          /etc/cflare-ddns.json,
                          cflare-ddns.json
  -i INTERVAL, --interval INTERVAL
                        Number of seconds between each sync. This will make the program run
                        forever.Hit Ctrl-C to stop.

Docker

Example on running on docker:

docker run -e CF_DDNS_INTERVAL=900 -v $(pwd)/cflare-ddns.json:/etc/cflare-ddns.json --rm ianpogi5/cflare-ddns:latest

Example using docker-compose.yml:

version: "3.9"
services:
  cflare-ddns:
    image: ianpogi5/cflare-ddns:latest
    container_name: cflare-ddns
    environment:
      - CF_DDNS_INTERVAL=900
    volumes:
      - /YOUR/PATH/TO/cflare-ddns.json:/etc/cflare-ddns.json
    restart: unless-stopped

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cflare-ddns-0.2.4.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

cflare_ddns-0.2.4-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file cflare-ddns-0.2.4.tar.gz.

File metadata

  • Download URL: cflare-ddns-0.2.4.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for cflare-ddns-0.2.4.tar.gz
Algorithm Hash digest
SHA256 ffb2df88048a28b9f1896e23eef40f36db323edbd72ae9fb6eb7080cd16a6fc6
MD5 09445de3be14210930b5a99e200c2cdb
BLAKE2b-256 7cc765bcd14e800cc0c7e2c1e1b34cc450cf0a9760dfd007a26a0e1646102535

See more details on using hashes here.

File details

Details for the file cflare_ddns-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: cflare_ddns-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for cflare_ddns-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bee83cfc4440c5a58d4153fa373c134794abf3973d85ccf8133c9e67c3488acb
MD5 32ef894a159d04e9747a78eefc6e8c94
BLAKE2b-256 26d039eeaffd472dcb87438d513c05929085e371802740ade9dbd2f4b8dd1605

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page