Giter Club home page Giter Club logo

loopia-api-dyndns's Introduction

Loopia API logotype

A script to dynamically update the IPv4/IPv6 DNS records for domain names registered with Loopia.

  • Used as a replacement for the Loopia DynDNS tools, which do not support IPv6.
  • Expected to execute on the computer which the domain name should point to.
Features
  • Uses Loopia API to replicate DDNS functionality.
    • Uses minimal API permissions.
      • The script does not create new A/AAAA records.
      • The script does not delete extraneous A/AAAA records.
    • For unknown errors, please check the Loopia API status.
  • Based on the official sample script, with a few modifications.
    • Uses environment variables for configuration.
    • Supports both IPv4 (A) and IPv6 (AAAA) DNS records.
    • Simplified to only update existing records, not create nor delete records.
    • Does not update records if the IP address has not changed.
  • Uses the ipify API to automatically look up the public IP addresses from computer using the script.
Compared to alternatives

The list is non-exhaustive.

Software IPv4 IPv6 Configuration Other
loopia-api-dyndns Environment variables. Minimal API permissions.
Loopia DynDNS - Depends on the client. Supports multiple client implementations, such as DDClient.
Loopia API's official sample script - Does not separate configuration from code.
loopiaupdate - Configuration file in $HOME, optionally command line arguments. Can create subdomains as needed. Requires additional permissions.
loopia-updater - Configuration file in $HOME, optionally command line arguments. Can update multiple domains with a single call.

Requirements

  • IPv4 and IPv6 internet connectivity from the computer using the script.
  • A Loopia API user. Create a new one in the Loopia Customer Zone.
    • Enable only these permissions, and nothing else.
      • getZoneRecords: query which record to update.
      • updateZoneRecord: update the zone record.
  • A domain name registered with Loopia.
    • Exactly one A and one AAAA record already set up for the domain/subdomain to update.
    • Use Loopia's DNS editor to manually create the initial A and AAAA records.
  • Python v3 to execute the script.

Configuration

Set your own values using environment variables before executing the script.

Name Required Examples Description
LOOPIA_API_USERNAME someone@loopiaapi Username chosen when creating the API user. Always ends with @loopiaapi.
LOOPIA_API_PASSWORD Password chosen when creating the API user.
LOOPIA_DOMAIN example.com The second-level domain name (SLD) to update. Required also when updating only a specific subdomain.
LOOPIA_SUBDOMAIN my-computer, server01.farm, @ The specific subdomain to update. May be dot-separated to specify a deeper subdomain. To update the SLD, set this value to @.

Usage

Execute the script as often as you'd like, manually or automatically.

  • How often an update is needed depends on how often your public IP address changes.
  • Use, for example, systemd.timer or cron to schedule updates.
loopia-api-dyndns
Output
  • Simple status messages on stdout.
  • Error messages go to stderr.
  • Exit code 0 for good results, non-zero for bad results.
server01.farm.example.com A: OK (11.22.33.44)
server01.farm.example.com AAAA: OK (2a01:11:2222:33:444:55:6666:77)

loopia-api-dyndns Copyright © 2020 Joel Purra. Released under GNU General Public License version 3.0 (GPL-3.0). Your donations are appreciated!

loopia-api-dyndns's People

Contributors

joelpurra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

loopia-api-dyndns's Issues

Use multiple public IP address API providers?

One point of failure for loopia-api-dyndns is the public IPv4/IPv6 address lookup API service providers. Unfortunately, they aren't always reliable.

  • The previous provider, IP.sb API went offline long enough to be noticeable (a1d48e0).
  • The current provider ipify API has ended up on some ad blocking domain lists. (Unsure why?) If the service DNS lookup fails, so does the IP address lookup.

The only API function is very simple -- echo the IP address the HTTPS call came from, and to provide separate IPv4/IPv6 endpoints. While "anyone" could set up a public server performing the same service, reliability is a factor for loopia-api-dyndns to function well. I wouldn't trust myself with such a service. (Point in case: most of my own domains are currently offline due to hardware failure, and it'll take days before everything is restored.)

  • Perhaps it would make sense to make calls to several providers, and use the ones which reply?
  • Would use (at least) three providers, such that if a minority echos different IP address (presumably due to an error) it could be detected and the majority response used.
  • Could hardcode/cache provider's IP addresses, as additional fallbacks in case DNS fails.

These suggestions are of course overkill for this simple piece of code. The first step should be to find a reliable, non-blocked provider. Suggestions welcome.

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.