Skip to content

Commit d9fb4d9

Browse files
author
Tatsuya Kawano
committed
Apply pull request fooforge#7 from cdoughty77 for the upstream:
- Add support for DDNS keys
1 parent 6e36014 commit d9fb4d9

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Description
33

44
This cookbook takes care of the installation and configuration of BIND9. At the moment you're able to define some global variables and to manage your zonefiles via data bags (json example below).
55
It currently also supports automatic serial number generation and automatic resource records for chef nodes (see optional json in example below)
6-
Besides that there's not much to see, e.g. no DNSSEC, no configurable logging, no rndc shell operations or other safety checks (named-checkconf, etc.).
6+
Besides that there's not much to see, e.g. no configurable logging, no rndc shell operations or other safety checks (named-checkconf, etc.).
77

88
It's my intention to round its edges over time. If you want to help feel free to contribute!
99

@@ -15,9 +15,7 @@ Requirements
1515

1616
Platform:
1717

18-
* Debian
19-
* Ubuntu
20-
* Centos
18+
* Ubuntu (Tested on)
2119

2220
Attributes
2321
==========
@@ -30,6 +28,10 @@ Attributes
3028
* **node[:bind9][:enable_forwarding]** - Enables forwarding of requests. Default is: No forwarding
3129
* **node[:bind9][:forwarders]** - Array for forwarding DNS. Default is: 4.4.4.4 and 8.8.8.8 (Google DNS)
3230

31+
* **node[:bind9][:enable_ddns]** - Allows Dynamic DNS (DDNS) to be enabled. Default is: false
32+
* **node[:bind9][:ddns_algorithm]** - If DDNS is enabled, a algorithm can be specified. Default is: nil
33+
* **node[:bind9][:ddns_secret]** - If DDNS is enabled, a key can be specified. Default is: nil
34+
3335
Usage
3436
=====
3537

attributes/default.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
default[:bind9][:enable_forwarding] = false
1212
default[:bind9][:forwarders] = [ "4.4.4.4", "8.8.8.8" ]
1313

14+
# Allow user to enable DDNS
15+
default[:bind9][:enable_ddns] = false
16+
default[:bind9][:ddns_algorithm] = nil
17+
default[:bind9][:ddns_secret] = nil
18+
1419
case platform
1520
when "centos","redhat","fedora","scientific","amazon"
1621
default[:bind9][:config_path] = "/etc/named"
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
//
2-
// Do any local configuration here
2+
// MANAGED BY CHEF : Do any local configuration here
33
//
44

55
// Consider adding the 1918 zones here, if they are not used in your
66
// organization
77
//include "/etc/bind/zones.rfc1918";
88

9+
<% if node[:bind9][:enable_ddns] %>
10+
key DDNS_UPDATE {
11+
algorithm <%= node[:bind9][:ddns_algorithm] %>;
12+
secret "<%= node[:bind9][:ddns_secret] %>";
13+
};
14+
<% end %>
15+
916
<% @zonefiles.each do |conf| -%>
1017
zone "<%= conf["domain"] %>" IN {
1118
type <%= conf["type"] %>;
12-
file "<%= node[:bind9][:config_path] %>/<%= conf["domain"] %>";
13-
allow-transfer {
14-
<% conf["allow_transfer"].each do |ip| -%>
15-
<%= ip %>;
19+
file "<%= node[:bind9][:data_path] %>/<%= conf["domain"] %>";
20+
notify no;
21+
<% if node[:bind9][:enable_ddns] %>
22+
allow-update { key DDNS_UPDATE; };
1623
<% end %>
17-
};
1824
};
1925

2026
<% end %>

0 commit comments

Comments
 (0)