From 2fd6eae1431476ebb32ae7761eb5829ddd549b7e Mon Sep 17 00:00:00 2001 From: Mehrdad FarshiAhmadi Date: Sat, 17 Feb 2024 18:23:43 +0330 Subject: [PATCH 1/3] compose file got modified with sample of configuration file --- .../bind9/config/example.named.conf | 12 ++++++++++ docker-compose/bind9/config/stage-local.zone | 22 +++++++++++++++++++ docker-compose/bind9/docker-compose.yaml | 12 +++++----- 3 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 docker-compose/bind9/config/stage-local.zone diff --git a/docker-compose/bind9/config/example.named.conf b/docker-compose/bind9/config/example.named.conf index e69de29b..5034feb0 100644 --- a/docker-compose/bind9/config/example.named.conf +++ b/docker-compose/bind9/config/example.named.conf @@ -0,0 +1,12 @@ +options { +directory "/var/cache/bind"; +forwarders { + 1.1.1.1; + 8.8.8.8; +}; + listen-on-v6 { any; }; +}; +zone "stage.local" IN { + type master; + file "/etc/bind/stage-local.zone"; +}; \ No newline at end of file diff --git a/docker-compose/bind9/config/stage-local.zone b/docker-compose/bind9/config/stage-local.zone new file mode 100644 index 00000000..768e92e0 --- /dev/null +++ b/docker-compose/bind9/config/stage-local.zone @@ -0,0 +1,22 @@ +$TTL 300 +$ORIGIN stage.local. +@ IN SOA stage.local. example.gmail.com. ( + 2024021700 ; serial + 12h ; refresh + 15m ; retry + 3w ;expire + 2h ;minimum ttl + ) + + IN NS ns.stage.local. + +ns IN A 192.168.14.113 + +; -- product recoreds +mehrdad IN A 192.168.14.12 +ahmadi IN A 192.168.14.13 + +; -- stage recoreds +aref IN A 192.168.13.12 +nabi IN A 192.168.13.13 +masoud IN A 192.168.13.14 diff --git a/docker-compose/bind9/docker-compose.yaml b/docker-compose/bind9/docker-compose.yaml index 2f0e2873..354e53a0 100644 --- a/docker-compose/bind9/docker-compose.yaml +++ b/docker-compose/bind9/docker-compose.yaml @@ -1,12 +1,14 @@ ---- +version: '3' + services: bind9: image: ubuntu/bind9:latest container_name: bind9 ports: - - "53:53" + - "53:53/tcp" + - "53:53/udp" volumes: - - /etc/bind/:/etc/bind/ - - /var/cache/bind:/var/cache/bind - - /var/lib/bind:/var/lib/bind + - ./config:/etc/bind/ + - ./cache:/var/cache/bind + - ./records:/var/lib/bind restart: unless-stopped \ No newline at end of file From 333904801d7ee5efc55b7759f66d5a07600de376 Mon Sep 17 00:00:00 2001 From: Mehrdad FarshiAhmadi Date: Sat, 17 Feb 2024 18:24:29 +0330 Subject: [PATCH 2/3] document file --- docker-compose/bind9/Readme.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 docker-compose/bind9/Readme.md diff --git a/docker-compose/bind9/Readme.md b/docker-compose/bind9/Readme.md new file mode 100644 index 00000000..3f89882c --- /dev/null +++ b/docker-compose/bind9/Readme.md @@ -0,0 +1,27 @@ +### [image Bind9 | Ubuntu ](https://hub.docker.com/r/ubuntu/bind9) + +if you are running it on an ubuntu machine first you have to disable `Network Name Resolution` service + +```bash +vim /etc/systemd/resolved.conf +``` + +change `#DNSStubListener=yes` to `DNSStubListener=no` and restart its service + +```bash +sudo systemctl restart systemd-resolved.service +``` + +create following directories and give write access to other users to `cache` directory + +```bash +mkdir ./config ./cache ./records && chmod o+w ./cache +``` + +change your Domain configurations in `./config/named.conf` file + +start `Bind` service with: + +```bash +sudo docker compose up -d +``` From 67948f1b5fc87679605f5a94a98cd22e74402eba Mon Sep 17 00:00:00 2001 From: Christian Lempa Date: Mon, 19 Feb 2024 09:32:38 +0100 Subject: [PATCH 3/3] formatting updates --- .../bind9/config/example.named.conf | 12 ---------- docker-compose/bind9/config/named.conf | 13 +++++++++++ docker-compose/bind9/config/stage-local.zone | 22 ------------------- docker-compose/bind9/config/yourdomain.zone | 15 +++++++++++++ docker-compose/bind9/docker-compose.yaml | 9 ++++---- 5 files changed, 33 insertions(+), 38 deletions(-) delete mode 100644 docker-compose/bind9/config/example.named.conf create mode 100644 docker-compose/bind9/config/named.conf delete mode 100644 docker-compose/bind9/config/stage-local.zone create mode 100644 docker-compose/bind9/config/yourdomain.zone diff --git a/docker-compose/bind9/config/example.named.conf b/docker-compose/bind9/config/example.named.conf deleted file mode 100644 index 5034feb0..00000000 --- a/docker-compose/bind9/config/example.named.conf +++ /dev/null @@ -1,12 +0,0 @@ -options { -directory "/var/cache/bind"; -forwarders { - 1.1.1.1; - 8.8.8.8; -}; - listen-on-v6 { any; }; -}; -zone "stage.local" IN { - type master; - file "/etc/bind/stage-local.zone"; -}; \ No newline at end of file diff --git a/docker-compose/bind9/config/named.conf b/docker-compose/bind9/config/named.conf new file mode 100644 index 00000000..e88b3afe --- /dev/null +++ b/docker-compose/bind9/config/named.conf @@ -0,0 +1,13 @@ +options { + directory "/var/cache/bind"; + forwarders { + 1.1.1.1; + 8.8.8.8; + }; + listen-on-v6 { any; }; +}; + +zone "yourdomain.home" IN { + type master; + file "/etc/bind/yourdomain.zone"; +}; diff --git a/docker-compose/bind9/config/stage-local.zone b/docker-compose/bind9/config/stage-local.zone deleted file mode 100644 index 768e92e0..00000000 --- a/docker-compose/bind9/config/stage-local.zone +++ /dev/null @@ -1,22 +0,0 @@ -$TTL 300 -$ORIGIN stage.local. -@ IN SOA stage.local. example.gmail.com. ( - 2024021700 ; serial - 12h ; refresh - 15m ; retry - 3w ;expire - 2h ;minimum ttl - ) - - IN NS ns.stage.local. - -ns IN A 192.168.14.113 - -; -- product recoreds -mehrdad IN A 192.168.14.12 -ahmadi IN A 192.168.14.13 - -; -- stage recoreds -aref IN A 192.168.13.12 -nabi IN A 192.168.13.13 -masoud IN A 192.168.13.14 diff --git a/docker-compose/bind9/config/yourdomain.zone b/docker-compose/bind9/config/yourdomain.zone new file mode 100644 index 00000000..b4fb6c47 --- /dev/null +++ b/docker-compose/bind9/config/yourdomain.zone @@ -0,0 +1,15 @@ +$TTL 300 ; 5 minutes +$ORIGIN yourdomain.home. +@ IN SOA yourdomain.home. ( + 2024021700 ; serial + 12h ; refresh + 15m ; retry + 3w ;expire + 2h ;minimum ttl + ) + + IN NS ns.yourdomain.home. + +ns IN A 192.168.14.2 + +yourserver IN A 192.168.14.3 diff --git a/docker-compose/bind9/docker-compose.yaml b/docker-compose/bind9/docker-compose.yaml index 354e53a0..52da4533 100644 --- a/docker-compose/bind9/docker-compose.yaml +++ b/docker-compose/bind9/docker-compose.yaml @@ -1,14 +1,15 @@ -version: '3' - +--- services: bind9: - image: ubuntu/bind9:latest container_name: bind9 + image: ubuntu/bind9:9.18-23.04_edge ports: - "53:53/tcp" - "53:53/udp" + # (optional) allow DNS over TLS, used by RNDC + # - "953:953/tcp" volumes: - ./config:/etc/bind/ - ./cache:/var/cache/bind - ./records:/var/lib/bind - restart: unless-stopped \ No newline at end of file + restart: unless-stopped