Giter VIP home page Giter VIP logo

docker-ddns-server's Introduction

Dynamic DNS Server for Docker with Web UI written in Go

Travis build status

GitHub release (latest by date) Go version License

With docker-ddns-server you can set up your own dynamic DNS server. This project is inspired by https://github.com/dprandzioch/docker-ddns . In addition to the original version, you can setup and maintain your dyndns entries via simple web ui.

Installation

You can either take the docker image or build it on your own.

Using the docker image

Just customize this to your needs and run:

docker run -it -d \
    -p 8080:8080 \
    -p 53:53 \
    -p 53:53/udp \
    -v /somefolder:/var/cache/bind \
    -v /someotherfolder:/root/database \
    -e DDNS_ADMIN_LOGIN=admin:123455546. \
    -e DDNS_DOMAINS=dyndns.example.com \
    -e DDNS_PARENT_NS=ns.example.com \
    -e DDNS_DEFAULT_TTL=3600 \
    --name=dyndns \
    bbaerthlein/docker-ddns-server:latest

Using docker-compose

You can also use Docker Compose to set up this project. For an example docker-compose.yml, please refer to this file: https://github.com/benjaminbear/docker-ddns-server/blob/master/deployment/docker-compose.yml

Configuration

DDNS_ADMIN_LOGIN is a htpasswd username password combination used for the web ui. You can create one by using htpasswd:

htpasswd -nb user password

If you want to embed this into a docker-compose.yml you have to double the dollar signs for escaping:

echo $(htpasswd -nb user password) | sed -e s/\\$/\\$\\$/g

If DDNS_ADMIN_LOGIN is not set, all /admin routes are without protection. (use case: auth proxy)

DDNS_DOMAINS are the domains of the webservice and the domain zones of your dyndns server (see DNS Setup) i.e. dyndns.example.com,dyndns.example.org (comma separated list)

DDNS_PARENT_NS is the parent name server of your domain i.e. ns.example.com

DDNS_DEFAULT_TTL is the default TTL of your dyndns server.

DDNS_CLEAR_LOG_INTERVAL optional: clear log entries automatically in days (integer) e.g. DDNS_CLEAR_LOG_INTERVAL:30

DDNS_ALLOW_WILDCARD optional: allows all *.subdomain.dyndns.example.com to point to your ip (boolean) e.g. true

DDNS_LOGOUT_URL optional: allows a logout redirect to certain url by clicking the logout button (string) e.g. https://example.com

DNS setup

If your parent domain is example.com and you want your dyndns domain to be dyndns.example.com, an example domain of your dyndns server would be blog.dyndns.example.com.

You have to add these entries to your parent dns server:

dyndns                   IN NS      ns
ns                       IN A       <put ipv4 of dns server here>
ns                       IN AAAA    <optional, put ipv6 of dns server here>

Updating entry

After you have added a host via the web ui you can setup your router. Example update URL:

http://dyndns.example.com:8080/update?hostname=blog.dyndns.example.com&myip=1.2.3.4
or
http://username:[email protected]:8080/update?hostname=blog.dyndns.example.com&myip=1.2.3.4

this updates the host blog.dyndns.example.com with the IP 1.2.3.4. You have to setup basic authentication with the username and password from the web ui.

If your router doensn't support sending the ip address (OpenWRT) you don't have to set myip field:

http://dyndns.example.com:8080/update?hostname=blog.dyndns.example.com
or
http://username:[email protected]:8080/update?hostname=blog.dyndns.example.com

The handler will also listen on:

  • /nic/update
  • /v2/update
  • /v3/update

docker-ddns-server's People

Contributors

benjaminbear avatar devn1x avatar maltegrosse avatar w3k-co avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-ddns-server's Issues

Mounting volumes does not work

Sorry for the question but I can't get the image to work.
It seems that mounting the volumes does not work.
Both with docker-compose and docker-run I get the error.

ERROR: for ddns Cannot start service ddns: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/home/docker/ddns/database" to rootfs at "/root/dyndns/database" caused: mount through procfd: open o_path procfd: open /var/lib/docker/overlay2/ef39d03481702de8c0a78268fdbc289a44817d9a0c1bb2ec4f50c381a3b382ee/merged/root/dyndns/database: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

OS: Alpine Linux 3.14.1
Docker version: 20.10.7

Logs should be listed descending

In my opinion, the logs page currently has no advantage because only the first 30 logs are listed and I cannot see the last updates.
The best solution is probably paging, but I think it's an advantage if you can see the "last" 30 logs.

1 Character Host Names + More

Hi, I am trying to migrate from MintDNS on Windows Server 2012 to this awesome replacement, but I am running into a few issues:

  1. When I try to create a hostname with just a single character (such as a.example.com, I get the following error:

    Error: Key: 'Host.Hostname' Error:Field validation for 'Hostname' failed on the 'hostname' tag`

    Where can I edit and remove this restriction?

  2. I was able to remove the 8-character minimum restrictions for usernames and passwords, but I was wondering, is it possible to not limit hostnames to unique usernames? I would like to be able to assign multiple hosts to the same user (that way current hosts assigned to the same user can continue to resolve without the login information needing to change.

  3. How can I make both hostnames and usernames case INsensitive on creation, edit and ddns updates? I would like that regardless of how they are inputted (on creation of hostname and edits) or received for DDNS Update, that they are always translated to lowercase and stored that way.

Any help would be appreciated. Thanks in advance.

[ERROR] An error is reported when deploying ddns in the k8s environment

1678875095218

1678874971467

1678874838878
1678875350922
1678875755845

ERROR LOGS
{"time":"2023-03-15T09:31:34.650485857Z","level":"INFO","prefix":"-","file":"update.go","line":"15","message":"A record update request: gioncowfd -> 192.168.0.1"}
{"time":"2023-03-15T09:31:34.706723882Z","id":"","remote_ip":"10.244.36.64","host":"172.16.12.74:49893","method":"POST","uri":"/admin/hosts/add","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36","status":400,"error":"","latency":65601078,"latency_human":"65.601078ms","bytes_in":111,"bytes_out":55}

using main domain withous subdomains

Hello, first of all, thank you very much, you made a really good project.
Excuse my lack of knowledge, I am trying to achieve something like dyndns.org is doing, i have this domain dyn.xyz, and i want that my host be like lottar.dyn.xyz -> 22.33.44.11

In my registrant I added this records

ddns.dyn.xyz. A 11.22.33.44
ns NS 11.22.33.44

this is my setup.

version: '3'
services:
ddns:
image: bbaerthlein/docker-ddns-server:latest
restart: always
environment:
DDNS_ADMIN_LOGIN: 'admin:$apr1VH1Az7CwF5qRV'
DDNS_DOMAINS: 'dyn.xzy'
DDNS_PARENT_NS: 'ns.dyn.xyz'
DDNS_DEFAULT_TTL: '3600'
ports:
- "53:53"
- "53:53/udp"
- "8080:8080"
volumes:
- ./bind-data:/var/cache/bind
- ./database:/root/database

Can you help me, I am stuck, not able to achieve it ..

DNS type

Would it be possible to implement a field to enter the DNS type?
Such as an MX record
Thank you very much!!!, sorry for my English :)

Zone Transfer possible?

Good day,

i would like to use Zone-Transfer and this docker-instance as primary dyndns zone, is that possible or could you implement it?

Would be neat that you could simply add a zone-transfer option with a list of allowed server ips over the GUI ;).

Following planed setup: Plesk as secondary dns server for the subdomain, your docker instance as primary with zone-transfer.

Thanks a lot.

Best Regards

Having trouble with DNS Setup

Hi,
i've deployed the container and opened the 53 Port in my Firewall.

I've created an CNAME record on my Domain for ddns.domain.tld. This points to my nginx which is a reverse proxy with TLS offloading for the UI (:8080).
I can access the UI with the BASIC Auth credentials, and API Requests are working too.

I also added Following DNS Records:

Host Type Destination Description
ddns A 123.123.123.123 points to nginx reverse proxy with TLS offloading
... ... ... ...
myzone NS mzns1
mzns1 A 123.123.123.123
mzns1 AAAA ab:00:::03

The host was refreshed successfully via API (i see it in Logs and on UI)

my problem is:
When i enter https://host.myzone.domain.tld , i cannot reach my server. I am getting the following error:

Hmmm… can't reach this page

It looks like the webpage at https://host.myzone.domain.tld/ might be having issues, or it may have moved permanently to a new web address.
ERR_TUNNEL_CONNECTION_FAILED

I enabled Port Forwarding on my Router already. When entering https://Router-IP, I can access my Server behind it.

Somehow it seems, that the NS Record is not really propageted, because i cannot even ping my URL except using a custom DNS:

$ ping host.myzone.domain.tld

ping: host.myzone.domain.tld: Temporary failure in name resolution

$ nslookup host.myzone.domain.tld

Server:         127.0.0.53
Address:        127.0.0.53#53
 
** server can't find host.myzone.domain.tld: SERVFAIL
 
$ nslookup host.myzone.domain.tld myzone.domain.tld

nslookup: couldn't get address for 'myzone.domain.tld': failure

$ nslookup host.myzone.domain.tld mzns1.domain.tld

Server:         mzns1.domain.tld
Address:        123.123.123.123#53
 
Name:   host.myzone.domain.tld
Address: <router-ip>

It's been already 2 Days since i configured the DNS.
What am i doing wrong?

DynDNS not compatible API

DynDNS not compatible API
pls help me .
how can update from router's API

/nic/update?hostname=blog.dyndns.example.com
Return : {"message":"Not Found"}

The handlers will listen on:
/nic/update
/v2/update
/v3/update

.htaccess auth failed

I run the following code:
docker run -it -d \ -p 4080:8080 \ -p 53:53 \ -p 53:53/udp \ -v /opt/ddns/bind:/var/cache/bind \ -v /opt/ddns/database:/root/database \ -e DDNS_ADMIN_LOGIN='******:$$apr1$$evkvf9PG$$q6yyhxZvWdtPN5Vmg1Mne/'\ -e DDNS_DOMAINS=dyndns.*****.de \ -e DDNS_PARENT_NS=dns1.*****.de \ -e DDNS_ALLOW_WILDCARD=true \ -e TZ=Europe/Berlin \ -e VIRTUAL_HOST=dyndns.olivertempel.de \ -e LETSENCRYPT_HOST=dyndns.olivertempel.de \ -e [email protected] \ -e DDNS_DEFAULT_TTL=3600 \ --network="proxy" \ --name=dyndns \ bbaerthlein/docker-ddns-server:latest

username and password where generated with:
echo $(htpasswd -nb user password) | sed -e s/\$/\$\$/g

If i want to login, it says authentication failed.

Whats Wrong?

Host Entry -> short Usernames not possible?

Hi and thanks for this handy tool,

as i had a ddns service before i have some clients rolled out and want to
add them to the new service - the usernames and passwords were really short and i dont want
to change them on the clients - is there a way to disable the check for these fields (username / password)??

Currently i get the following warning:

Error: Key: 'Host.UserName' Error:Field validation for 'UserName' failed on the 'min' tag

Thanks in advance.

Show both ipv4 and ipv6 address for the hosts

First of all, big thx for the nice server. I'm currently trying it out on my VPS and found a few things which would be cool to get fixed.

If you add a host and update it with a ipv4 and a ipv6 address, both addresses are available on the DNS, but the hosts view only shows the last updated entry. It would be nice if it could show both entries.

Configuration with NGINX Proxy Manager [Reverse Proxy]

i have the follwing configuration in my docker

version: '3'
services:
  ddns:
    image: bbaerthlein/docker-ddns-server:latest
    container_name: dyndns
    restart: unless-stopped
    environment:
      DDNS_ADMIN_LOGIN: 'example:example_pwd'
      DDNS_DOMAINS: 'ns.example.com'
      DDNS_PARENT_NS: 'ns.example.com'
      DDNS_DEFAULT_TTL: '3600'
    ports:
      - "53:53"
      - "53:53/udp"
      - "8080:8080"
    volumes:
       - ./bind-data:/var/cache/bind
       - ./database:/root/database
    networks:
       - proxy
       - dyndns
networks:
  dyndns:
  proxy:
    external: true 

The configuration works fine and is running. I also can update the IPs but i couldn't manage to get the answer when calling the host.

Configuration DNS Try 1:
1.) ns.example.com A IP-OF-NGINX-PROXY
2.) *.ns.example com CNAME ns.example.com

Not working (only for update)

Configuration DNS Try 1:
1.) ns.example.com A IP-OF-NGINX-PROXY
2.) *.ns.example com NS ns.example.com

Not working (only for update), if i try the host host1.ns.example.com i get "no dns-adress found. DNS_PROBE_POSSIBLE " when i look at the terminal of DDNS-Server there is also no request.

If i make a NS-Lookup at ns.example.com there are even no entries

So i am wondering if i have some misconfiguration of my NGINX Proxymanager.
Did anyone manage it to get it work?

Unclear instruction for DNS setup

In the docs it says to create a record for ns.<domain.tld> to point to "put ipv4 of dns server here". It is not clear to me if that means pointing to where the acme-compainion is running, as it functions as DNS as well (as far as I understand) or if it has to point to my provider DNS server.

Can somebody enlighten me?

Add an option to prevent ipv6 updates

I have some services running at home which don't work with ipv6 addresses (on the server side), but as my router is updating both addresses (and i cannot configure it there), the clients will always get the ipv6 address and fail to connect.

What i've noticed, is that when only the A entry of the DNS is set, the client resolves only the ipv4 address and the connection works fine. For those cases it would be great if there is a flag to prevent ipv6 entries of a certain host.

Deploying behind Traefik Reverse Proxy

Hello, if ever you can provide information on how to deploy this container, with docker-compose, behind traefik, that would be incredible!

Also, is the webUI also on 8080 or is it on another port? because I can't reach it.

Also support CNAME entries

I understand that this is against the way of a ddns service and you don't update those entries, but for providing aliases to other dyndns entries e.g. when you changed the name, this can be really useful.

Allow to set IPv4 and IPv6 explicitly in one query to update both A and AAAA record at once

Hi!

My router is only able to issue one GET-query with placeholders for the IPv4 and IPv6 address to update a dDNS provider.

So I wanted to propose adding query-parameters to trigger updates of both the A and AAAA record from one query. From a quick look it seems this would need some additional mechanics in the UpdateIp function. I'd propose adding the type-explicite parameters myipv4 and myipv6 while keeping myip with automatic type determination around for backwards compatibility.

Cheers,

Jörn

Validation for domain should be "fqdn" instead of "hostname"

My ddns domain has a single letter component. Like this for example:
myhost.d.example.com

The ".d." fails the validation tag "hostname" of github.com/go-playground/validator.
Afaik there is no reason that the domain should be validated as a hostname. It should rather be the fqdn validator tag.

disable auth

disable auth would be a nice feature in order to plugin some oauth proxy in front of the ui.

perhaps some minor changes have to be done:
either here:
https://github.com/benjaminbear/docker-ddns-server/blob/master/dyndns/handler/handler.go#L69
something like os.Getenv("DDNS_ADMIN_DISABLE") --> return true

or here:
https://github.com/benjaminbear/docker-ddns-server/blob/master/dyndns/handler/handler.go#L90
just allow empty admin env variable (not sure how it behause in the auth process if ein empty string is set....)

PS. moving all admin routes in an admin subfolder would make to regex matching easier for the oauth proxy, something like ./admin/. and redirect all ./ to ./admin/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.