drmaxnix/bind

By drmaxnix

Updated 18 days ago

Ready to use BIND 9 Docker Image

Image
Networking
0

5.9K

drmaxnix/bind repository overview

Source Code: git.tjdev.de/DrMaxNix/bind-docker

Bind Docker

Ready to use BIND 9 Docker Image

Usage Example: Primary Authoritative NS

docker-compose.yml:

services:
  bind:
    image: drmaxnix/bind:1
    restart: unless-stopped
    volumes:
      - ./named.conf:/etc/bind/named.conf:ro
      - ./zonefiles/example.com.zone:/var/bind/example.com.zone:ro
      - ./data:/var/bind
    ports:
      - "53:53/tcp"
      - "53:53/udp"

named.conf:

options {
	version none;
	allow-transfer { none; };
	notify primary-only;
	allow-query { localhost; };
	recursion no;
	auth-nxdomain no;
	dnssec-validation auto;
	serial-update-method date;
	//querylog yes;
};

zone "example.com" IN {
	type primary;
	file "/var/bind/example.com.zone";
	allow-query { any; };
	//allow-transfer { 198.51.100.2; 2001:db8:5d2:2::1; };
	dnssec-policy default;
	inline-signing yes;
};

zonefiles/example.com.zone:

$TTL		86400
$ORIGIN		example.com.

@			IN		SOA			ns1.example.com. admin.example.com. (
								2026060300 ; serial (yyyymmddxx)
								43200      ; refresh (12h)
								5400       ; retry (1.5h)
								2419200    ; expire (4w)
								43200 )    ; negative cache ttl (12h)

@			IN		NS			ns1.example.com.
;@			IN		NS			ns2.example.com.

ns1			IN		A			198.51.100.1
ns1			IN		AAAA		2001:db8:5d2:1::1
;ns2		IN		A			198.51.100.2
;ns2		IN		AAAA		2001:db8:5d2:2::1

@			IN		A			198.51.100.17
@			IN		AAAA		2001:db8:7ce:17::1
*			IN		CNAME		example.com.

Usage Example: Secondary Authoritative NS

docker-compose.yml:

services:
  bind:
    image: drmaxnix/bind:1
    restart: unless-stopped
    volumes:
      - ./named.conf:/etc/bind/named.conf:ro
      - ./data:/var/bind
    ports:
      - "53:53/tcp"
      - "53:53/udp"

named.conf:

options {
	version none;
	allow-transfer { none; };
	notify primary-only;
	allow-query { localhost; };
	recursion no;
	auth-nxdomain no;
	dnssec-validation auto;
	serial-update-method date;
	//querylog yes;
};

zone "example.com" IN {
	type secondary;
	file "/var/bind/example.com.zone";
	allow-query { any; };
	primaries { 198.51.100.1; 2001:db8:5d2:1::1; };
};

Usage Example: Recursive Resolver

docker-compose.yml:

services:
  bind:
    image: drmaxnix/bind:1
    restart: unless-stopped
    volumes:
      - ./named.conf:/etc/bind/named.conf:ro
      - ./data:/var/bind
    ports:
      - "53:53/tcp"
      - "53:53/udp"

named.conf:

options {
	version none;
	allow-recursion { 10.0.0.0/8; 172.16.0.0/12; 192.168.0.0/16; fc00::/7; };
	allow-transfer { none; };
	//querylog yes;
};

zone "." IN {
	type hint;
	file "/var/bindfiles/named.ca";
};

zone "localhost" IN {
	type master;
	file "/var/bindfiles/pri/localhost.zone";
	allow-update { none; };
	notify no;
};

zone "127.in-addr.arpa" IN {
	type master;
	file "/var/bindfiles/pri/127.zone";
	allow-update { none; };
	notify no;
};

Caution

Make sure only trusted clients can access your recursive resolver. So called "Open Resolvers" can be abused for DNS Amplification Attacks.

Tag summary

Content type

Image

Digest

sha256:a28cb3716

Size

11.1 MB

Last updated

18 days ago

docker pull drmaxnix/bind