frillip / noip-rfc2136 Goto Github PK
View Code? Open in Web Editor NEWSimple HTTP(S) server that pretends to be a No-IP compatible DynDNS service, but actually performs RFC2136 updates to a DNS server.
License: MIT License
Simple HTTP(S) server that pretends to be a No-IP compatible DynDNS service, but actually performs RFC2136 updates to a DNS server.
License: MIT License
Editing variables in the main script is a terrible way of configuring things.
Proposed YAML config:
noip-rfc2136:
dns:
nameserver: 198.51.100.2
zone: example.com.
ttl: 30
tsig_key_name: example_key_name
tsig_key_secret: aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1vSGc1U0pZUkhBMA==
tsig_key_algorithm: hmac-sha256
listen:
host: 127.0.0.1
port: 8000
https:
enabled: False
key_file: /etc/letsencrypt/live/example.com/privkey.pem
cert_file: /etc/letsencrypt/live/example.com/fullchain.pem
auth:
enabled: False
user: user
pass: pass
log:
level: INFO
@marrold whilst I'm meddling with build_conf()
, I will update the environment variable names to be uppercase and prefixed with NOIP_RFC2136_
, so the name server variable will end up being NOIP_RFC2136_DNS_NAMESERVER
, unless you have any objections?
I wasn't going to raise this one but as there's a bit of activity it's reminded me - if you try to update a DNS record that doesn't exist the logs show an exception and the server replies with a 500 error.
This raised a few questions:
Having checked the code this is because resolver.query(fqdn, 'A')
fails. There's an attempt to catch the exception but it's attempting to print current_ip
to the log which hasn't been assigned, so it causes the below exception:
Error handling request
Traceback (most recent call last):
File "/opt/venv/noip-rfc2136.py", line 73, in GetCurrentIP
answer = resolver.query(fqdn, 'A')
File "/opt/venv/lib/python3.8/site-packages/dns/resolver.py", line 1002, in query
raise NXDOMAIN(qnames=qnames_to_try, responses=nxdomain_responses)
dns.resolver.NXDOMAIN: The DNS query name does not exist: pi-11.wd18.marrold.co.uk.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/opt/venv/lib/python3.8/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/opt/venv/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/opt/venv/lib/python3.8/site-packages/aiohttp_basicauth_middleware/__init__.py", line 79, in middleware
return await handler(request)
File "/opt/venv/noip-rfc2136.py", line 156, in UpdateReq
current_ip = GetCurrentIP(fqdn)
File "/opt/venv/noip-rfc2136.py", line 80, in GetCurrentIP
logger.debug('No IP in DNS for ' + str(current_ip))
UnboundLocalError: local variable 'current_ip' referenced before assignment
Thanks for this very useful tool :)
It would be great to have it also available as a docker container (+ use releases and GitHub actions to automatically publish new versions to docker hub).
If you're interested, I'd be happy to create a pull request. I have a working version, it just needs a bit of clean-up/documentation.
Hi!
If no config.yaml
file is present, the script will exit with the error message "Error loading config: 'config.yaml' not found". This seems to defeat the purpose of being able to configure it through environment variables.
I can think of 2 ways to solve it:
config.yaml
exists.I'd be happy to create a pull request based on either of these options, but would like to get your thoughts before putting any effort into it ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.