Best Flask open-source libraries and packages

Docker schlund ddns

Docker version of https://github.com/wosc/schlund-ddns/
Updated 1 year ago

Build on Docker Hub Stars on Docker Hub Pulls on Docker Hub

schlund-ddns

Dockerized version of wosc/schlund-ddns

This image runs a python flask server to update DNS Records managed by SchlundTech by using their official XML-Gateway over http/s. A CLI is provided too.

Many thanks to wosc and martinlowinski/php-dyndns for providing their projects to the public.

Setup

Configuration

Before you can use the XML-Gateway, you'll have to order access for free on the Official Homepage

Credentials

To get access to the XML-Gateway using the web api, you must provide your credentials in a config file. Simply create a configuration file in the root of your docker folder.

# copy the dist file
cp .schlund-ddns.dist .schlund-ddns

# and set your credentials using your preferred editor
[default]
username = ACCOUNT_ID
password = ACCOUNT_PASSWORD

docker-compose

A basic docker-compose.yaml is priovided in this project an may look like this

version: '3'
services:
  schlundddns:
    image: customelements/schlund-ddns
    container_name: schlund-ddns
    ports:
      - "5000:5000"
    volumes:
      - ./.schlund-ddns:/schlund-ddns/.schlund-ddns
    environment:
      - DDNS_CONFIG=/schlund-ddns/.schlund-ddns

This will start the application mounting your credentials file with public access to port 5000

Start the application

docker-compose up -d

Execute an DNS Record update by http

Now you should be able to update a DNS Record of a subdomain by calling the url like this:

http://localhost:5000/?hostname=your.subdomain.tld&myip=0.0.0.0

Pay Attention: It is only possible to update a subdomain of an A-Record like: sub.domain.tld. It is not possible to update A-Records like domain.tld or my.sub.sub.domain.tld

Execute an DNS Record update by CLI

You can also use the CLI schlund-ddns to update a DNS Record from the command line. If doing that, you'll have to provide the credentials as parameters. It is recommended to pass the credentials as environment variables to avoid sensible data in your command history.

docker run --rm -it --entrypoint schlund-ddns \
	customelements/schlund-ddns \
	--username <USER> \
	--password $PASS \
	your.host.tld \
	0.0.0.0

Setup with Traefik and basic auth

To use schlund-ddns behind a proxy like Traefik, check out the docker-compose.traefik.yaml file. You should have some basic knowledge of setting up traefik. For more information visit the offical docs at docs.traefik.io

create basic auth credentials

First we will create our encrypted basic auth credentials

For security reason: Read your password into an environment variable called PASS

read -p "Password: " -s PASS

use htpasswd to create your basic auth key, replace <USER> with a name of your choice

echo $(htpasswd -nbB <USER> "$PASS") | sed -e s/\\$/\\$\\$/g

if you do not have htpasswd installed, install it with sudo apt-get install apache2-utils or use a docker image like

docker run --rm -it xmartlabs/htpasswd <USER> $PASS  | sed -e s/\\$/\\$\\$/g

Put the output into the traefik.frontend.auth.basic label

- "traefik.frontend.auth.basic=<USER-PASSWORD-OUTPUT>"

docker-compose

Here is an example docker-compose.traefik.yaml configuration file

version: '3'
services:
  schlundddns:
    image: customelements/schlund-ddns
    container_name: schlund-ddns
    networks:
      - traefik
    volumes:
      - ./.schlund-ddns:/schlund-ddns/.schlund-ddns
    environment:
      - DDNS_CONFIG=/schlund-ddns/.schlund-ddns
    labels:
      - "traefik.docker.network=traefik"
      - "traefik.enable=true"
      - "traefik.basic.frontend.rule=Host:YOUR.HOST.TLD"
      - "traefik.port=5000"
      - "traefik.protocol=http"
      - "traefik.frontend.headers.SSLRedirect=false"
      - "traefik.frontend.auth.basic=<USER-PASSWORD-OUTPUT>"

networks:
  traefik:
    external: true
Tags http cli https