{"id":18319881,"url":"https://github.com/bitwalker/cfdns","last_synced_at":"2025-04-09T14:23:21.260Z","repository":{"id":66282986,"uuid":"452036640","full_name":"bitwalker/cfdns","owner":"bitwalker","description":"A handy utility for updating Cloudflare DNS records from a Ubiquiti device","archived":false,"fork":false,"pushed_at":"2022-01-26T15:11:40.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-15T08:20:48.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitwalker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2022-01-25T20:46:24.000Z","updated_at":"2022-01-25T20:56:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"af9fc45f-0507-4765-aac2-810e38e30c87","html_url":"https://github.com/bitwalker/cfdns","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Fcfdns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Fcfdns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Fcfdns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Fcfdns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitwalker","download_url":"https://codeload.github.com/bitwalker/cfdns/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054268,"owners_count":21039967,"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":[],"created_at":"2024-11-05T18:14:34.570Z","updated_at":"2025-04-09T14:23:21.241Z","avatar_url":"https://github.com/bitwalker.png","language":"Rust","readme":"# cfdns\n\nThis utility is what I run on my Ubiquiti Dream Machine Pro to update my personal\nCloudflare DNS records based on my current public internet IP.\n\nThere are tons of tools like this out there, but I prefer to manage things like this\nmyself.\n\n## Usage\n\n### Prerequisites\n\nSince this is designed for running on a UDM Pro, there are a few pre-requisites you'll want\nto take care of. First, the UDM Pro starts with a clean slate on every boot, so you'll want\nto install [on-boot-script](https://github.com/boostchicken-dev/udm-utilities/tree/master/on-boot-script)\nfirst. This gives you a mechanism for executing startup scripts on every boot. \n\nNOTE: I've added some instructions for the UDR/UDM SE below, but keep in mind I've only tested\non the UDM Pro.\n\n### Installing \n\nWith the prereqs out of the way, we can set up `cfdns` three different ways, depending on your preferences:\n\n1. Install this [cronjob helper script](https://github.com/boostchicken-dev/udm-utilities/blob/master/on-boot-script/examples/udm-files/on_boot.d/25-add-cron-jobs.sh)\nto execute `cfdns` on a schedule as a one-shot utility. See [the example job file](examples/cfdns) for reference.\n2. Start a container via `podman` that runs `cfdns` as a daemon on a configured schedule\n3. (UDR/UDM SE only) Install a systemctl service that runs `cfdns` as a daemon. See [the example unit file](examples/cfdns.service) for reference.\nYou can install this at `/etc/systemd/system/cfdns.service`, then run `systemctl daemon-reload \u0026\u0026 systemctl enable cfdns`\n\nIf you are on a UDM Pro, I would recommend either option 1 or 2. For a UDR or UDM SE, I would recommend option 3. If I publish a Docker image for\nuse with podman, it will be tagged as `bitwalker/cfdns:latest`. Since I'm not doing that yet, you'll need to either build the image yourself and\npublish it to your own repo, or use option 1.\n\nMake sure you configure `cfdns` as outlined below.\n\nNOTE: I have a UDM Pro, not a UDR or UDM SE, so it is based on what I know of those systems, but is untested.\n\n### Running Manually\n\nThe recommended way to use `cfdns` is as an on-boot script, or as a daemon, but in those\nsituations where you wish to run the tool by hand, see the output of `cfdns help` for usage instructions.\n\n## Configuration\n\nRegardless of how you run `cfdns`, you'll need to configure it. You can pass flags manually, or you can use\na `config.toml` that you must place in one of the following directories, depending on your usage:\n\n* On a UDM Pro: `/mnt/data/cfdns/etc/config.toml`\n* On a UDR/UDM SE: `/data/cfdns/etc/config.toml`\n* On a desktop system: either `$XDG_CONFIG_HOME/cfdns/config.toml` or `$HOME/.config/cfdns/config.toml`\n\nYou can also pass `--config \u003cpath\u003e` or export `CONFIG=\u003cpath\u003e` in your shell, to override where the config file is pulled from.\n\nThe configuration is expressed as a TOML file, and is designed to be flexible enough to support updating DNS records in multiple\nzones and potentially multiple accounts. In short, the process looks like this:\n\n1. Define which interfaces to monitor, and on what interval (in seconds) you want to check for changes\n2. Configure what zones you are managing. Each zone must be assigned an API token you create [in the dashboard](https://dash.cloudflare.com/profile/api-tokens).\n3. Define what records you want to update, by specifying the record details and binding the record to an interface and zone\n\nAt runtime, this configuration is transformed into a set of watcher threads, one for each unique combination of interface and API token,\neach of which handle updating all of the records bound to that interface and token.\n\nFor an example of what a simple configuration looks like, see below:\n\n```toml\n# Configures monitoring of the wan0 interface every 15m\n[[interfaces]]\nname = \"wan0\"\ninterval = 900\n\n# Configures the API token to use when updating records in the 'example.com' zone\n[[zones]]\nname = \"example.com\"\ntoken = \"TOKEN\"\n\n# Binds foo.example.com to the wan0 interface address, managed via the 'example.com' zone\n[[records]]\ninterface = \"wan0\"\nzone = \"example.com\"\n# Supported types are A and AAAA (IPv4 vs IPv6 respectively)\ntype = \"A\"\nname = \"foo.example.com\"\n# The following are optional settings for the DNS record:\n# proxied = false\n# ttl = 1\n```\n\n# License\n\nMIT or Apache 2. Your choice.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitwalker%2Fcfdns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitwalker%2Fcfdns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitwalker%2Fcfdns/lists"}