Giter Club home page Giter Club logo

ddns-cloudflare-bash's Introduction

Portfolio

Stas Yakobov aka fire1ce

• I'm security researcher - specialized in hardware pentetrations tests

• I like experimenting with technologies, building small projects, automate everything.

• Passionate about security, linux, dockers, electronics(IoT), coding, open-source and knowledge

• I'm the owner and the maintener of a 3os.org knowledge-base website

How To Reach Me

github linkedin twitter reddit

stats

ddns-cloudflare-bash's People

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  avatar  avatar  avatar  avatar  avatar

ddns-cloudflare-bash's Issues

API Authentication Error

I've run the script and gotten the following in my output(separately):

update-cloudflare-dns.sh: line 110: [: ==: unary operator expected

{"success":false,"errors":[{"code":10000,"message":"PUT method not allowed for the api_token authentication scheme"}]}

Steps to reproduce:

  1. Download script and config
  2. Set Zone ID and API Token (DNS Permissions for this zone only)
  3. Set domain
  4. Run script

Message says "success" but the record not updated

I'm using this script on my Seagate NAS box with Linux 6.1.28-sc armv6l. When the script is executed, the returned message is as below:
root@Seagate-xxxxx:~# update-cloudflare-dns.sh /usr/local/bin/update-cloudflare-dns.sh: line 13: /dev/fd/62: No such file or directory ==> 2023-12-22 08:55:08 ==> External IP is: xx.x.xx.xx /usr/local/bin/update-cloudflare-dns.sh: line 129: [: ==: unary operator expected ==> DNS record of xxx.xxx.com is: . Trying to update... ==> Success! ==> xxx.xxx.com DNS Record updated to: xx.xx.xx.xx, ttl: 120, proxied: true
So, there are some errors but the last 2 lines seems to indicate a successful record updated. When I check the actual dns record at Cloudflare, it remains unchanged.

The aip token is verified to work. What may be the issue here?

static internal ip

Hi!

Did you consider using a static IP for the internal IP option? I mean, instead of trying to guess what (private) IP is running the script, maybe you need to use a different and static IP for a certain domain.

Use case:

  • Im using a raspberry pi as VPN and DDNS. It runs in this script at 192.168.111.111.
  • I want to point internal.mydomain.io to 192.168.112.112 where is my internal load balancer for Kubernetes.

Do you think it could be possible to implement?

Thanks

Script updates only first domain, not second

cloudflare User API Token:

All zones - DNS:Edit

update-coudflare-dns.conf:

what_ip="external"
dns_record="url-1.com,url-2.com"
zoneid="zoneID-of-url-1"
cloudflare_zone_api_token="user-api-token"
proxied="false"

CONDITION NORMAL (all DNS records have correct IP):
update-cloudflare-dns-log:

==> 2024-05-06 09:00:01
==> External IP is: 1.1.1.1
==> DNS record IP of url-1.com is 1.1.1.1, no changes needed.
==> DNS record IP of url-2.com is 1.1.1.1, no changes needed.

CONDITION IP CHANGED:
update-cloudflare-dns-log:

==> 2024-05-06 09:01:01
==> External IP is: 1.1.1.2
==> DNS record of url-1.com is: 1.1.1.1. Trying to update...
==> Success!
==> url-1.com DNS Record updated to: 1.1.1.2, ttl: 1, proxied: false
==> DNS record of url-2.com is: 1.1.1.1. Trying to update...
{"success":false,"errors":[{"code":10000,"message":"PUT method not allowed for the api_token authentication scheme"}]}
Error! Update failed

STEPS TAKEN:
Tried adding zoneID-of-url-2 as follows:

what_ip="external"
dns_record="url-1.com,url-2.com"
zoneid="zoneID-of-url-1,zoneID-of-url-2"
cloudflare_zone_api_token="user-api-token"
proxied="false"

RESULTS:

==> 2024-05-06 09:02:01
==> External IP is: 1.1.1.2
==> DNS record IP of url-1.com is 1.1.1.2, no changes needed.
==> DNS record of url-2.com is: 1.1.1.1. Trying to update...
{"success":false,"errors":[{"code":7003,"message":"Could not route to \/zones\/zoneID-of-url-1,zoneID-of-url-2\/dns_records, perhaps your object identifier is invalid?"},{"code":7000,"message":"No route for that URI"}],"messages":[],"result":null}
Error! Can't get url-2.com record information from Cloudflare API

I'm assuming only one zoneid should be entered in the conf.

  • How then does the script work to update dns of zones outside the first zoneid?

Or perhaps both zoneid's need to be listed.

  • How does the script delimit zoneid's since commas didn't work?

Or perhaps the domains need to be in same zone.

  • How to put multiple domains in same zone?

Any tips?

API issue

root@TESTSRV:~# update-cloudflare-dns
==> 2022-05-26 21:38:05
==> External IP is: 99.88.77.66
==> DNS record of sub.somedomain.tld is: 12.34.56.78. Trying to update...
{"success":false,"errors":[{"code":7003,"message":"Could not route to /zones/somedomain.tld/dns_records, perhaps your object identifier is invalid?"},{"code":7000,"message":"No route for that URI"}],"messages":[],"result":null}
Error! Can't get sub.somedomain.tld record inforamiton from cloudflare API

Config file as parameter

Hi,
Found your script very useful.
I know that for multiple domains and single IP I can use CNAME record to set IP once for all.
But having multiple domains and multiple IPs requires probably separate config file.

Could you consider adding config file as parameter with fallback to default one when no parameter presented ?

[EDIT]
As I see it is not working with CNAME records.
Second idea is multiple domains in dns_record parameter, or maybe both ideas (config file as parameter + multidomain update)

False Alerts

Once in a while, I would get an alert that IP updated. I am using CLoudFlare and when i log in to check, the IP on CF was never changed. Also i checked my pfsense and the adaptor never changed as well. This happens to me 2 to 3 times a month.

Is there something I can add to the script to better handle this?

Script doesn't exit

Love the script, thank you! My only question is when you run it, it doesn't actually seem to exit? It just hangs. Not sure how that impacts when running under crontab (bunch of zombie processes?)

Cheers!

Multiple A records not wokring.

Multiple A records is not working.

Love it in general though, Thank you!

ubuntu@dtest4:~$ sudo /usr/local/bin/update-cloudflare-dns.sh
==> 2023-08-24 00:10:15
==> Internal eth0 IP is: 172.31.173.179
==> DNS record IP of redis.bob.us is 172.31.173.179, no changes needed.
==> DNS record of db.bob.us is: 172.31.161.143. Trying to update...
{"success":false,"errors":[{"code":10000,"message":"PUT method not allowed for the api_token authentication scheme"}]}
Error! Update failed

For now I am just running 2 scripts instead of just one. It would be nice to fix it though.

Thanks, DL

ps I scrubbed my domain names for privacy/security

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.