From c888fae1499e0f5e9e333fb8d162b5d53088f67d Mon Sep 17 00:00:00 2001 From: Alex Conrey Date: Tue, 17 Apr 2018 22:52:47 -0500 Subject: [PATCH 1/2] implement optional logging w/ custom_logging option --- manifests/server/conf.pp | 2 ++ templates/named.conf.erb | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/manifests/server/conf.pp b/manifests/server/conf.pp index 14fcbc1fc..69dce9839 100644 --- a/manifests/server/conf.pp +++ b/manifests/server/conf.pp @@ -107,6 +107,8 @@ $allow_query = [ 'localhost' ], $allow_query_cache = [], $recursion = 'yes', + $logging = true, + $custom_logging = {}, $allow_recursion = [], $allow_transfer = [], $check_names = [], diff --git a/templates/named.conf.erb b/templates/named.conf.erb index 8d0c47155..c91d16432 100644 --- a/templates/named.conf.erb +++ b/templates/named.conf.erb @@ -98,6 +98,7 @@ options { bindkeys-file "/etc/named.iscdlv.key"; }; +<% if @logging -%> logging { channel main_log { file "/var/log/named/named.log" versions 3 size 5m; @@ -112,7 +113,20 @@ logging { category lame-servers { null; }; +<% if @custom_logging and !@custom_logging.empty? -%> +<% @custom_logging.each do |log_type,log_hashes| -%> +<% log_hashes.each do |name,log_hash| -%> + <%= log_type %> <%= name %> { +<% log_hash.each do |key,val| -%> + <%= key %> <%= val %>; +<% end -%> + }; +<% end -%> +<% end -%> +<% end -%> }; +<% end -%> + <% if !@views.empty? -%> <% @views.sort_by {|key,value| key}.each do |key,value| -%> From 31fe3236774c11f46a59929ee304f7692a42cc8e Mon Sep 17 00:00:00 2001 From: Alex Conrey Date: Tue, 17 Apr 2018 23:05:50 -0500 Subject: [PATCH 2/2] update documentation --- manifests/server/conf.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/server/conf.pp b/manifests/server/conf.pp index 69dce9839..7e1b16845 100644 --- a/manifests/server/conf.pp +++ b/manifests/server/conf.pp @@ -60,6 +60,12 @@ # and the value is an array of config lines. Default: empty # $includes: # Array of absolute paths to named.conf include files. Default: empty +# $logging: +# Boolean to include default logging options +# Default: true +# $custom_logging: +# Hash of logging options (currently limited to ['category','channel'] per named.conf +# Example: {channel => {security => {key => val, }}, category => {security => {}} # # Sample Usage : # bind::server::conf { '/etc/named.conf':