Skip to content

whatever4711/Freenom-dns-updater

 
 

Repository files navigation

Build Status

Freenom dns updater

A tool written in python to update freenom's dns records

Main Features

  • Manage (add/update/remove) a domain's dns record with cli
  • Automatic records updates according to ip (v4/v6) changes

Upcoming features

  • Auto renew domains

Usage

Basic usage

Let's say you want to add or update your main A/AAAA domain records exemple.tk with your current ip (v4/v6). Simply type :

fdu record update $LOGIN $PASSWORD exemple.tk

Note that if you don't have a ipv6 access, the tool will detect that and will update only the A record (ipv4) of exemple.tk.

In order to add or update the subdomain sub.exemple.tk:

fdu record update $LOGIN $PASSWORD exemple.tk -n sub

Advanced usage

If you want to update multiple (sub)domains you could call the tool for each domains. Even better, you can create a configuration file.
A configuration is a YAML file, which look like :

login: yourlogin@somemail.domain
password: yourpassword

# list here the records you want to add/update
record:
  # the following will update both the A and AAAA records with your current ips (v4 and v6).
  # Note that if you don't have a ipv6 connection, the program'll detect it and will only update the A record (ipv4)
  - domain: test.tk

  # the following will update both your subdomain's A and AAAA records with your current ips (v4 and v6)
  - domain: test.tk
    name: mysubdomain

  # here's more advanced exemples

  # the following will update the AAAA record with a specified ipv6
  - domain: test2.tk
    name: # you can omit this line
    type: AAAA
    target: "fd2b:1c1b:3641:1cd8::" # note that you have to quote ipv6 addresses
    ttl: 24440

  # the following will update your subdomain's A record with your current ip (v4)
  - domain: test2.tk
    name: mysubdomain
    type: A
    target: auto # you can omit this line


  # you can omit the record type and give only ipv4 or ipv6 addresses.
  - domain: test2.tk
    name: ipv6sub
    target: "fd2b:1c1b:3641:1cd8::"

  - domain: test2.tk
    name: ipv4sub
    target: "64.64.64.64"

In order to use such configuration, you can use the following command :

fdu update /path/to/config

Where /path/to/config can be either:

  • A path to a file (default location is /etc/freenom.yml)
  • A http url (a raw secret gist for instance)

Schedule

In order to launch regularly an update, you can launch the tool with :

fdu process -c -i -t 3600 /path/to/config

Where the params are :

param description
-c cache the ip and update only if there is any changes
-i ignore errors when updating
-t time (in second) to wait between two updates
/path/to/config a path or a url to a configuration file

Docker image (multiarch)

Known issues

59e09ff8f12ef0baadfdac37b8ebbe7cf445c98f

Start fdu

Start fdu by calling docker run whatever4711/freenom:amd64-latest, which executes all previous commands inside a container.

Docker compose

version: '3'
services:
  freenom:
    image: whatever4711/freenom:amd64-latest
    restart: always
    volumes:
      - /your/path/to/freenom.yml:/etc/freenom.yml
    command: ["process", "-c", "-t", "3600", "/etc/freenom.yml"]

Ipv6

Note that if you want to use the ipv6 functionality, you have to enable the docker ipv6 stack

About

A tool to update freenom's dns records

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 53.4%
  • HTML 44.0%
  • Makefile 2.6%