Code Monkey home page Code Monkey logo

cloudflare-dyndns's People

Contributors

dependabot[bot] avatar fabaff avatar kissgyorgy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cloudflare-dyndns's Issues

exit code crash

with v4.0-beta2:

Traceback (most recent call last):
  File "/app/.local/bin/cloudflare-dyndns", line 5, in <module>
    main()
  File "/app/.local/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/app/.local/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/app/.local/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/app/.local/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/app/.local/lib/python3.9/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/app/cloudflare_dyndns/cli.py", line 246, in main
    exit_codes.remove(0)
KeyError: 0

Implement IP lookup by DNS

DNS lookups are orders of magnitudes faster, for example:

$ time dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
"188.6.90.5"
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com  0,01s user 0,01s system 19% cpu 0,081 total

Implement DNS lookups by using the dnslib library. Example client implementation: https://bitbucket.org/paulc/dnslib/src/default/dnslib/client.py

$ pip3 install dnslib
$ python3 -m dnslib.client --short --server ns1.google.com o-o.myaddr.l.google.com TXT

There are multiple DNS providers which will respond with the requester IP address:
https://code.blogs.iiidefix.net/posts/get-public-ip-using-dns/

Note: Only implement DNSSEC-enabled DNS services, otherwise the security of this would be worse than a https call.

Validate Cloudflare API token

curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \
     -H "Authorization: Bearer <bearer-token-from-dashboard>" \
     -H "Content-Type:application/json"

Specify IP as a parameter

I don't want to set the DNS to the machine's address I'm running the script from. For my use case I need to be able to set it manually.

macos: document how to get TLS CA certs?

Thanks for the excellent tool, which successfully updated my cloudflare account info.

However, running on macos, certs are missing:

OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /etc/ssl/certs/ca-certificates.crt

Can you add to documentation a summary for this, like the following:


For Macos, please provide a certficate CA file something like this:

sudo port install curl-ca-bundle # use macports to download CA certs
sudo cp /opt/local/share/curl/curl-ca-bundle.crt   /etc/ssl/certs/ca-certificates.crt

Just updates only one A record

I have more than one record, but only updates the first one

cloudflare-dyndns --proxied --api-token **************** domain.pt --force

Get IP only and exit

A "What's my IP functionality". Useful for debugging problems, especially after IPv6 support.

Use API Tokens instead of Global API Key

I tried to use the API Tokens (with DNS edit settings); which failed.

It requires the global API Key to work -- but that gives full access to the account and is not ideal.

Proxied option instead of DNS only

Love the project but is it possible to have a variable to toggle between proxied and DNS-only modes?
Currently it defaults to DNS-only mode.

Support IPv6

It currently only updates A records.

If IPv6 is detected it woud be nice if it updated the AAAA record as well (if IPv6 is not detected and an AAAA record exists, it should be cleared).

Thanks

cache is overwritten even when not changed

This is a very nice tool, thank you! I hope to use it to replace my own home-grown version of roughly the same thing.

One thing I noticed is that the cache file ~/.cache/cloudflare-dyndns/ip.cache gets overwritten on every invocation of the program, even if nothing has changed. It's just a few hundred bytes, yes, but on flash storage this equates to at least a 4kB or more write depending on the hardware and filesystem. In the grand scheme of things, very likely not a big deal, but it would be nice to do the right thing if possible.

I haven't had the time to fully understand the flow of things, but two approaches that I can think of:

  1. Track changes to the cache somehow and mark the cache as "dirty" when a value is written. Then, only write when the cache is dirty.
  2. Before writing the cache file, read the existing file and compare the JSON. Only trigger a write when they differ.

One workaround for those who are concerned about unnecessary writes could be to store the cache file on a RAM-backed filesystem, e.g. /dev/shm/ip.cache.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.