summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Colomar <sebastian.colomar@gmail.com>2020-05-28 05:35:17 +0200
committerSebastian Colomar <sebastian.colomar@gmail.com>2020-05-28 05:35:17 +0200
commit74ad7088013fed153c9f218ac3c78f23d549534a (patch)
treeb321a8c597b1f2a077cca0896735f565c5ffe365
parentf4c98cb8566292d3fad47da5ce25286f7b028455 (diff)
Use bind as a DNS for internal network
-rw-r--r--bind/Dockerfile15
-rw-r--r--bind/Dockerfile-devel34
-rw-r--r--bind/etc/docker/swarm/release/dns-blue.yaml35
-rw-r--r--bind/etc/docker/swarm/release/dns.yaml35
-rw-r--r--bind/run/configs/etc/bind/named.conf20
-rw-r--r--bind/run/secrets/var/bind/master/10.1689
-rw-r--r--bind/run/secrets/var/bind/master/alejandro-colomar.com11
7 files changed, 159 insertions, 0 deletions
diff --git a/bind/Dockerfile b/bind/Dockerfile
new file mode 100644
index 0000000..74f4a57
--- /dev/null
+++ b/bind/Dockerfile
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (C) 2020 Sebastian Francisco Colomar Bauza #
+# Copyright (C) 2020 Alejandro Colomar Andrés #
+# SPDX-License-Identifier: GPL-2.0-only #
+###############################################################################
+
+## alpine:latest
+FROM alpine@sha256:39eda93d15866957feaee28f8fc5adb545276a64147445c64992ef69804dbf01 \
+ AS dns
+
+RUN apk add --no-cache --upgrade bind
+
+CMD ["named", "-c", "/etc/bind/named.conf", "-g"]
+
+###############################################################################
diff --git a/bind/Dockerfile-devel b/bind/Dockerfile-devel
new file mode 100644
index 0000000..d9c3dd6
--- /dev/null
+++ b/bind/Dockerfile-devel
@@ -0,0 +1,34 @@
+###############################################################################
+# Copyright (C) 2020 Sebastian Francisco Colomar Bauza #
+# Copyright (C) 2020 Alejandro Colomar Andrés #
+# SPDX-License-Identifier: GPL-2.0-only #
+###############################################################################
+
+## alpine/git:latest
+FROM alpine/git@sha256:8d2aedf3898243892d170f033603b40a55e0b0a8ab68ba9762f9c0dae40b5c8d \
+ AS git
+
+RUN \
+ git clone \
+ --single-branch \
+ --branch bind \
+ https://github.com/alejandro-colomar/dns.alejandro-colomar.git \
+ /repo
+
+###############################################################################
+
+## alpine:latest
+FROM alpine@sha256:39eda93d15866957feaee28f8fc5adb545276a64147445c64992ef69804dbf01 \
+ AS dns
+
+RUN apk add --no-cache --upgrade bind
+
+## configure dns server
+COPY --from=git /repo/run/configs/etc/bind/named.conf \
+ /etc/bind/named.conf
+COPY --from=git /repo/run/secrets/var/bind/master \
+ /run/secrets/var/bind/master
+
+CMD ["named", "-c", "/etc/bind/named.conf", "-g"]
+
+###############################################################################
diff --git a/bind/etc/docker/swarm/release/dns-blue.yaml b/bind/etc/docker/swarm/release/dns-blue.yaml
new file mode 100644
index 0000000..c3b541a
--- /dev/null
+++ b/bind/etc/docker/swarm/release/dns-blue.yaml
@@ -0,0 +1,35 @@
+#########################################################################
+# Copyright (C) 2020 Sebastian Francisco Colomar Bauza #
+# SPDX-License-Identifier: GPL-2.0-only #
+#########################################################################
+
+configs:
+ named:
+ file: /run/configs/etc/bind/named.conf
+
+secrets:
+ forward:
+ file: /run/secrets/var/bind/master/alejandro-colomar.com
+ reverse:
+ file: /run/secrets/var/bind/master/10.168
+
+services:
+ dns:
+ configs:
+ - mode: 0440
+ source: named
+ target: /etc/bind/named.conf
+ deploy:
+ mode: global
+ image: "alejandrocolomar/dns.alejandro-colomar:v0.1"
+ ports:
+ - "5353:53/udp"
+ secrets:
+ - mode: 0440
+ source: forward
+ target: var/bind/master/alejandro-colomar.com
+ - mode: 0440
+ source: reverse
+ target: var/bind/master/10.168
+
+version: '3.8'
diff --git a/bind/etc/docker/swarm/release/dns.yaml b/bind/etc/docker/swarm/release/dns.yaml
new file mode 100644
index 0000000..3833cd4
--- /dev/null
+++ b/bind/etc/docker/swarm/release/dns.yaml
@@ -0,0 +1,35 @@
+#########################################################################
+# Copyright (C) 2020 Sebastian Francisco Colomar Bauza #
+# SPDX-License-Identifier: GPL-2.0-only #
+#########################################################################
+
+configs:
+ named:
+ file: /run/configs/etc/bind/named.conf
+
+secrets:
+ forward:
+ file: /run/secrets/var/bind/master/alejandro-colomar.com
+ reverse:
+ file: /run/secrets/var/bind/master/10.168
+
+services:
+ dns:
+ configs:
+ - mode: 0440
+ source: named
+ target: /etc/bind/named.conf
+ deploy:
+ mode: global
+ image: "alejandrocolomar/dns.alejandro-colomar:v0.1"
+ ports:
+ - "53:53/udp"
+ secrets:
+ - mode: 0440
+ source: forward
+ target: var/bind/master/alejandro-colomar.com
+ - mode: 0440
+ source: reverse
+ target: var/bind/master/10.168
+
+version: '3.8'
diff --git a/bind/run/configs/etc/bind/named.conf b/bind/run/configs/etc/bind/named.conf
new file mode 100644
index 0000000..c3356b1
--- /dev/null
+++ b/bind/run/configs/etc/bind/named.conf
@@ -0,0 +1,20 @@
+options {
+ allow-query { any; };
+ allow-recursion { none; };
+ allow-transfer { none; };
+ directory "/var/bind";
+ listen-on-v6 { none; };
+ pid-file "/var/run/named/named.pid";
+ recursion no;
+};
+
+zone "alejandro-colomar.com" {
+ file "/run/secrets/var/bind/master/alejandro-colomar.com";
+ type master;
+};
+
+zone "168.10.in-addr.arpa" IN {
+ file "/run/secrets/var/bind/master/10.168";
+ type master;
+};
+
diff --git a/bind/run/secrets/var/bind/master/10.168 b/bind/run/secrets/var/bind/master/10.168
new file mode 100644
index 0000000..75e8b60
--- /dev/null
+++ b/bind/run/secrets/var/bind/master/10.168
@@ -0,0 +1,9 @@
+$TTL 604800
+@ IN SOA dns.alejandro-colomar.com. root.dns.alejandro-colomar.com. (
+ 1
+ 604800
+ 86400
+ 2419200
+ 604800 )
+ IN NS dns.alejandro-colomar.com.
+100.6 IN PTR robot.alejandro-colomar.com.
diff --git a/bind/run/secrets/var/bind/master/alejandro-colomar.com b/bind/run/secrets/var/bind/master/alejandro-colomar.com
new file mode 100644
index 0000000..18358ac
--- /dev/null
+++ b/bind/run/secrets/var/bind/master/alejandro-colomar.com
@@ -0,0 +1,11 @@
+$TTL 604800
+@ IN SOA dns.alejandro-colomar.com. root.dns.alejandro-colomar.com. (
+ 2
+ 604800
+ 86400
+ 2419200
+ 604800 )
+ IN NS dns.alejandro-colomar.com.
+dns IN A 127.0.0.1
+kube-apiserver IN CNAME dns
+robot IN A 10.168.6.100