Skip to content

Commit d54bd03

Browse files
committed
chore: sanitize repo
0 parents  commit d54bd03

27 files changed

+458
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
venv
2+
.DS_Store
3+
.gitsecret/keys/random_seed
4+
!*.secret
5+
scratch

.gitsecret/keys/pubring.kbx

2.43 KB
Binary file not shown.

.gitsecret/keys/pubring.kbx~

32 Bytes
Binary file not shown.

.gitsecret/keys/trustdb.gpg

1.17 KB
Binary file not shown.

.gitsecret/paths/mapping.cfg

Whitespace-only changes.

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!make
2+
SHELL := /bin/bash
3+
#.EXPORT_ALL_VARIABLES:
4+
export TEST_HOST_IP=$(shell python scripts/hostIP.py;)
5+
6+
default: build
7+
8+
clean:
9+
docker stack rm dns
10+
11+
deploy-test: build
12+
docker stack deploy --resolve-image=never --compose-file docker-compose.test.yml dns --prune
13+
14+
test: deploy-test
15+
python3 "tests/functional tests.py"
16+
17+
test-cst:
18+
bash "tests/container tests.sh"
19+
20+
build:
21+
docker build -t recursor:latest -f ./recursor/Dockerfile ./recursor
22+
docker build -t nameserver:latest -f ./nameserver/Dockerfile ./nameserver

README.MD

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Docker-BIND DNS Server
2+
A containerized DNS server powered by BIND.
3+
4+
This project consists of two components:
5+
* The **DNS Recursor** - By default, this component forwards queries to upstream DNS servers and caches their responses
6+
* The **DNS Nameserver** - This component is a slightly different configuration of bind that functions as exclusively as an authoritative name server
7+
8+
### Design Considerations
9+
* BIND SHOULD NOT simultaneously operate as a recursor *and* an authoritative name server - this is why the project consists of two components rather than one
10+
11+
## Usage
12+
### Secure Your Deployment
13+
To communicate between components bind needs a key to authenticate those communications. An RNDC key will be generated automatically at /etc/bind/rndc/rndc.key if one isn't found at startup. A new key can be generated at any time using the `rndc-confgen` command. Keys can be shared by mounting the containers at a shared volume at the time of deployment.
14+
15+
*docker-compose.yml:*
16+
17+
version: '3.3'
18+
services:
19+
...
20+
21+
recursor:
22+
volumes:
23+
- rndc_shared_key:/etc/bind/rndc/
24+
...
25+
26+
nameserver:
27+
volumes:
28+
- rndc_shared_key:/etc/bind/rndc/
29+
30+
volumes:
31+
rndc_shared_key:
32+
driver: local
33+
34+
### Configuring The Recursor

docker-compose.dev.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3.3'
2+
services:
3+
recursor:
4+
build:
5+
context: ./recursor
6+
dockerfile: Dockerfile
7+
ports:
8+
# Requires Port 53 UDP as the Primary Port with TCP as a fallback
9+
# https://bind9.readthedocs.io/en/latest/dnssec-guide.html?highlight=53#wait-dns-uses-tcp
10+
- "53:53/udp"
11+
- "53:53"

docker-compose.test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '3.3'
2+
services:
3+
recursor:
4+
image: recursor:latest
5+
ports:
6+
# Requires Port 53 UDP as the Primary Port with TCP as a fallback
7+
# https://bind9.readthedocs.io/en/latest/dnssec-guide.html?highlight=53#wait-dns-uses-tcp
8+
- "53:53/udp"
9+
- "53:53"
10+
environment:
11+
- BIND_NAMESERVER_IP=${TEST_HOST_IP}
12+
- BIND_RECURSOR_DNSSEC_VALIDATION=no
13+
volumes:
14+
- rndc_shared_key:/etc/bind/rndc/
15+
16+
nameserver:
17+
image: nameserver:latest
18+
ports:
19+
- "8053:53/udp"
20+
- "8053:53"
21+
volumes:
22+
- rndc_shared_key:/etc/bind/rndc/
23+
24+
volumes:
25+
rndc_shared_key:
26+
driver: local

nameserver/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## AUTHORITATIVE NAME SERVER
2+
FROM alpine:3.13 as build
3+
4+
RUN apk update && apk add bind;
5+
#RUN apk add iproute2-ss
6+
COPY etc/bind/ /etc/bind/
7+
COPY entrypoint.sh /sbin/entrypoint.sh
8+
RUN chmod 755 /sbin/entrypoint.sh
9+
RUN cd /etc/bind && rm rndc.key && ln -s rndc/rndc.key rndc.key
10+
RUN adduser -g bind -HD bind && \
11+
chown -R root:bind /etc/bind && \
12+
chown -R root:bind /run/named && \
13+
chown -R root:bind /var/bind
14+
EXPOSE 53/udp 53/tcp
15+
16+
ENTRYPOINT ["/sbin/entrypoint.sh"]

0 commit comments

Comments
 (0)