From 2a97d682050e57e4c4b923b5f568f7a43c6e49ee Mon Sep 17 00:00:00 2001 From: DuckY1987 <16365083+DuckY1987@users.noreply.github.com> Date: Wed, 25 Oct 2023 10:52:51 +0200 Subject: [PATCH 1/6] Update Dockerfile --- deployment/Dockerfile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/deployment/Dockerfile b/deployment/Dockerfile index 50a55a3..9fd0d18 100644 --- a/deployment/Dockerfile +++ b/deployment/Dockerfile @@ -1,9 +1,9 @@ -FROM golang:1.20 as builder +FROM golang:1.21.0-bullseye as builder ENV GO111MODULE=on ENV GOPATH=/root/go RUN mkdir -p /root/go/src -COPY dyndns /root/go/src/dyndns +COPY ../dyndns /root/go/src/dyndns WORKDIR /root/go/src/dyndns # temp sqlite3 error fix ENV CGO_CFLAGS "-g -O2 -Wno-return-local-addr" @@ -13,18 +13,18 @@ RUN GOOS=linux go build -o /root/go/bin/dyndns && go test -v FROM debian:11-slim RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ - apt-get install -q -y bind9 dnsutils curl && \ - apt-get clean + apt-get install -q -y bind9 dnsutils curl libc6 && \ + apt-get clean RUN chmod 770 /var/cache/bind -COPY deployment/setup.sh /root/setup.sh +COPY setup.sh /root/setup.sh RUN chmod +x /root/setup.sh -COPY deployment/named.conf.options /etc/bind/named.conf.options +COPY named.conf.options /etc/bind/named.conf.options WORKDIR /root COPY --from=builder /root/go/bin/dyndns /root/dyndns -COPY dyndns/views /root/views -COPY dyndns/static /root/static +COPY ../dyndns/views /root/views +COPY ../dyndns/static /root/static EXPOSE 53 8080 CMD ["sh", "-c", "/root/setup.sh ; service named start ; /root/dyndns"] From aca90153d6b2bbffe4a2748133f56a24c390b509 Mon Sep 17 00:00:00 2001 From: DuckY1987 <16365083+DuckY1987@users.noreply.github.com> Date: Wed, 25 Oct 2023 10:53:07 +0200 Subject: [PATCH 2/6] Update docker-compose.yml --- deployment/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index 3844e77..4dec656 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -8,6 +8,7 @@ services: DDNS_DOMAINS: 'dyndns.example.com' DDNS_PARENT_NS: 'ns.example.com' DDNS_DEFAULT_TTL: '3600' + DDNS_TRANSFER: 'none' ports: - "53:53" - "53:53/udp" From defd92f4e59317e7b0b18fa34f4be5b8a51e5122 Mon Sep 17 00:00:00 2001 From: DuckY1987 <16365083+DuckY1987@users.noreply.github.com> Date: Wed, 25 Oct 2023 10:53:22 +0200 Subject: [PATCH 3/6] Update envfile --- deployment/envfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deployment/envfile b/deployment/envfile index 8cbdb69..14fb184 100644 --- a/deployment/envfile +++ b/deployment/envfile @@ -1,4 +1,5 @@ DDNS_ADMIN_LOGIN=admin:$$3$$abcdefg DDNS_DOMAINS=dyndns.example.com DDNS_PARENT_NS=ns.example.com -DDNS_DEFAULT_TTL=3600 \ No newline at end of file +DDNS_DEFAULT_TTL=3600 +DDNS_TRANSFER=none From ab97fbd3a820ec2169b0c86dd202e91a6983043e Mon Sep 17 00:00:00 2001 From: DuckY1987 <16365083+DuckY1987@users.noreply.github.com> Date: Wed, 25 Oct 2023 10:53:41 +0200 Subject: [PATCH 4/6] Update envfile --- deployment/envfile | 49 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/deployment/envfile b/deployment/envfile index 14fb184..f35245f 100644 --- a/deployment/envfile +++ b/deployment/envfile @@ -1,5 +1,44 @@ -DDNS_ADMIN_LOGIN=admin:$$3$$abcdefg -DDNS_DOMAINS=dyndns.example.com -DDNS_PARENT_NS=ns.example.com -DDNS_DEFAULT_TTL=3600 -DDNS_TRANSFER=none +#!/bin/bash + +#[ -z "$DDNS_ADMIN_LOGIN" ] && echo "DDNS_ADMIN_LOGIN not set" && exit 1; +[ -z "$DDNS_DOMAINS" ] && echo "DDNS_DOMAINS not set" && exit 1; +[ -z "$DDNS_PARENT_NS" ] && echo "DDNS_PARENT_NS not set" && exit 1; +[ -z "$DDNS_DEFAULT_TTL" ] && echo "DDNS_DEFAULT_TTL not set" && exit 1; +[ -z "$DDNS_TRANSFER" ] && echo "DDNS_TRANSFER not set" && exit 1; + +DDNS_IP=$(curl icanhazip.com) + +for d in ${DDNS_DOMAINS//,/ } +do + if ! grep 'zone "'$d'"' /etc/bind/named.conf > /dev/null + then + echo "creating zone..."; + cat >> /etc/bind/named.conf < /var/cache/bind/$d.zone < Date: Wed, 25 Oct 2023 10:54:19 +0200 Subject: [PATCH 5/6] Update envfile --- deployment/envfile | 49 +++++----------------------------------------- 1 file changed, 5 insertions(+), 44 deletions(-) diff --git a/deployment/envfile b/deployment/envfile index f35245f..14fb184 100644 --- a/deployment/envfile +++ b/deployment/envfile @@ -1,44 +1,5 @@ -#!/bin/bash - -#[ -z "$DDNS_ADMIN_LOGIN" ] && echo "DDNS_ADMIN_LOGIN not set" && exit 1; -[ -z "$DDNS_DOMAINS" ] && echo "DDNS_DOMAINS not set" && exit 1; -[ -z "$DDNS_PARENT_NS" ] && echo "DDNS_PARENT_NS not set" && exit 1; -[ -z "$DDNS_DEFAULT_TTL" ] && echo "DDNS_DEFAULT_TTL not set" && exit 1; -[ -z "$DDNS_TRANSFER" ] && echo "DDNS_TRANSFER not set" && exit 1; - -DDNS_IP=$(curl icanhazip.com) - -for d in ${DDNS_DOMAINS//,/ } -do - if ! grep 'zone "'$d'"' /etc/bind/named.conf > /dev/null - then - echo "creating zone..."; - cat >> /etc/bind/named.conf < /var/cache/bind/$d.zone < Date: Wed, 25 Oct 2023 10:54:51 +0200 Subject: [PATCH 6/6] Update setup.sh --- deployment/setup.sh | 51 +++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/deployment/setup.sh b/deployment/setup.sh index e481852..af8614b 100644 --- a/deployment/setup.sh +++ b/deployment/setup.sh @@ -4,44 +4,45 @@ [ -z "$DDNS_DOMAINS" ] && echo "DDNS_DOMAINS not set" && exit 1; [ -z "$DDNS_PARENT_NS" ] && echo "DDNS_PARENT_NS not set" && exit 1; [ -z "$DDNS_DEFAULT_TTL" ] && echo "DDNS_DEFAULT_TTL not set" && exit 1; +[ -z "$DDNS_TRANSFER" ] && echo "DDNS_TRANSFER not set" && exit 1; DDNS_IP=$(curl icanhazip.com) for d in ${DDNS_DOMAINS//,/ } do - if ! grep 'zone "'$d'"' /etc/bind/named.conf > /dev/null - then - echo "creating zone..."; - cat >> /etc/bind/named.conf < /dev/null + then + echo "creating zone..."; + cat >> /etc/bind/named.conf < /var/cache/bind/$d.zone < /var/cache/bind/$d.zone <