{"id":20976586,"url":"https://github.com/dethos/worker-ddns","last_synced_at":"2025-10-30T00:40:50.911Z","repository":{"id":147367562,"uuid":"264772111","full_name":"dethos/worker-ddns","owner":"dethos","description":"Simple DDNS system using Cloudflare workers","archived":false,"fork":false,"pushed_at":"2024-08-24T08:37:06.000Z","size":8,"stargazers_count":22,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-14T14:45:47.108Z","etag":null,"topics":["cloudflare","cloudflare-workers","ddns","ddns-script","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dethos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-05-17T22:55:43.000Z","updated_at":"2025-05-06T12:11:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4e61c82-4403-46b2-800b-ffe1ac5e79d5","html_url":"https://github.com/dethos/worker-ddns","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dethos/worker-ddns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dethos%2Fworker-ddns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dethos%2Fworker-ddns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dethos%2Fworker-ddns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dethos%2Fworker-ddns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dethos","download_url":"https://codeload.github.com/dethos/worker-ddns/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dethos%2Fworker-ddns/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266983523,"owners_count":24016559,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cloudflare","cloudflare-workers","ddns","ddns-script","hacktoberfest"],"created_at":"2024-11-19T04:54:37.886Z","updated_at":"2025-10-30T00:40:50.850Z","avatar_url":"https://github.com/dethos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Worker DDNS\n\nThis repository provides two simple scripts that, together, will allow you to build a\nsimple and efficient DDNS system using Cloudflare Workers and DNS.\n\n**Example use case:** You have a machine where the IP address is dynamically assigned and\nchanges frequently.\n\nThe `agent.py` will regularly contact the CF worker running the `worker.js` code,\nthat will in turn use the Cloudflare API to update the DNS record in question\nwith the new IP address.\n\n## Why use Workers\n\nBecause we don't want to sign up for an extra external service, we want to apply\nthe principle of the least privilege, and the name should belong to a domain we\ncontrol.\n\nSince Cloudflare API Token permissions aren't granular enough to limit the token\naccess to a single DNS record, we place a worker in front of it (this way the token\nwith extra privileges, never leaves Cloudflare's servers).\n\n## Usage\n\nBoth scripts (`worker.js` and `agent.py`) don't require any extra dependencies\n(they rely only on the existing \"standard libraries\"), so they can be copied, right\nout of the repository to the destination without any extra steps.\n\nBefore starting, you need to create a new API Token on your Cloudflare's profile page with\npermissions to edit the DNS records of one of your domains (Zone).\n\n### Worker\n\nThe next step is to create a new worker and then set `worker.js` as its content.\nThis can be easily done using the \"Quick Edit\" button on the worker's detail page.\n\nAdd the following environment variables on the worker settings tab:\n\n- `CF_API_TOKEN` - The token you just created. You just also click on the\n  \"encrypt\" button.\n- `SHARED_KEY` - Generate a long and random string and put it here. Click encrypt.\n- `DNS_RECORD` - the DNS record that should be updated. Something like\n  `\u003csomename\u003e.\u003cyour-domain\u003e`.\n- `ZONE` - The zone_id of your domain. You can find it on the sidebar of the domain\n  overview page.\n\nThen deploy the worker.\n\n### Agent\n\nCopy the `agent.py` file to the machine where you want your subdomain/domain\n\"pointed to\".\n\nSet the following environment variables:\n\n- `SHARED_KEY` - The same long and random string you generated for the worker.\n- `WORKER_URL` - The URL of your worker.\n\nThen execute the script:\n\n```bash\n$ ./agent.py\n```\n\nIn the most common scenario, you will want to run it periodically. So you will need to\nuse a scheduler like `cron` or a `systemd timer unit`.\n\nHere's a simple example that can be inserted after running `crontab -e`:\n\n```\nSHARED_KEY=\u003cyour-generated-key\u003e\nWORKER_URL=\u003ccf-worker-url\u003e\n*/5 * * * *  /path/to/agent.py\n```\n\nOn the other hand, if you prefer to use `systemd`, the configuration would look like this:\n\n```\n# ddns.service\n\n[Unit]\nDescription=Updates the DNS record with IP address\nWants=ddns.timer\n\n[Service]\nEnvironment=\"SHARED_KEY=\u003cyour-generated-key\u003e\"\nEnvironment=\"WORKER_URL=\u003ccf-worker-url\u003e\"\nType=oneshot\nExecStart=/path/to/agent.py\n\n[Install]\nWantedBy=multi-user.target\n```\n\n```\n# ddns.timer\n\n[Unit]\nDescription=Runs the DDNS agent periodically\nRequires=ddns.service\n\n[Timer]\nUnit=ddns.service\nOnBootSec=60\nOnUnitActiveSec=5m\n\n[Install]\nWantedBy=timers.target\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdethos%2Fworker-ddns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdethos%2Fworker-ddns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdethos%2Fworker-ddns/lists"}