myanesp / ovh-ip-updater

Docker image for updating the DNS records of your OVH domain using its official API, instead of DynHost
GNU Affero General Public License v3.0
3 stars 1 forks source link

ovh-ip-updater

[]() Docker Pulls Docker Image Size Github last-commit Github license Project Status: Active - The project has reached a stable, usable state and is being actively developed.

Why?

The traditional way of updating the IP of the subdomains of your OVH domains if you have a dynamic IP is through DynHost, the Duck-DNS-kind-of DDNS system of OVH, and the Internet is full of scripts and programs to update with that system.

However, I was looking for a system that uses the official API, as that is my favourite method and the one I've been using with other providers. So I tinkered a little and this image, however, uses the OVH API so you don't need to setup a DynHost domain and associate it to your A/AAAA records. With this Docker container, you just need your keys and token and the subdomains you want to update.

With the release (I hope it will be soon!) of the v1.0 version, you will also forget to access the web portal of OVH to create the subdomains you want to update with this image, as the container will create it if the subdomain does not exist previously.

How to run

Obtain API keys from OVH console

In order to update and modify the IP value for your subdomains, you need to grab some credentials from your OVH account. For that, you can follow this official guide and create a new app. At the end, you should have an application key, an application secret and your consumer key.

Then, you need to put those credentials in a .conf file, like the one provided in this repo as an example.

Your ovh.conf file should look like this:

[default]
endpoint=ovh-eu # can be ovh-us, ovh-ca and others depending on your region

[ovh-eu]
application_key=r4nd0mstr1ng
application_secret=4n0th3rstr1ngw1thch4r4ct3s
consumer_key=4n0th3rstr1ngw1thch4r4ct3s

Put it within the same folder as the docker-compose.yml file and map it into the container as in the docker compose example just below.

Run with docker compose

This image is available both on Docker Hub and GitHub Container Registry, so you're free to choose from which one you're going to download the image. Edit the following docker compose/docker run command to match your needs (domain, subdomains, image registry, the IP fetching provider and the conf file) and you are ready to go!

services:
  ovh-ip-updater:
    image: ghcr.io/myanesp/ovh-ip-updater
    # image: myanesp/ovh-ip-updater # if you prefer to download from DockerHub
    restart: always
    container_name: ovh-ip-updater
    volumes:
      - ./my-ovh.conf:/etc/ovh.conf:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - DOMAIN=yourdomain.com
      - SUBDOMAIN=subdomain,subdomain2
      # - PROVIDER=ipify
      # - TTL=600

Run with docker run

docker run -d \
  --name ovh-ip-updater \
  --restart always \
  -v ./my-ovh.conf:/etc/ovh.conf:ro \
  -v /etc/localtime:/etc/localtime:ro \
  -e DOMAIN=yourdomain.com \
  -e SUBDOMAIN=subdomain,subdomain2 \
  ghcr.io/myanesp/ovh-ip-updater # or myanesp/ovh-ip-updater

Environmental variables

VARIABLE MANDATORY VALUE DEFAULT
DOMAIN Your domain (like example.com) empty
SUBDOMAIN Subdomain to update the IP (like www, if you want to update more: sub,sub2...) empty
TTL The time-to-live in seconds of the record 600
PROVIDER Service for checking the public IP address (can be ipify, mullvad or ifconfig) ipify

Planned features for v1.0, stable version