{"id":15042411,"url":"https://github.com/fire1ce/ddns-cloudflare-bash","last_synced_at":"2025-05-16T05:07:30.804Z","repository":{"id":40610475,"uuid":"300406843","full_name":"fire1ce/DDNS-Cloudflare-Bash","owner":"fire1ce","description":"Cloudflare DDNS bash Script for most Linux distributions and MacOS. Choose any source IP address to update external or internal (WAN/LAN).  Cloudflare's options proxy and TTL configurable via the parameters.","archived":false,"fork":false,"pushed_at":"2025-02-24T08:32:19.000Z","size":31,"stargazers_count":315,"open_issues_count":9,"forks_count":69,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-16T05:07:18.691Z","etag":null,"topics":["bash-script","cloudflare","cloudflare-api","cloudflare-ddns","cloudflare-ddns-script","cloudflare-dns","ddns","debian","linux","macos","ubuntu"],"latest_commit_sha":null,"homepage":"https://3os.org","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fire1ce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"fire1ce","patreon":"fire1ce","custom":["https://www.buymeacoffee.com/fire1ce"]}},"created_at":"2020-10-01T19:52:41.000Z","updated_at":"2025-05-16T04:32:10.000Z","dependencies_parsed_at":"2024-08-11T07:41:58.463Z","dependency_job_id":"1d393633-fe04-49c0-9f68-d5f8a1f8d959","html_url":"https://github.com/fire1ce/DDNS-Cloudflare-Bash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fire1ce%2FDDNS-Cloudflare-Bash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fire1ce%2FDDNS-Cloudflare-Bash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fire1ce%2FDDNS-Cloudflare-Bash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fire1ce%2FDDNS-Cloudflare-Bash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fire1ce","download_url":"https://codeload.github.com/fire1ce/DDNS-Cloudflare-Bash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471060,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash-script","cloudflare","cloudflare-api","cloudflare-ddns","cloudflare-ddns-script","cloudflare-dns","ddns","debian","linux","macos","ubuntu"],"created_at":"2024-09-24T20:47:15.638Z","updated_at":"2025-05-16T05:07:25.791Z","avatar_url":"https://github.com/fire1ce.png","language":"Shell","readme":"# DDNS Cloudflare Bash Script\n\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/fire1ce/3os.org/tree/master/src)\n[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://mit-license.org/)\n\n## About\n\n- DDNS Cloudflare Bash Script for most **Linux**, **Unix** distributions and **MacOS**.\n- Choose any source IP address to update **external** or **internal** _(WAN/LAN)_.\n- For multiply lan interfaces like Wifi, Docker Networks and Bridges the script will automatically detects the primary Interface by priority.\n- Cloudflare's options proxy and TTL configurable via the config file.\n- Optional Telegram Notifications\n\n## Requirements\n\n- curl\n- Cloudflare [api-token](https://dash.cloudflare.com/profile/api-tokens) with ZONE-DNS-EDIT Permissions\n- DNS Record must be pre created (api-token should only edit dns records)\n\n### Creating Cloudflare API Token\n\nTo create a CloudFlare API token for your DNS zone go to [https://dash.cloudflare.com/profile/api-tokens][cloudflare-api-token-url] and follow these steps:\n\n1. Click Create Token\n2. Select Create Custom Token\n3. Provide the token a name, for example, `example.com-dns-zone-readonly`\n4. Grant the token the following permissions:\n   - Zone - DNS - Edit\n5. Set the zone resources to:\n   - Include - Specific Zone - `example.com`\n6. Complete the wizard and use the generated token at the `CLOUDFLARE_API_TOKEN` variable for the container\n\n## Installation\n\n\u003e [!tip]\n\u003e This [article](https://diyaagrams.com/Cloudflare/DDNS-Cloudflare-Bash-Documentation/DDNS-Cloudflare-bash) has an easier explanation for deploying this script.\n\nYou can place the script at any location manually.\n\n**MacOS**: Don't use the _/usr/local/bin/_ for the script location. Create a separate folder under your user path _/Users/${USER}_\n\nThe automatic install examples below will place the script at _/usr/local/bin/_\n\n```shell\nwget https://raw.githubusercontent.com/fire1ce/DDNS-Cloudflare-Bash/main/update-cloudflare-dns.sh\nsudo chmod +x update-cloudflare-dns.sh\nsudo mv update-cloudflare-dns.sh /usr/local/bin/update-cloudflare-dns\n```\n\n## Config file\n\nYou can use default config file _update-cloudflare-dns.conf_ or pass your own config file as parameter to script.\n\n```shell\nwget https://raw.githubusercontent.com/fire1ce/DDNS-Cloudflare-Bash/main/update-cloudflare-dns.conf\n```\n\nPlace the **config** file in the directory as the **update-cloudflare-dns** for above example at _/usr/local/bin/_\n\n```shell\nsudo mv update-cloudflare-dns.conf /usr/local/bin/update-cloudflare-dns.conf\n```\n\n## Config Parameters\n\n| **Option**                | **Example**      | **Description**                                                                                                           |\n| ------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------- |\n| what_ip                   | internal         | Which IP should be used for the record: internal/external                                                                 |\n| dns_record                | ddns.example.com | DNS **A** record which will be updated, you can pass multiple **A** records separated by comma                            |\n| cloudflare_zone_api_token | ChangeMe         | Cloudflare API Token **KEEP IT PRIVATE!!!!**                                                                              |\n| zoneid                    | ChangeMe         | Cloudflare's [Zone ID](https://developers.cloudflare.com/fundamentals/get-started/basic-tasks/find-account-and-zone-ids/) |\n| proxied                   | false            | Use Cloudflare proxy on dns record true/false                                                                             |\n| ttl                       | 120              | 120-7200 in seconds or 1 for Auto                                                                                         |\n\n### Optional Notifications Parameters\n\n| **Option**             | **Example** | **Description**                   |\n| ---------------------- | ----------- | --------------------------------- |\n| notify_me_telegram     | yes         | Use Telegram notifications yes/no |\n| telegram_chat_id       | ChangeMe    | Chat ID of the bot                |\n| telegram_bot_API_Token | ChangeMe    | Telegram's Bot API Token          |\n\n## Running The Script\n\nWhen placed in _/usr/local/bin/_\n\n```shell\nupdate-cloudflare-dns\n```\n\nWith your config file (need to be placed in same folder)\n\n```shell\nupdate-cloudflare-dns yoru_config.conf\n```\n\nOr manually\n\n```shell\n\u003cpath\u003e/.update-cloudflare-dns.sh\n```\n\n## Automation With Crontab\n\nYou can run the script via crontab\n\n```shell\ncrontab -e\n```\n\n### Examples\n\nRun every minute\n\n```shell\n* * * * * /usr/local/bin/update-cloudflare-dns\n```\n\nRun with your specific config file\n\n```shell\n* * * * * /usr/local/bin/update-cloudflare-dns myconfig.conf\n```\n\nRun every 2 minutes\n\n```shell\n*/2 * * * * /usr/local/bin/update-cloudflare-dns\n```\n\nRun at boot\n\n```shell\n@reboot /usr/local/bin/update-cloudflare-dns\n```\n\nRun 1 minute after boot\n\n```shell\n@reboot sleep 60 \u0026\u0026 /usr/local/bin/update-cloudflare-dns\n```\n\nRun at 08:00\n\n```shell\n0 8 * * * /usr/local/bin/update-cloudflare-dns\n```\n\n## Logs\n\nThis Script will create a log file with **only** the last run information\nLog file will be located at the script's location.\n\nExample:\n\n```bash\n/usr/local/bin/update-cloudflare-dns.log\n```\n\n## Limitations\n\n- Does not support IPv6\n\n## License\n\n### MIT License\n\nCopyright© 3os.org @2020\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\n\u003c!-- urls --\u003e\n\u003c!-- appendices --\u003e\n\n[cloudflare-api-token-url]: https://dash.cloudflare.com/profile/api-tokens 'Cloudflare API Token'\n\n\u003c!-- end appendices --\u003e\n","funding_links":["https://github.com/sponsors/fire1ce","https://patreon.com/fire1ce","https://www.buymeacoffee.com/fire1ce"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffire1ce%2Fddns-cloudflare-bash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffire1ce%2Fddns-cloudflare-bash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffire1ce%2Fddns-cloudflare-bash/lists"}