Compare commits
17 commits
build_fail
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
87c648e7bd | ||
|
8c086d3194 | ||
|
82a5891ba3 | ||
|
7ed078bb78 | ||
|
e2b997707b | ||
|
204fbeba59 | ||
|
8d176ee521 | ||
|
bc8c5e2810 | ||
|
016eea259c | ||
|
3b4513eebd | ||
|
fdc1312c44 | ||
|
3e71d958bc | ||
|
3e9c5ef2c5 | ||
|
087acd1907 | ||
|
d7d7bcbad9 | ||
|
13dae077d9 | ||
|
9d1d6cccdd |
12 changed files with 105 additions and 44 deletions
57
.circleci/config.yml
Normal file
57
.circleci/config.yml
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
version: 2.1
|
||||||
|
orbs:
|
||||||
|
docker: circleci/docker@1.5.0
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:1.16
|
||||||
|
working_directory: /go/src/github.com/pboehm/ddns
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: go get -v -t -d ./...
|
||||||
|
- run: go test -v ./...
|
||||||
|
|
||||||
|
docker-build:
|
||||||
|
executor: docker/docker
|
||||||
|
steps:
|
||||||
|
- setup_remote_docker
|
||||||
|
- checkout
|
||||||
|
- docker/build:
|
||||||
|
image: pboehm/ddns
|
||||||
|
dockerfile: docker/ddns/Dockerfile
|
||||||
|
|
||||||
|
docker-build-and-push:
|
||||||
|
executor: docker/docker
|
||||||
|
steps:
|
||||||
|
- setup_remote_docker
|
||||||
|
- checkout
|
||||||
|
- docker/check
|
||||||
|
- docker/build:
|
||||||
|
image: pboehm/ddns
|
||||||
|
dockerfile: docker/ddns/Dockerfile
|
||||||
|
tag: $CIRCLE_SHA1,latest
|
||||||
|
- docker/push:
|
||||||
|
image: pboehm/ddns
|
||||||
|
tag: $CIRCLE_SHA1,latest
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
commit:
|
||||||
|
jobs:
|
||||||
|
- test:
|
||||||
|
filters: # required since `docker-XXXX` have tag filters AND require `test`
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
|
|
||||||
|
- docker-build:
|
||||||
|
requires:
|
||||||
|
- test
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore: master
|
||||||
|
|
||||||
|
- docker-build-and-push:
|
||||||
|
requires:
|
||||||
|
- test
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: master
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,3 +2,5 @@
|
||||||
/docker/docker-compose.*.yml
|
/docker/docker-compose.*.yml
|
||||||
/ddns
|
/ddns
|
||||||
dump.rdb
|
dump.rdb
|
||||||
|
/docker/.caddy_mount/
|
||||||
|
/docker/.redis_mount/
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2018 Philipp Böhm
|
Copyright (c) 2020 Philipp Böhm
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
40
README.md
40
README.md
|
@ -1,23 +1,28 @@
|
||||||
# `ddns` - Dynamic DNS
|
# `ddns` - Dynamic DNS
|
||||||
|
|
||||||
A self-hosted Dynamic DNS solution similar to DynDNS or NO-IP.
|
[![CircleCI](https://img.shields.io/circleci/build/github/pboehm/ddns?style=flat)](https://circleci.com/github/pboehm/ddns)
|
||||||
|
[![Docker Image Size (tag)](https://img.shields.io/docker/image-size/pboehm/ddns/latest?logo=Docker)](https://hub.docker.com/r/pboehm/ddns)
|
||||||
|
[![Docker Pulls](https://img.shields.io/docker/pulls/pboehm/ddns?logo=Docker)](https://hub.docker.com/r/pboehm/ddns)
|
||||||
|
[![GitHub](https://img.shields.io/github/license/pboehm/ddns?style=flat)](https://github.com/pboehm/ddns)
|
||||||
|
|
||||||
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`).
|
|
||||||
|
|
||||||
**Recent Changes**
|
A self-hosted Dynamic DNS solution similar to DynDNS or NO-IP based on the
|
||||||
|
[PowerDNS Remote Backend](https://doc.powerdns.com/md/authoritative/backend-remote/).
|
||||||
|
|
||||||
`ddns` has been fully restructured and now uses the PowerDNS
|
<img src="screenshot.png" alt="screenshot" width="500"/>
|
||||||
[Remote Backend](https://doc.powerdns.com/md/authoritative/backend-remote/) instead
|
|
||||||
of the [Pipe Backend](https://doc.powerdns.com/md/authoritative/backend-pipe/), which
|
|
||||||
is far easier to deploy. It now serves both the frontend and the backend over HTTP using different ports.
|
|
||||||
|
|
||||||
The old `ddns` source code can be found at the [legacy](https://github.com/pboehm/ddns/tree/legacy) tag.
|
|
||||||
|
|
||||||
**Security Notice**
|
## ⚠️⚠️⚠️ Note regarding hosted version at `ddns.pboehm.de`
|
||||||
|
|
||||||
Please make sure that you use the latest available version of `ddns`, as it contains an important security
|
The hosted `ddns` service with custom hosts under the `d.pboehm.de` domain (e.g `test.d.pboehm.de`) is not available
|
||||||
fix for [an issue introduced in the rework](https://github.com/pboehm/ddns/issues/8).
|
anymore! I did not use this service for quite some time and recently there were some issues which resulted in downtime
|
||||||
|
and expiration of all registered hosts.
|
||||||
|
|
||||||
|
### Alternatives
|
||||||
|
|
||||||
|
There is at least one other hosted version of `pboehm/ddns` that
|
||||||
|
[can be found via Google](https://www.google.com/search?q=pboehm%2Fddns+%22DDNS+is+a+project+that+lets+you+host+a+Dynamic+DNS+Service%2C+similar+to+DynDNS%2FNO-IP%2C+on+your+own+servers.%22)
|
||||||
|
or you can host it yourself as described below.
|
||||||
|
|
||||||
## How can I update my IP if it changes?
|
## How can I update my IP if it changes?
|
||||||
|
|
||||||
|
@ -52,15 +57,6 @@ you have to create the following two DNS records:
|
||||||
|
|
||||||
### `ddns`-Setup
|
### `ddns`-Setup
|
||||||
|
|
||||||
Setting up `ddns` was kind of a hassle in the legacy version, because there are multiple components that have to
|
|
||||||
work together:
|
|
||||||
|
|
||||||
* `ddns` that runs the frontend and provides an API compatible with the
|
|
||||||
[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
|
|
||||||
|
|
||||||
The setup is now automated using [docker-compose](https://docs.docker.com/compose/) and only some customization has
|
The setup is now automated using [docker-compose](https://docs.docker.com/compose/) and only some customization has
|
||||||
to be made in a `docker-compose.override.yml` file
|
to be made in a `docker-compose.override.yml` file
|
||||||
(a [sample](./docker/docker-compose.override.yml.sample) is available here).
|
(a [sample](./docker/docker-compose.override.yml.sample) is available here).
|
||||||
|
@ -81,8 +77,6 @@ Please adjust the settings in `docker-compose.override.yml` marked with the `#<<
|
||||||
* adjust the domain part in lines marked with `# <<< ADJUST DOMAIN` according to your DNS-Setup
|
* 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
|
* insert your email address in lines marked with `# <<< INSERT EMAIL` which is required for getting certificates
|
||||||
from Lets Encrypt
|
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
|
|
||||||
|
|
||||||
Finally execute the following `docker-compose` command, which creates 4 containers in detached mode which are also
|
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
|
started automatically after reboot. For updating an existing installation use the same command because it automatically
|
||||||
|
|
|
@ -51,7 +51,13 @@ func (b *Backend) Run() error {
|
||||||
|
|
||||||
r.GET("/dnsapi/getDomainMetadata/:name/:kind", func(c *gin.Context) {
|
r.GET("/dnsapi/getDomainMetadata/:name/:kind", func(c *gin.Context) {
|
||||||
c.JSON(200, gin.H{
|
c.JSON(200, gin.H{
|
||||||
"result": false,
|
"result": []string{"0"},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
r.GET("/dnsapi/getAllDomainMetadata/:name", func(c *gin.Context) {
|
||||||
|
c.JSON(200, gin.H{
|
||||||
|
"result": gin.H{"PRESIGNED": []string{"0"}},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -9,5 +9,10 @@ RUN GO111MODULE=on go get -d -v ./...
|
||||||
RUN GO111MODULE=on go install -v ./...
|
RUN GO111MODULE=on go install -v ./...
|
||||||
|
|
||||||
ENV GIN_MODE release
|
ENV GIN_MODE release
|
||||||
|
ENV DDNS_EXPIRATION_DAYS 10
|
||||||
|
|
||||||
CMD /go/bin/ddns --domain=${DDNS_DOMAIN} --soa_fqdn=${DDNS_SOA_DOMAIN} --redis=${DDNS_REDIS_HOST}
|
CMD /go/bin/ddns \
|
||||||
|
--domain=${DDNS_DOMAIN} \
|
||||||
|
--soa_fqdn=${DDNS_SOA_DOMAIN} \
|
||||||
|
--redis=${DDNS_REDIS_HOST} \
|
||||||
|
--expiration-days=${DDNS_EXPIRATION_DAYS}
|
||||||
|
|
|
@ -5,6 +5,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
DDNS_DOMAIN: d.example.net # <<< ADJUST DOMAIN
|
DDNS_DOMAIN: d.example.net # <<< ADJUST DOMAIN
|
||||||
DDNS_SOA_DOMAIN: ddns.example.net # <<< ADJUST DOMAIN
|
DDNS_SOA_DOMAIN: ddns.example.net # <<< ADJUST DOMAIN
|
||||||
|
DDNS_EXPIRATION_DAYS: 10
|
||||||
|
|
||||||
powerdns:
|
powerdns:
|
||||||
ports:
|
ports:
|
||||||
|
@ -12,7 +13,7 @@ services:
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
volumes:
|
volumes:
|
||||||
- "/root/ddns-redis:/data" # <<< ADJUST LOCAL PATH
|
- "${PWD}/.redis_mount:/data"
|
||||||
|
|
||||||
caddy:
|
caddy:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
@ -20,12 +21,13 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
- ddns
|
- ddns
|
||||||
environment:
|
environment:
|
||||||
|
ACME_AGREE: "true"
|
||||||
DDNS_FRONTEND_HOST: ddns:8080
|
DDNS_FRONTEND_HOST: ddns:8080
|
||||||
DDNS_CADDY_DOMAIN: ddns.example.net # <<< ADJUST DOMAIN
|
DDNS_CADDY_DOMAIN: ddns.example.net # <<< ADJUST DOMAIN
|
||||||
DDNS_CADDY_TLS_EMAIL: changeme@example.net # <<< INSERT EMAIL
|
DDNS_CADDY_TLS_EMAIL: changeme@example.net # <<< INSERT EMAIL
|
||||||
volumes:
|
volumes:
|
||||||
- "${PWD}/caddy/Caddyfile:/etc/Caddyfile"
|
- "${PWD}/caddy/Caddyfile:/etc/Caddyfile"
|
||||||
- "/root/ddns-caddy:/root/.caddy" # <<< ADJUST LOCAL PATH
|
- "${PWD}/.caddy_mount:/root/.caddy"
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
- "443:443"
|
- "443:443"
|
|
@ -1,7 +1,7 @@
|
||||||
FROM buildpack-deps:jessie-scm
|
FROM buildpack-deps:bookworm-scm
|
||||||
|
|
||||||
# the setup procedure according to https://repo.powerdns.com/ (Debian 8 Jessie)
|
# the setup procedure according to https://repo.powerdns.com/ (Debian 12 Bookworm)
|
||||||
RUN echo "deb http://repo.powerdns.com/debian jessie-auth-41 main" > /etc/apt/sources.list.d/pdns.list \
|
RUN echo "deb [arch=amd64] http://repo.powerdns.com/debian bookworm-auth-49 main" > /etc/apt/sources.list.d/pdns.list \
|
||||||
&& echo "Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 600\n" >> /etc/apt/preferences.d/pdns \
|
&& echo "Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 600\n" >> /etc/apt/preferences.d/pdns \
|
||||||
&& curl https://repo.powerdns.com/FD380FBB-pub.asc | apt-key add - \
|
&& curl https://repo.powerdns.com/FD380FBB-pub.asc | apt-key add - \
|
||||||
&& apt-get -y update \
|
&& apt-get -y update \
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
disable-tcp=yes
|
|
||||||
cache-ttl=0
|
cache-ttl=0
|
||||||
loglevel=7
|
loglevel=7
|
||||||
log-dns-details=yes
|
log-dns-details=yes
|
||||||
|
|
|
@ -153,7 +153,7 @@ func buildTemplate() *template.Template {
|
||||||
}
|
}
|
||||||
|
|
||||||
func isValidHostname(host string) (string, bool) {
|
func isValidHostname(host string) (string, bool) {
|
||||||
valid, _ := regexp.Match("^[a-z0-9]{1,32}$", []byte(host))
|
valid, _ := regexp.Match("^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)$", []byte(host))
|
||||||
|
|
||||||
return host, valid
|
return host, valid
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,10 +139,6 @@ const indexTemplate string = `
|
||||||
|
|
||||||
<div id="command_output"></div>
|
<div id="command_output"></div>
|
||||||
|
|
||||||
<div class="footer">
|
|
||||||
<p>© Philipp Böhm</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div> <!-- /container -->
|
</div> <!-- /container -->
|
||||||
|
|
||||||
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
||||||
|
|
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 125 KiB |
Loading…
Reference in a new issue