From 2352db2a16751f079e24358faf1f52d2db2bc621 Mon Sep 17 00:00:00 2001 From: Nicholas Chappell Date: Tue, 6 Jan 2015 15:53:31 -0800 Subject: [PATCH] Added the ability to set up statistics channels via a statistics_channels parameter; added documentation to the server/conf.pp manifest and example usage to the README. --- README.md | 24 ++++++++++++++++++++++++ manifests/server/conf.pp | 5 +++++ templates/named.conf.erb | 13 +++++++++++++ 3 files changed, 42 insertions(+) diff --git a/README.md b/README.md index 9f7f9690e..486a81688 100644 --- a/README.md +++ b/README.md @@ -122,3 +122,27 @@ bind::server::conf { } ``` +You can use the `statistics_channels` parameter to set up one or more statistics channels. + +`statistics_channels` is a hash of hashes. Each nested hash sets up a statistics channel +and contains the listening IP address and port for the channel and the IP addresses/address +blocks or ACLs that are allowed to access the channel: + +```puppet +bind::server::conf { '/etc/named.conf': +... + statistics_channels => { + 'channel-1' => { + listen_address => '*', + listen_port => '8053', + allow => ['127.0.0.1', '10.0.0.0/8'], + }, + 'channel-2' => { + listen_address => '*', + listen_port => '8054', + allow => ['127.0.0.1', '10.0.0.0/8'], + }, + }, +... +} +``` diff --git a/manifests/server/conf.pp b/manifests/server/conf.pp index 1f11132fc..47966da77 100644 --- a/manifests/server/conf.pp +++ b/manifests/server/conf.pp @@ -33,6 +33,10 @@ # $memstatistics_file: # Memory statistics file for the server. # Default: '/var/named/data/named_mem_stats.txt' +# $statistics_channels: +# Hash of hashes; each nested hash contains the listening IP address and listening port +# for a statistics channel webpage and an array of ACLs or IP addresses/address blocks +# that are allowed to access it. Defaults to empty. # $allow_query: # Array of IP addrs or ACLs to allow queries from. Default: [ 'localhost' ] # $recursion: @@ -94,6 +98,7 @@ $dump_file = '/var/named/data/cache_dump.db', $statistics_file = '/var/named/data/named_stats.txt', $memstatistics_file = '/var/named/data/named_mem_stats.txt', + $statistics_channels = {}, $allow_query = [ 'localhost' ], $allow_query_cache = [], $recursion = 'yes', diff --git a/templates/named.conf.erb b/templates/named.conf.erb index bce153ce2..304297658 100644 --- a/templates/named.conf.erb +++ b/templates/named.conf.erb @@ -23,6 +23,19 @@ masters <%= key %> { <% end -%> <% end -%> + +<% if !@statistics_channels.empty? -%> +statistics-channels { +<% @statistics_channels.each do |stat_channel,stat_channel_settings|-%> + <%- if stat_channel_settings.is_a?(Hash) -%> + <%- if stat_channel_settings['listen_address'] and !stat_channel_settings['listen_address'].empty? and stat_channel_settings['listen_port'] and !stat_channel_settings['listen_port'].empty? -%> + inet <%=stat_channel_settings['listen_address']%> port <%= stat_channel_settings['listen_port'] %> allow { <%=stat_channel_settings['allow'].join("; ")%>; }; + <%- end -%> +<%- end -%> +<%- end -%> +}; +<%- end -%> + options { <% if @listen_on_port -%> listen-on port <%= @listen_on_port %> { <%= @listen_on_addr.join("; ") %>; };