-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
133 lines (102 loc) · 5.14 KB
/
Copy pathREADME
File metadata and controls
133 lines (102 loc) · 5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
BNDC - DNS zone file generator
================================================================================
If you run your own Bind nameserver(s) and you need to keep your forward
and reverse zones synchronized, this tool is for you.
It's a WIP and English documentation is sparse, but the example directory should
contain working configuration. Basically it uses template files (.tpl
extension by default) as a source of zone data and it generates corresponding
zone files (.db extension by default).
What makes this tool different (i.e. why I wrote it) ?
- templates files try to closely resemble zone files, making migration easy.
You can even put ordinary Bind records into a template and they will carry
into the generated zone file without change.
- reverse zones are generated from A records (not limited to a single forward
zone) and you can customize them with !PTR commands and PTR records and whatever
other records you wish. This is handy for IPs with multiple hostnames.
- you can use user defined variables to insert arbitrary data into your
zones.
IPv6 is not supported yet, but as mentioned above, you can put AAAA records
to the zone directly.
===============================================================================
Compiling
---------
Visit http://www.dlang.org for up to date D compiler. DMD is recommended for
latest Dlang features. Other D compilers are GDC (gcc backend) and LDC (LLVM
backend).
Run 'kompiluj' script to compile bndc (it's too simple, I know).
You can also use binary release, available on github, if you don't want to
mess with the D compiler.
Installing
----------
Copy bndc binary to /usr/local/bin or any other path of your choice.
Create directory for bndc data (you can use /etc/bind or similar). Create
config.tpl and your zone templates (see the example directory). BNDC uses
current directory for reading and writing its data by default, but it's
recommended to use separate directory for templates and for generated zones.
Using BNDC
----------
Have a look into the example directory. BNDC uses template files which are
basically ordinary zone files with special tokens. All tokens start with
exclamation mark '!' and there are two kinds of them: variables ( !var or
!var=value ) and commands ( !COMMAND(argument) ). Some variables are used by
BNDC, some are set by BNDC and all of them can be set and used by the user (in
any template file).
If you run bndc from the example directory, first it's going to read the
file config.tpl (you can change this with --config option). It process the
file sequentially, first setting various variables and then executing
commands (!DOMAIN and !REVERSE).
Each domain requires it's own template. They are stored in the template
directory. There can also be a header and footer template which are included at
the top and bottom of each processed template.
Generated zone files are stored in the zone directory, together with index
(bndc-zones.conf by default) which you can $include into your named.conf.
After a zone file is generated, bndc executes shell command stored in
!cmd_checkzone variable. Similarly, at the end !cmd_checkconf command is
executed.
If there are no errors (0 return value), !cmd_reload is executed.
Configuration syntax
--------------------
!variable = value [!var=value]
!variable = "val ue"
!variable = `echo "hello"`
!variable = "value !var"
!variable = ""
- whitespace outside quotes is ignored
- new value overwrites previous value
- nonexistent variable evaluates to empty string
!command(argument)
- argument is specific to each command
- repeated command means repeated call
config.tpl - default first template to read
BNDC sets following variables:
!host - last hostname from !A, !AAAA, !H commands
!zone - currently processed zone (domain)
!zonefile - generated zone file
!version - zone serial number (SOA)
!rrttl - resource record TTL, empty at the start of each zone.
for other variables used by BNDC, see example/default_config.tpl
Commands:
!TTL(1d) - $TTL 1d
!SOA(domain.cz) - domain.cz SOA: !nsname !maintname (!version !refresh !retry !expire !negttl)
!NS(ns1.isp.net., ns2) - NS records (beware trailing dot!)
!MX(10 mail.domain.cz.) - MX records (beware trailing dot!)
!A(host, 10.20.30.40) - A record
!AAAA(host6, aa:bb::01) - AAAA record - NOT IMPLEMENTED
!H(some.host.com.) - dummy host for !CNAME etc
!CNAME(myname) - CNAME to previous host (uses !host variable)
!PTR(10, some.host.com.) - override PTR in internal database (PTR record is
generated as ordinary from the database). Intended
for reverse zone templates.
!DOMAIN(domain.cz) - generate forward zone
!DOMAIN(domain.cz, also-notify {109.123.212.22;}) - forward zone with optional options
!REVERSE(10.20.30) - generate reverse zone 30.20.10.in-addr.arpa
!REVERSE(10.20.0.0/16) - generate reverse zone 20.10.in-addr.arpa
Contact
-------
Martin Krejcirik <mk@krej.cz>
License
--------
These sources are free, they are redistributable and modifiable
under the terms of the Boost Software License, Version 1.0.
The terms of this license are in the file LICENSE,
or see http://www.boost.org/LICENSE_1_0.txt.