ddns/README.md

94 lines
4.1 KiB
Markdown
Raw Permalink Normal View History

2018-01-28 15:31:31 +01:00
# `ddns` - Dynamic DNS
2014-07-06 18:16:45 +02:00
2014-07-16 15:30:53 +02:00
A self-hosted Dynamic DNS solution similar to DynDNS or NO-IP.
2018-01-28 15:31:31 +01:00
You can use a hosted version at [ddns.pboehm.de](https://ddns.pboehm.de/) where you can register a
host under the `d.pboehm.de` domain (e.g `test.d.pboehm.de`).
2014-07-16 15:30:53 +02:00
2018-01-28 15:31:31 +01:00
**Recent Changes**
2014-07-16 21:36:02 +02:00
2018-01-28 15:46:16 +01:00
`ddns` has been fully restructured and now uses the PowerDNS
2018-01-28 15:31:31 +01:00
[Remote Backend](https://doc.powerdns.com/md/authoritative/backend-remote/) instead
of the [Pipe Backend](https://doc.powerdns.com/md/authoritative/backend-pipe/), which
2018-01-28 21:28:29 +01:00
is far easier to deploy. It now serves both the frontend and the backend over HTTP using different ports.
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
The old `ddns` source code can be found at the [legacy](https://github.com/pboehm/ddns/tree/legacy) tag.
2014-07-16 21:36:02 +02:00
**Security Notice**
Please make sure that you use the latest available version of `ddns`, as it contains an important security
fix for [an issue introduced in the rework](https://github.com/pboehm/ddns/issues/8).
2018-01-28 15:31:31 +01:00
## How can I update my IP if it changes?
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
`ddns` is built around a small webservice, so that you can update your IP address simply by calling
an URL periodically through `curl`. Hosts that haven't been updated for 10 days will
be automatically removed. This can be configured in your own instance.
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
An API similar to DynDNS/NO-IP has not been implemented yet.
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
## Self-Hosting
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
### Requirements
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
* A custom domain where the registrar allows setting `NS` records for subdomains. This is important because not all
DNS providers support this.
* A server with [docker](https://www.docker.com/) and [docker-compose](https://docs.docker.com/compose/) installed
* The following ports should be opened in the firewall:
* `53/udp`
* `80/tcp`
* `443/tcp`
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
### DNS-Setup
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
For the domain you want to use with `ddns` (`example.net` in the following sections, please adjust this to your domain)
you have to create the following two DNS records:
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
* `ddns.example.net` as a `CNAME` or `A`/`AAAA` record pointing to the server `ddns` will be running on. This record
will be used for accessing the `ddns` frontend in your browser or via `curl`. It is also the target for the
corresponding `NS` record.
* `d.example.net` as an `NS` record pointing to the previously created `ddns.example.net` record. This will delegate
all subdomains under `d.example.net` to the PowerDNS server running on `ddns.example.net`.
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
### `ddns`-Setup
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
Setting up `ddns` was kind of a hassle in the legacy version, because there are multiple components that have to
work together:
2014-07-16 21:36:02 +02:00
2018-01-28 15:46:16 +01:00
* `ddns` that runs the frontend and provides an API compatible with the
2018-01-28 15:31:31 +01:00
[Remote Backend](https://doc.powerdns.com/md/authoritative/backend-remote/)
* Redis as storage backend for `ddns`
* PowerDNS as DNS server, which uses the `ddns` backend API on Port `8053`
* A web server that makes the `ddns` frontend accessible to the Internet through HTTPS
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
The setup is now automated using [docker-compose](https://docs.docker.com/compose/) and only some customization has
2018-01-28 15:46:16 +01:00
to be made in a `docker-compose.override.yml` file
(a [sample](./docker/docker-compose.override.yml.sample) is available here).
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
#### Configuring the Setup
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
The setup included in this repository contains all the components described above and uses
[caddy](https://caddyserver.com/) as a web server, because it provides automatic HTTPS using Lets Encrypt.
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
```
git clone git@github.com:pboehm/ddns.git
cd ddns/docker
cp docker-compose.override.yml.sample docker-compose.override.yml
```
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
Please adjust the settings in `docker-compose.override.yml` marked with the `#<<< ....` comments as follows:
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
* adjust the domain part in lines marked with `# <<< ADJUST DOMAIN` according to your DNS-Setup
* insert your email address in lines marked with `# <<< INSERT EMAIL` which is required for getting certificates
from Lets Encrypt
* adjust the path component before the `:` in lines marked with `# <<< ADJUST LOCAL PATH` if the shown path
does not meet your requirements
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
Finally execute the following `docker-compose` command, which creates 4 containers in detached mode which are also
started automatically after reboot. For updating an existing installation use the same command because it automatically
rebuilds the containers.
2014-07-16 21:36:02 +02:00
2018-01-28 15:31:31 +01:00
```
docker-compose --project-name ddns up -d --build
2018-01-28 15:31:31 +01:00
```