Browse Source

updated confs, env, run.sh

tags/v2.0.0
Robin Thoni 6 years ago
parent
commit
8d097d08c4

+ 2
- 2
env View File

@@ -6,8 +6,8 @@ POSTGRES_DB=poweradmin
6 6
 PDNS_RECURSOR_HOST=pdns-recursor.pdns.internal.docker
7 7
 PDNS_API_KEY=change_it
8 8
 PDNS_WEBSERVER_PASSWORD=change_it
9
-PDNS_ALLOW_AXFR_IPS=127.0.0.1,172.0.0.0/8,192.168.0.0/16
10
-PDNS_ALLOW_RECURSION=127.0.0.1,172.0.0.0/8,192.168.0.0/16
9
+PDNS_ALLOW_AXFR_IPS=127.0.0.1/8,172.16.0.0/12,192.168.0.0/16,10.0.0.0/8
10
+PDNS_ALLOW_RECURSION=127.0.0.1/8,172.16.0.0/12,192.168.0.0/16,10.0.0.0/8
11 11
 PDNS_ALSO_NOTIFY=
12 12
 PDNS_ALLOW_NOTIFY_FROM=0.0.0.0/0,::/0
13 13
 PDNS_ALLOW_DNSUPDATE_FROM=127.0.0.0/8,::1

+ 20
- 1
pdns-recursor/Dockerfile View File

@@ -2,6 +2,17 @@ FROM robinthoni/debian-multiarch:jessie
2 2
 
3 3
 MAINTAINER Robin Thoni <robin@rthoni.com>
4 4
 
5
+ARG CONFIG_DIR=/etc/default/config-files/
6
+
7
+RUN apt-get update && \
8
+    apt-get install -y curl && \
9
+    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
10
+
11
+RUN dist=$(if uname -m | grep -iq arm  ; then echo raspbian; else echo debian; fi) &&\
12
+     echo "deb http://repo.powerdns.com/${dist} jessie-rec-40 main" > /etc/apt/sources.list.d/pdns.list && \
13
+    echo 'Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 600' > /etc/apt/preferences.d/pdns && \
14
+    curl https://repo.powerdns.com/FD380FBB-pub.asc | apt-key add -
15
+
5 16
 RUN DEBIAN_FRONTEND=noninteractive apt-get update &&\
6 17
     apt-get install -y pdns-recursor &&\
7 18
     apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@@ -10,10 +21,18 @@ RUN rm -rf /etc/powerdns/*
10 21
 
11 22
 RUN rm -rf /var/log/*
12 23
 
13
-COPY ./config/ /etc/powerdns/
24
+COPY ./vars-vars /etc/vars-vars
25
+
26
+COPY ./vars-files /etc/vars-files
27
+
28
+COPY ./common.sh /common.sh
14 29
 
15 30
 COPY ./run.sh /run.sh
16 31
 
32
+RUN mkdir "${CONFIG_DIR}"
33
+
34
+COPY ./config/recursor.conf "${CONFIG_DIR}"/recursor.conf
35
+
17 36
 EXPOSE 53/udp
18 37
 
19 38
 CMD ["/run.sh"]

+ 41
- 0
pdns-recursor/common.sh View File

@@ -0,0 +1,41 @@
1
+export CONFIG_DIR="/etc/default/config-files/"
2
+
3
+resolv_host()
4
+{
5
+  hostname="${1}"
6
+  ip=$(getent hosts "${hostname}" | cut -d' ' -f1)
7
+  echo "${ip}"
8
+}
9
+
10
+replace_var()
11
+{
12
+  file="${1}"
13
+  var="${2}"
14
+  sed -e "s?${var}?${!var}?g" -i "${file}"
15
+}
16
+
17
+replace_vars()
18
+{
19
+  file="${1}"
20
+  for var in $(cat /etc/vars-vars)
21
+  do
22
+    replace_var "${file}" "${var}"
23
+  done
24
+}
25
+
26
+replace_files()
27
+{
28
+  cat /etc/vars-files | while read line
29
+  do
30
+    filesrc="${CONFIG_DIR}$(echo "${line}" | awk '{print $1}')"
31
+    filedst=$(echo "${line}" | awk '{print $2}')
32
+    if [ -f "${filesrc}" ]
33
+    then
34
+      echo "Expanding file ${filesrc} to ${filedst}"
35
+      cp "${filesrc}" "${filedst}"
36
+      replace_vars "${filedst}"
37
+    else
38
+      echo "File ${filesrc} does not exist. Skipping."
39
+    fi
40
+  done
41
+}

+ 4
- 0
pdns-recursor/run.sh View File

@@ -1,3 +1,7 @@
1 1
 #! /usr/bin/env bash
2 2
 
3
+. /common.sh
4
+
5
+replace_files
6
+
3 7
 pdns_recursor --daemon=no

+ 1
- 0
pdns-recursor/vars-files View File

@@ -0,0 +1 @@
1
+recursor.conf /etc/powerdns/recursor.conf

+ 20
- 0
pdns-recursor/vars-vars View File

@@ -0,0 +1,20 @@
1
+POSTGRES_HOST
2
+POSTGRES_USER
3
+POSTGRES_PASSWORD
4
+POSTGRES_DB
5
+
6
+PDNS_RECURSOR_HOST
7
+PDNS_API_KEY
8
+PDNS_WEBSERVER_PASSWORD
9
+PDNS_ALLOW_AXFR_IPS
10
+PDNS_ALLOW_RECURSION
11
+PDNS_ALSO_NOTIFY
12
+PDNS_ALLOW_NOTIFY_FROM
13
+PDNS_ALLOW_DNSUPDATE_FROM
14
+
15
+SESSION_KEY
16
+
17
+DNS_HOSTMASTER
18
+DNS_NS1
19
+DNS_NS2
20
+DNS_TTL

+ 8
- 4
pdns/Dockerfile View File

@@ -2,6 +2,8 @@ FROM robinthoni/debian-multiarch:jessie
2 2
 
3 3
 MAINTAINER Robin Thoni <robin@rthoni.com>
4 4
 
5
+ARG CONFIG_DIR=/etc/default/config-files/
6
+
5 7
 RUN apt-get update && \
6 8
     apt-get install -y curl && \
7 9
     apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@@ -19,18 +21,20 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update &&\
19 21
     apt-get install -y pdns-server pdns-backend-pgsql &&\
20 22
     apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
21 23
 
22
-RUN rm -rf /etc/powerdns/*
23
-
24 24
 RUN rm -rf /var/log/*
25 25
 
26
-COPY ./config/ /etc/powerdns/
27
-
28 26
 COPY ./vars-vars /etc/vars-vars
29 27
 
30 28
 COPY ./vars-files /etc/vars-files
31 29
 
30
+COPY ./common.sh /common.sh
31
+
32 32
 COPY ./run.sh /run.sh
33 33
 
34
+RUN mkdir "${CONFIG_DIR}"
35
+
36
+COPY ./config/pdns.conf "${CONFIG_DIR}"/pdns.conf
37
+
34 38
 EXPOSE 53/udp
35 39
 
36 40
 CMD ["/run.sh"]

+ 41
- 0
pdns/common.sh View File

@@ -0,0 +1,41 @@
1
+export CONFIG_DIR="/etc/default/config-files/"
2
+
3
+resolv_host()
4
+{
5
+  hostname="${1}"
6
+  ip=$(getent hosts "${hostname}" | cut -d' ' -f1)
7
+  echo "${ip}"
8
+}
9
+
10
+replace_var()
11
+{
12
+  file="${1}"
13
+  var="${2}"
14
+  sed -e "s?${var}?${!var}?g" -i "${file}"
15
+}
16
+
17
+replace_vars()
18
+{
19
+  file="${1}"
20
+  for var in $(cat /etc/vars-vars)
21
+  do
22
+    replace_var "${file}" "${var}"
23
+  done
24
+}
25
+
26
+replace_files()
27
+{
28
+  cat /etc/vars-files | while read line
29
+  do
30
+    filesrc="${CONFIG_DIR}$(echo "${line}" | awk '{print $1}')"
31
+    filedst=$(echo "${line}" | awk '{print $2}')
32
+    if [ -f "${filesrc}" ]
33
+    then
34
+      echo "Expanding file ${filesrc} to ${filedst}"
35
+      cp "${filesrc}" "${filedst}"
36
+      replace_vars "${filedst}"
37
+    else
38
+      echo "File ${filesrc} does not exist. Skipping."
39
+    fi
40
+  done
41
+}

+ 15
- 2
pdns/config/pdns.conf View File

@@ -238,13 +238,12 @@ guardian=yes
238 238
 # include-dir Include *.conf files from this directory
239 239
 #
240 240
 # include-dir=
241
-include-dir=/etc/powerdns/pdns.d
241
+# include-dir=/etc/powerdns/pdns.d
242 242
 
243 243
 #################################
244 244
 # launch  Which backends to launch and order to query them in
245 245
 #
246 246
 # launch=
247
-launch=
248 247
 
249 248
 #################################
250 249
 # load-modules  Load this module - supply absolute or relative path
@@ -575,3 +574,17 @@ webserver-print-arguments=yes
575 574
 # xfr-max-received-mbytes Maximum number of megabytes received from an incoming XFR
576 575
 #
577 576
 # xfr-max-received-mbytes=100
577
+
578
+
579
+# PostgreSQL Configuration
580
+#
581
+# Launch gpgsql backend
582
+launch=gpgsql
583
+
584
+# gpgsql parameters
585
+gpgsql-host=POSTGRES_HOST
586
+gpgsql-port=
587
+gpgsql-dbname=POSTGRES_DB
588
+gpgsql-user=POSTGRES_USER
589
+gpgsql-password=POSTGRES_PASSWORD
590
+gpgsql-dnssec=yes

+ 0
- 12
pdns/config/pdns.d/pdns.local.gpgsql.conf View File

@@ -1,12 +0,0 @@
1
-# PostgreSQL Configuration
2
-#
3
-# Launch gpgsql backend
4
-launch+=gpgsql
5
-
6
-# gpgsql parameters
7
-gpgsql-host=POSTGRES_HOST
8
-gpgsql-port=
9
-gpgsql-dbname=POSTGRES_DB
10
-gpgsql-user=POSTGRES_USER
11
-gpgsql-password=POSTGRES_PASSWORD
12
-gpgsql-dnssec=yes

+ 1
- 23
pdns/run.sh View File

@@ -4,29 +4,7 @@ sleep 5
4 4
 
5 5
 export PDNS_RECURSOR_HOST="$(getent hosts ${PDNS_RECURSOR_HOST} | cut -d' ' -f1)"
6 6
 
7
-replace_var()
8
-{
9
-  file="${1}"
10
-  var="${2}"
11
-  sed -e "s?${var}?${!var}?g" -i "${file}"
12
-}
13
-
14
-replace_vars()
15
-{
16
-  file="${1}"
17
-  for var in $(cat /etc/vars-vars)
18
-  do
19
-    replace_var "${file}" "${var}"
20
-  done
21
-}
22
-
23
-replace_files()
24
-{
25
-  for file in $(cat /etc/vars-files)
26
-  do
27
-    replace_vars "${file}"
28
-  done
29
-}
7
+. /common.sh
30 8
 
31 9
 replace_files
32 10
 

+ 1
- 2
pdns/vars-files View File

@@ -1,2 +1 @@
1
-/etc/powerdns/pdns.d/pdns.local.gpgsql.conf
2
-/etc/powerdns/pdns.conf
1
+pdns.conf /etc/powerdns/pdns.conf

+ 1
- 0
poweradmin/apache2.conf View File

@@ -1,5 +1,6 @@
1 1
 # see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf
2 2
 
3
+ServerName poweradmin
3 4
 Mutex file:/var/lock/apache2 default
4 5
 PidFile /var/run/apache2/apache2.pid
5 6
 Timeout 300

+ 1
- 1
update_vars.sh View File

@@ -1,7 +1,7 @@
1 1
 #! /usr/bin/env sh
2 2
 
3 3
 vars=$(cat env | cut -d= -f1)
4
-for docker in pdns poweradmin
4
+for docker in pdns pdns-recursor poweradmin
5 5
 do
6 6
   echo "${vars}" > "./${docker}/vars-vars"
7 7
 done

Loading…
Cancel
Save