Skip to content

joelpurra/loopia-api-dyndns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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!