Code Monkey home page Code Monkey logo

Comments (11)

ptts avatar ptts commented on July 29, 2024 3

Another option would be to split API Tokens like this:
Apart from the regular API_KEY there could be an additional, optional variable ZONE_API_KEY.
API_KEY is used to change DNS records, ZONE_API_KEY is used to resolve a zone name to a zone id. If no ZONE_API_KEY is supplied it is set equal to API_KEY at launch.

This would allow users to create two create more narrowly defined scopes.
For API_KEY:
Token permissions: Zone - DNS - Edit
Zone resources: Include - Only the domain's zone

For ZONE_API_KEY:
Token permissions: Zone - Zone Settings - Read / Zone - Zone - Read
Zone resources: Include - All zones

from docker-cloudflare-ddns.

ptts avatar ptts commented on July 29, 2024 1

Thanks! For a current project I am uncomfortable saving an API token that gives access to all of my managed domains in my personal zone on a machine... This would be a great and easy solution.

Looking into this more, it's probably not worthwhile because it also has implications on how the subdomain is computed (which is currently prepended to the zone). You would have to specify the fully-qualified record name yourself and further conditional logic.

I was looking at the code and I don't understand what implications it would have for the subdomain computation. If the user supplies the variables API_KEY, ZONE, ZONE_ID and SUBDOMAIN everything should work fine, right? Doesn't the user have to specify the full domain name anyway (as in SUBDOMAIN.ZONE?

What would happen if you just change the getZoneId() function to check for a supplied ZONE_ID environment variable and then return it instead of making an API call?

from docker-cloudflare-ddns.

JakeWharton avatar JakeWharton commented on July 29, 2024

It also means you only need to give access to a specific zone, rather than all zones.

from docker-cloudflare-ddns.

JakeWharton avatar JakeWharton commented on July 29, 2024

Looking into this more, it's probably not worthwhile because it also has implications on how the subdomain is computed (which is currently prepended to the zone). You would have to specify the fully-qualified record name yourself and further conditional logic.

Going to preemptively close since it would require too many changes for little benefit.

from docker-cloudflare-ddns.

ptts avatar ptts commented on July 29, 2024

I was just about to open a separate issue for this before I saw this one. The feature is supported for example here: https://github.com/joshuaavalon/docker-cloudflare

from docker-cloudflare-ddns.

JakeWharton avatar JakeWharton commented on July 29, 2024

I'll reopen then and let @oznu weigh in

from docker-cloudflare-ddns.

Appelg avatar Appelg commented on July 29, 2024

Yeah, we really need the split token approach here.

from docker-cloudflare-ddns.

hyperknot avatar hyperknot commented on July 29, 2024

Giving access to all zones is a blocker for me as well.

from docker-cloudflare-ddns.

mrhotio avatar mrhotio commented on July 29, 2024

I hate doing this, but seeing you all suffer like this is no picknick either...until oznu ever decides to pick up development again, have a look at https://github.com/hotio/docker-cloudflare-ddns

from docker-cloudflare-ddns.

oznu avatar oznu commented on July 29, 2024

I'll accept pull requests 😄

from docker-cloudflare-ddns.

stale avatar stale commented on July 29, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from docker-cloudflare-ddns.

Related Issues (20)

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.