Skip to content

Latest commit

 

History

History
72 lines (42 loc) · 2.62 KB

README.md

File metadata and controls

72 lines (42 loc) · 2.62 KB

Python-DynHost-Automation

OVH dynamic DNS automation in Python. For bash script, check this repository

What is it ?

This is a simple script that allows you to check DNS entries for a list of subdomains and replace the record if the public IP of the network in which the script is run differs from that of the record. In short, play the role of a dynamic DNS updater. Assigned to a scheduled task exploits the full power of the script. Discord notification via webhook are implemented. Original script from this Github repo.

Installation

First, you need to clone the repo, then, install pip package discord_webhook. To get it, run this command :

pip install discord_webhook

Now, you can execute it.

Configuration

Some configuration is needed to make it work.

Adding the two reference domain

The script check the IPv4 address of the given reference domain, and compare it to the given domain. If IP's are different, all registered domains in host list will be updated with IPv4 value of reference_domain.

Modify the following lines to match your domains :

domain = 'subdomain.domain.com' # Reference domain for local / public IP check
reference_domain = 'subdomain.domain.com' # local domain to check

Adding domains

You have to modify subdomain.domain.com, username and password to match your subdomain address, your DynHost id and the password assigned to it.

['subdomain.domain.com','username','password'],

You can add as much domains as you want, just duplicate the line above and modify the values to match your DynHost domain entry. Host are in a list.

Execution

python3 dynhost.py

Scheduled task

The interest of this script is to be executed periodically. The best way to do this is to create a scheduled task with CRON, or any other task scheduler of your choice.

Discord notification

Dont forget to add your webhook url. Help to find it is given here

Then, you need to specify your Discord ID, to be mentionned every time records are updated. Help to find it is given here Modify the following line (replace my_id with your Discord user ID) :

discord_username = '<@my_id>'

Basic notification, no modification of DNS

Basic notification

Detailed notification, DNS entries have been modified

Basic notification