DNS update script for loopia.se. Allows automatic update of a DNS record directly from a server, pc etc.
Usage: python update.py
For anyone with some python experience this should be straight forward.
- requests
- pyyaml
- python3.x
- Clone the repo or get the script files to your hard drive in 2ome other way
- Install pre-requisite packages locally or in your virtual environment
pip install -r requirements.txt
- Make a copy of sampleconfig.yml and name it config.yml
cp sample-config.yml config.yml
- Configure config.yml with your settings (see configuration section)
- Run script update.py
python3 update.py
The script in its current form uses a yaml file for housing configuration. A sample config has been provided and can be used as a base for your settings.
Note! You have to create an API user in loopias "Kundzon" with atleast the following 4 privileges set:
- getZoneRecords
- addZoneRecords
- updateZoneRecord
- removeZoneRecord
To update the base domain, simply put '@' as the subdomain, just as you would in any bind9 zone file.
Logging is supported in the application. As of now both file logging and stream logging (console) is added and can be enabled by configuration.
log_level_console: 10
log_level_file: 0
log_file: application.log
Log level | Value |
---|---|
Disabled | 0 |
DEBUG | 10 |
INFO | 20 |
WARNING | 30 |
ERROR | 40 |
CRITICAL | 50 |
Setting a value to one of these numbers means you will see that level and all levels of a higher number in the console output. Example that will show Information, Warning, Error and Critical log messages:
log_level_console: 20
The script will be looking for the file config.yml for its' settings.
Copy or rename the sample-config.yml to config.yml and update with your own settings.