This repository defines the component that manages Bind9 DNS Server instances.
NSUpdate commands get dispatched from REST API calls defined in the bindman webhook project Bindman DNS Webhook.
The bindman is setup with the help of environment variables and volume mapping in the following way:
A store of records being managed is needed. Hence, a /data
volume must be mapped to the host. There, we also expect to find the .private
and .key
files for secure communication with the actual nameserver
-
mandatory
BINDMAN_NAMESERVER_ADDRESS: address of the nameserver that an instance of a Bindman will manage -
mandatory
BINDMAN_NAMESERVER_KEY_FILE: the zone keyfile name that will be used to authenticate with the nameserver. MUST be inside the/data
volume -
mandatory
BINDMAN_NAMESERVER_ZONE: the name of the zone a bindman-dns-bind9 instance is able to manage; -
optional
BINDMAN_NAMESERVER_PORT: custom port for communication with the nameserver; defaults to53
-
optional
BINDMAN_DNS_TTL: the dns recording rule expiration time (or time-to-live). By default, the TTL is 3600 seconds. -
optional
BINDMAN_DNS_REMOVAL_DELAY: the delay in minutes to be applied to the removal of an DNS entry. The default is 10 minutes. This is to guarantee that in fact the removal should be processed. -
optional
BINDMAN_DEBUG: let the runtime know if the DEBUG mode is activated; useful for debugging the intermediary files created for sendingnsupdate
commands. Possible values:false|true
. Empty defaults tofalse
.
On the /keys
folder of the bind
service, you will find the keys that enable secure communication between the manager and the Bind9 Server for the test.com
zone.
For now, we support only dnssec-keygen
generated keys. We used the following commands for the test.com
zone:
dnssec-keygen -a HMAC-MD5 -b 512 -n HOST test.com
Go here to understand a bit more about how to properly configure your BIND DNS server.
This repository also comes with an example. Just go to your terminal and type:
$ docker-compose up
This will launch two services:
-
a bind9 DNS;
-
a bindman-dns-bind9;
With these two services running, you can make a request to the Bindman manager endpoints using Postman (you can import the collection with the bindman-dns-bind9.postman_collection.json
file) or by cURL commands with the examples below.
- Records All
$ curl --location --request GET \
'http://localhost:7070/records'
- Record By Query
$ curl --location --request GET \
'http://localhost:7070/records/hello.test.com/A'
- Add Record
$ curl --location --request POST \
'http://localhost:7070/records' \
--header 'Accept-Encoding: application/json' \
--header 'Content-Type: text/plain' \
--data-raw '{
"name": "hello.test.com",
"value": "127.0.0.1",
"type": "A"
}'
- Update Record
$ curl --location --request PUT \
'http://localhost:7070/records' \
--header 'Accept-Encoding: application/json' \
--header 'Content-Type: text/plain' \
--data-raw '{
"name": "hello.test.com",
"value": "192.168.0.1",
"type": "A"
}'
- Remove Record
$ curl --location --request DELETE \
'http://localhost:7070/records/hello.test.com/A'