homeserverdns/README.md

81 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2018-11-05 12:20:35 +01:00
# homeserverdns: Dynamic DNS updater for home servers
homeserverdns monitors the IPv6 addresses (using the ip tool from [iproute2](https://wiki.linuxfoundation.org/networking/iproute2)). When it detects a change, it updates the A and AAAA records for a set of domains (and subdomains).
So far it has modules for these domain provider APIs:
- [gandi.net LiveDNS API](https://doc.livedns.gandi.net/)
- [http.net DNS API](https://www.http.net/docs/api/) (untested)
- [dyn.com API](https://help.dyn.com/remote-access-api/perform-update/) (untested)
2018-11-05 15:39:09 +01:00
## Dependencies
2018-11-05 13:23:33 +01:00
- iproute2
2018-11-05 12:20:35 +01:00
- curl
- miniupnpc (optional, see the Configuration section)
2018-11-05 13:23:33 +01:00
- bind (optional, when using the http.net DNS API)
2018-11-05 12:20:35 +01:00
2018-11-05 15:39:09 +01:00
## Installation
2018-11-05 13:23:33 +01:00
There's no automated installation yet. As an example we install the two scripts `homeserverdns-daemon` and `homeserverdns-update` to `/usr/bin` and the configuration file to `/etc`.
2018-11-05 12:54:43 +01:00
2018-11-05 13:23:33 +01:00
```shell
sudo cp homeserverdns-daemon homeserverdns-update /usr/bin
sudo cp homeserverdns.cfg /etc
```
We create a user and adjust the permissions of the config file, so only that user can read it (and the credentials in it).
```shell
sudo useradd --system homeserverdns
sudo chown homeserverdns:root /etc/homeserverdns.cfg
sudo chown 0600 /etc/homeserverdns.cfg
```
If we want to use systemd to control homeserverdns, we need to install the service file `homeserverdns.service`. We have to make sure that the path of the config file and the `User` variable are correct in that file.
2018-11-05 13:23:33 +01:00
```shell
sudo cp homeserverdns.service /etc/systemd/system
```
Once the configuration is done we can start homeserverdns using
```shell
sudo systemctl start homeserverdns
```
2018-11-05 12:20:35 +01:00
2018-11-05 15:39:09 +01:00
## Configuration
2018-11-05 12:54:43 +01:00
All configuration options are described in more detail in `homeserverdns.cfg`. This is only an overview on the most important options.
2018-11-05 12:20:35 +01:00
2018-11-05 12:54:43 +01:00
First a protocol has to be defined, e.g.
```shell
2018-11-05 12:20:35 +01:00
protocol=gandi
2018-11-05 12:30:44 +01:00
```
2018-11-05 12:20:35 +01:00
2018-11-05 13:28:31 +01:00
For authentication at the domain provider, an authentication token has to be given. Some protocols require a user name and an API address, too.
2018-11-05 12:20:35 +01:00
2018-11-05 12:54:43 +01:00
```shell
2018-11-05 12:20:35 +01:00
auth_key=g5Hdsfkj5J49li8HH3jfhsJp
2018-11-05 13:30:17 +01:00
user= # not required for gandi
api_address= # not required for gandi
2018-11-05 12:30:44 +01:00
```
2018-11-05 12:20:35 +01:00
Now the domains (and subdomains) we want to update A and AAAA records for have to be defined.
2018-11-05 12:54:43 +01:00
```shell
2018-11-05 12:20:35 +01:00
domains=mydomain.com sub.mydomain.com
2018-11-05 12:30:44 +01:00
```
2018-11-05 12:20:35 +01:00
By default `UPNP` is used for detecting the server's public IPv4 address. So we should check if upnp works and returns the correct IPv4 address.
2018-11-05 12:54:43 +01:00
```shell
2018-11-05 12:20:35 +01:00
$ upnpc -s
2018-11-05 12:38:09 +01:00
[...]
2018-11-05 12:20:35 +01:00
ExternalIPAddress = 85.98.82.44
2018-11-05 12:38:09 +01:00
[...]
2018-11-05 12:30:44 +01:00
```
2018-11-05 12:20:35 +01:00
If we don't get a value for `ExternalIPAddress`, we should check our router and firewall settings. If `UPNP` does not work for us (e.g. in case the server is behind a Carrier Grade NAT), we can define our own method for looking up our public IPv4 address using the `public_ip4_hook` config option, e.g.
2018-11-05 12:54:43 +01:00
```shell
2018-11-05 12:20:35 +01:00
public_ip4_hook=curl -s -4 https://ipecho.net/plain
2018-11-05 12:30:44 +01:00
```