Coder Social home page Coder Social logo

noip-rfc2136's People

Contributors

frillip avatar ghjklw avatar marrold avatar

Stargazers

 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

noip-rfc2136's Issues

Needs a config file

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?

Attempting to update a non-existant record results in a 500 response

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:

  1. Should noip-rfc2136 be able to create new records? Maybe there should be a config option so the user can decide?
  2. Should noip-rfc2136 catch the exception and send a more meaningful reply?

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

Docker container

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.

The service can't be configured using only environment variables

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:

  • A quick fix where we'd rather load every parameter from either the config file or the environment variable, and then check whether all the required parameters have been set, rather than checking whether config.yaml exists.
  • Using a library like OmegaConf or Dynaconf. I think this could actually simplify a bit the code and easily enable additional options (like CLI parameters).

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 ๐Ÿ˜‰

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.