Live data from Hacker News

Free DDNS with Cloudflare and a cronjob

github.com

81–90 of 202 posts

Re: Free DDNS with Cloudflare and a cronjob

#81
Some time ago, I built a similar project: https://github.com/dethos/worker-ddns

The main difference is that, for security reasons, it uses a "Cloudflare worker" to change the DNS record.

> Since Cloudflare API Token permissions aren't granular enough to limit the token access to a single DNS record, we place a worker in front of it (this way the token with extra priviledges never leaves cloudflare's servers).

It works very well, no complaints until now.

Re: Free DDNS with Cloudflare and a cronjob

#82

Seems to rely on https://api.ipify.org/ to determine public IP. Is there any Cloudflare service one can use to determine the IP instead? That way there’s not an extra company in addition to Cloudflare itself that you need to continue existing.

there's a way to tell caddy server to host its own access.log

So you have some junk VPS or whatever that just has caddy hosting its log with an easy to remember domain (they're cheap enough), and you go like "curl http://easydomain.com/idreallylikemyip" and then once more: curl http://easydomain.com/N | grep "idreallylikemyip"

the code that used to work is on my github, i uploaded it there a week or two ago. Someone who needs a way to find out the public ipv4 of any device not just their own can probably figure out how to get it to work again!

Re: Free DDNS with Cloudflare and a cronjob

#83
post #78

Earlier quoted context omitted.

Yes, but getting it in a response from an external server means I don’t have to be specific about which interface to get the IPv6 address of and so on.

the same specific interface used to contact the external server

i.e., an arbitrarily-selected interface capable of reaching Cloudflare.

Re: Free DDNS with Cloudflare and a cronjob

#86

Earlier quoted context omitted.

If someone finds LetsEncrypt challenging, they don't have sufficient network andsystem administrator skills to be running a private, public-facing web server. They should be running tailscale.

Parent did not say it was challenging. I find fiddling with LE tedious because it has to be repeated too often.

certbot and crontab needs to be setup just once, to solve cert problem

Re: Free DDNS with Cloudflare and a cronjob

#87
post #62

I wanted to do this a long time ago but I wouldn't trust my router with a Cloudflare API key. Paranoid or is there a way to limit that key to one domain or, even better, one DNS entry?

you can setup the job on your trusted machine behind the router, could be raspberry pi or your desktop

Re: Free DDNS with Cloudflare and a cronjob

#88

Earlier quoted context omitted.

If someone finds LetsEncrypt challenging, they don't have sufficient network andsystem administrator skills to be running a private, public-facing web server. They should be running tailscale.

Well, one of the "challenges" is the one in a different comment: most registrars don't allow fine-grained control over who can update what DNS records. Can it be done? Sure. But do I want to spend money on this for my home lab if I can work around it? Not a chance. I'm kinda sensitive to the "MITM as a service" argument, but for my use case, it's not a problem.

You don’t need automated DNS fiddling for lets encrypt. Certbot can either hook into Apache or NGINX, or run its own standalone server for verification.

Re: Free DDNS with Cloudflare and a cronjob

#89

Instead of using DDNS, I have been using Cloudflare tunnels to expose my home services to the internet. The setup is much simpler and it seems like it's more secure too You specify a port and point it to a subdomain and it just immediately works, no maintenance necessary. The daemon only needs to be installed once with a simple terminal command

I do the same with tailscale, which has a nice friendly UI for setting everything up.

I setup some Cloudflare DNS records to the tail scale 100.x IPs to make them easy to remember.

Re: Free DDNS with Cloudflare and a cronjob

#90

Seems to rely on https://api.ipify.org/ to determine public IP. Is there any Cloudflare service one can use to determine the IP instead? That way there’s not an extra company in addition to Cloudflare itself that you need to continue existing.

there's a way to tell caddy server to host its own access.log So you have some junk VPS or whatever that just has caddy hosting its log with an easy to remember domain (they're cheap enough), and you go like "curl http://easydomain.com/idreallylikemyip " and then once more: curl http://easydomain.com/N | grep "idreallylikemyip" the code that used to work is on my github, i uploaded it there a week or two ago. Someone…

You can have Caddy return the user's IP address directly: https://caddy.community/t/caddy-server-that-returns-only-ip-...

Similar things are also possible with nginx and Apache.

Post reply on HN