diff --git a/README.md b/README.md index c8601e0..91de830 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Description 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). It currently also supports automatic serial number generation and automatic resource records for chef nodes (see optional json in example below) -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.). +Besides that there's not much to see, e.g. no configurable logging, no rndc shell operations or other safety checks (named-checkconf, etc.). It's my intention to round its edges over time. If you want to help feel free to contribute! @@ -15,9 +15,7 @@ Requirements Platform: -* Debian -* Ubuntu -* Centos +* Ubuntu (Tested on) Attributes ========== @@ -30,6 +28,10 @@ Attributes * **node[:bind9][:enable_forwarding]** - Enables forwarding of requests. Default is: No forwarding * **node[:bind9][:forwarders]** - Array for forwarding DNS. Default is: 4.4.4.4 and 8.8.8.8 (Google DNS) +* **node[:bind9][:enable_ddns]** - Allows Dynamic DNS (DDNS) to be enabled. Default is: false +* **node[:bind9][:ddns_algorithm]** - If DDNS is enabled, a algorithm can be specified. Default is: nil +* **node[:bind9][:ddns_secret]** - If DDNS is enabled, a key can be specified. Default is: nil + Usage ===== diff --git a/attributes/default.rb b/attributes/default.rb index e80690e..77edfc1 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -11,6 +11,11 @@ default[:bind9][:enable_forwarding] = false default[:bind9][:forwarders] = [ "4.4.4.4", "8.8.8.8" ] +# Allow user to enable DDNS +default[:bind9][:enable_ddns] = false +default[:bind9][:ddns_algorithm] = nil +default[:bind9][:ddns_secret] = nil + case platform when "centos","redhat","fedora","scientific","amazon" default[:bind9][:config_path] = "/etc/named" diff --git a/templates/default/named.conf.local.erb b/templates/default/named.conf.local.erb index c35456b..47a7751 100644 --- a/templates/default/named.conf.local.erb +++ b/templates/default/named.conf.local.erb @@ -1,20 +1,26 @@ // -// Do any local configuration here +// MANAGED BY CHEF : Do any local configuration here // // Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918"; +<% if node[:bind9][:enable_ddns] %> +key DDNS_UPDATE { + algorithm <%= node[:bind9][:ddns_algorithm] %>; + secret "<%= node[:bind9][:ddns_secret] %>"; +}; +<% end %> + <% @zonefiles.each do |conf| -%> zone "<%= conf["domain"] %>" IN { type <%= conf["type"] %>; - file "<%= node[:bind9][:config_path] %>/<%= conf["domain"] %>"; - allow-transfer { - <% conf["allow_transfer"].each do |ip| -%> - <%= ip %>; + file "<%= node[:bind9][:data_path] %>/<%= conf["domain"] %>"; + notify no; + <% if node[:bind9][:enable_ddns] %> + allow-update { key DDNS_UPDATE; }; <% end %> - }; }; <% end %>