https://github.com/bendem/cf-dyndns-worker
A CloudFlare worker that updates dns records
https://github.com/bendem/cf-dyndns-worker
cloudflare-worker cloudflare-workers dyndns
Last synced: 18 days ago
JSON representation
A CloudFlare worker that updates dns records
- Host: GitHub
- URL: https://github.com/bendem/cf-dyndns-worker
- Owner: bendem
- License: gpl-3.0
- Created: 2020-04-10T18:09:52.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-13T16:09:20.000Z (about 5 years ago)
- Last Synced: 2024-08-02T15:53:50.216Z (9 months ago)
- Topics: cloudflare-worker, cloudflare-workers, dyndns
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 13
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A dyndns provider in a CloudFlare worker
With me using CloudFlare and CloudFlare providing free workers, why would I bother with shady dyndns providers, it should be simple enough to implement myself.
This is what I came up with.
## Setup
You need wrangler to set this up.
You'll also need to create a few secrets (`wrangler secret put [-e prod] `):
* `CF_TOKEN`: a token with edit permission on the zone's DNS (go to [your profile](https://dash.cloudflare.com/profile/api-tokens) and create a token with the `DNS:Edit` permission on your CF Zone)
* `CF_ZONE`: the CF zone id, as listed on the dashboard of the zone (scroll down, it's in the sidebar)
* `DOMAIN`: the record in the zone to set
* `PASSWORD`: the key to use to make sure people don't just update your DNS...```bash
wrangler publish -e prod
```### Setup notes
I recommend setting the `DOMAIN` secret to a random sub domain and then pointing a CloudFlare proxied CNAME to it. That way, it is harder to find out what your home IP is.
## Routes
* `/dyndns`: the URL you should point your script to. Accepts the following get parameters:
* `ipv4`: the new IPv4
* `ipv6`: the new IPv6
* `password`: the password you chose in the step above
* `/current-ip`: returns the IP of the caller (use `curl -4` or `curl -6` to make sure you get the right IP)
* Note that the IPv6 returned here is not necessarily the IP of your router since NATing is not always used with IPv6