Code Monkey home page Code Monkey logo

porkbun-dynamic-dns-python's People

Contributors

eddie-porkbun avatar rossporkbun 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

porkbun-dynamic-dns-python's Issues

Suggestion... instead of deleting and then recreating DNS record, can the script check first for the value, and only recreate if necessary?

So it appears that the script will automatically delete the record, and then recreate the record with the new value.

But if the IP address has not changed, wouldn't it be more efficient to just query for the current IP address value, and then only take some action if the desired value differs from the existing value?

I've heard it suggested around the internet to run DDNS scripts like every 10 minutes. If the record is constantly being destroyed and recreated, this makes me worry that I might be causing some operational stress to Porkbun or to the DNS system as a whole by replacing the record so frequently.

I might just be overthinking this, though. Anyway, thanks!

Suggestion. Limit DDNS to named domains, subdomains

Hi,
I've always shied away from using API based DDNS updaters such as this one, and Cloudflares, as the API key has access to the entire account, and as such is a security risk. If an API key were to be limited to a single domain within the account, or, even better, if you could activate it on a single subdomain, that would make it a lot more attractive.

Auto IP detection returning IPv6 for A record creation

I tried to test this out with a domain I just purchased, and the auto IP detection code returned my IPv6 address. The script then made an A record using that address. From what I understand, an AAAA record would be needed for an IPv6 address, right? (I wasn't able to successfully get to my network with it as-is anyway.)

I'm not sure if it would be better to find a way to force the IP detection code for IPv4 or check for the returned address and choose the record accordingly. (Being able to detect and set both is probably preferable, but I understand if that's out of the intended scope for this script.)

Let me know if there's any other information I can provide that would help.

P.S. Thanks for releasing this script! Looks like it's a pretty new release (and I don't remember coming across it in the Porkbun knowledge base when I first started looking at purchasing a domain name earlier this year), and I'm glad to see an example of how the API can be used. I also just happened across the Java client (which was listed but not linked in the KB article, but is linked in the API reference), and it seems IPv6 handling was addressed in some form there a little over a week ago.

DDNS for IPv6

Hi,
Would be possible to update the script for IPv6 support? As far I understand the script is supporting just IPv4.
Thanks

Update AAAA records

How come this can't update AAAA records well it looks like the java version can?

OK if anyone else is looking to do this remove the ipv4 form the api in the config file and change the type from A to AAAA. This well then update those records.

JSON Decode Error

I set the script up to run on reboot to update a bunch of domains. It worked for a few of them, but most failed.
This is a snippet from my CRON log:

Subject: Cron <k****u@the-server> /bin/python3 /External/porkbun-dynamic-dns-python/porkbun-ddns.py /External/porkbun-dynamic-dns-python/config.json s*******k.cloud -i ${myip}
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/k****u>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=k****u>
Message-Id: <[email protected]****h>
Date: Mon, 21 Jun 2021 00:22:04 -0500 (CDT)

Deleting existing A Record
Creating record: sudoz***k.cloud with answer of 67.***.***.217
Traceback (most recent call last):
  File "/External/porkbun-dynamic-dns-python/porkbun-ddns.py", line 50, in <module>
    print(createRecord()["status"])
  File "/External/porkbun-dynamic-dns-python/porkbun-ddns.py", line 28, in createRecord
    create = json.loads(requests.post(apiConfig["endpoint"] + '/dns/create/'+ rootDomain, data = json.dumps(createObj)).text)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

From k****[email protected]****h  Mon Jun 21 00:22:04 2021
Return-Path: <k****[email protected]****h>
X-Original-To: k****u
Delivered-To: k****[email protected]****h
Received: by the-server.T****h (Postfix, from userid 1000)
        id DBA18EC0AE; Mon, 21 Jun 2021 00:22:03 -0500 (CDT)
From: [email protected]****h (Cron Daemon)
To: k****[email protected]****h
Subject: Cron <k****u@the-server> /bin/python3 /External/porkbun-dynamic-dns-python/porkbun-ddns.py /External/porkbun-dynamic-dns-python/config.json z***k.download -i ${myip}
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/k****u>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=k****u>
Message-Id: <[email protected]****h>
Date: Mon, 21 Jun 2021 00:22:03 -0500 (CDT)

Traceback (most recent call last):
  File "/External/porkbun-dynamic-dns-python/porkbun-ddns.py", line 47, in <module>
    myIP=getMyIP() #otherwise use the detected exterior IP address
  File "/External/porkbun-dynamic-dns-python/porkbun-ddns.py", line 14, in getMyIP
    ping = json.loads(requests.post(apiConfig["endpoint"] + '/ping/', data = json.dumps(apiConfig)).text)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

From k****[email protected]****h  Mon Jun 21 00:22:04 2021
Return-Path: <k****[email protected]****h>
X-Original-To: k****u
Delivered-To: k****[email protected]****h
Received: by the-server.T****h (Postfix, from userid 1000)
        id B2D57EC0AE; Mon, 21 Jun 2021 00:22:04 -0500 (CDT)
From: [email protected]****h (Cron Daemon)
To: k****[email protected]****h
Subject: Cron <k****u@the-server> /bin/python3 /External/porkbun-dynamic-dns-python/porkbun-ddns.py /External/porkbun-dynamic-dns-python/config.json z***k.family www -i ${myip}
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/k****u>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=k****u>
Message-Id: <[email protected]****h>
Date: Mon, 21 Jun 2021 00:22:04 -0500 (CDT)

Deleting existing A Record
Creating record: www.z***k.family with answer of 67.***.***.217
Traceback (most recent call last):
  File "/External/porkbun-dynamic-dns-python/porkbun-ddns.py", line 50, in <module>
    print(createRecord()["status"])
  File "/External/porkbun-dynamic-dns-python/porkbun-ddns.py", line 28, in createRecord
    create = json.loads(requests.post(apiConfig["endpoint"] + '/dns/create/'+ rootDomain, data = json.dumps(createObj)).text)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

From k****[email protected]****h  Mon Jun 21 00:22:04 2021
Return-Path: <k****[email protected]****h>
X-Original-To: k****u
Delivered-To: k****[email protected]****h
Received: by the-server.T****h (Postfix, from userid 1000)
        id B8883EC0AE; Mon, 21 Jun 2021 00:22:04 -0500 (CDT)
From: [email protected]****h (Cron Daemon)
To: k****[email protected]****h
Subject: Cron <k****u@the-server> myip="$(dig +short myip.opendns.com @resolver1.opendns.com)" && /bin/python3 /External/porkbun-dynamic-dns-python/porkbun-ddns.py /External/porkbun-dynamic-dns-python/config.json z***k.io -i ${myip}
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/k****u>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=k****u>
Message-Id: <[email protected]****h>
Date: Mon, 21 Jun 2021 00:22:04 -0500 (CDT)

Deleting existing A Record
Creating record: z***k.io with answer of 67.***.***.217
SUCCESS

Thanks for making this, really appreciate it!

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.