Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2nd chance: feat query_log - optional parameter query_log_enable to enable query log #192

Merged
merged 3 commits into from
Jan 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 65 additions & 64 deletions manifests/server/options.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,19 @@
#
# === Parameters
#
# [*forwarders*]
# Array of forwarders IP addresses. Default: empty
#
# [*transfers*]
# Array of IP addresses or "none" allowed to transfer. Default: empty
#
# [*listen_on*]
# Array of IP addresses on which to listen. Default: empty, meaning "any"
#
# [*listen_on_ipv6*]
# Array of IPv6 addresses on which to listen. Default: empty, meaning "any"
#
# [*listen_on_port*]:
# UDP/TCP port number to use for receiving and sending traffic.
# Default: undefined, meaning 53
#
# [*allow_recursion*]
# Array of IP addresses which are allowed to make recursive queries.
# Default: empty, meaning "localnets; localhost"
#
# [*allow_query*]
# Array of IP addresses which are allowed to ask ordinary DNS questions.
# Default: empty, meaning "any"
#
# [*also_notify*]
# The list of servers to which additional zone-change notifications
# should be sent.
# Default: empty, meaning no additional servers
#
# [*check_names_master*]
# Restrict the character set and syntax of master zones.
# Default: undefined, meaning "fail"
Expand All @@ -36,39 +29,9 @@
# Restrict the character set and syntax of network responses.
# Default: undefined, meaning "ignore"
#
# [*allow_query*]
# Array of IP addresses which are allowed to ask ordinary DNS questions.
# Default: empty, meaning "any"
#
# [*statistic_channel_ip*]
# String of one ip for which the statistic api is bound.
# Default: undef, meaning the statistic channel is disable,
# both statistic_channel_port and statistic_channel_ip must be defined
# for the statistic api to be enabled
#
# [*statistic_channel_port*]
# String of one port for which the statistic api is bound.
# Default: undef, meaning the statistic channel is disable
# both statistic_channel_port and statistic_channel_ip must be defined
# for the statistic api to be enabled
#
# [*statistic_channel_allow*]
# Array of IPs that are allowed to query the statistics channel.
# Default: undef, meaning all IPs that can reach statistic_channel_ip are allowed
# to query it
#
# [*zone_notify*]
# Controls notifications when a zone for which this server is
# authoritative changes. String of yes (send notifications to zone's
# NS records and to also-notify list), no (no notifications are sent),
# master-only (only send notifications for master zones), or explicit
# (send notifications only to also-notify list).
# Default: undef, meaning the BIND default of "yes"
#
# [*also_notify*]
# The list of servers to which additional zone-change notifications
# should be sent.
# Default: empty, meaning no additional servers
# [*data_dir*]
# Bind data directory.
# Default: /etc/bind/zones
#
# [*dnssec_validation*]
# Controls DNS-SEC validation. String of "yes", "auto", "no", or
Expand All @@ -84,6 +47,19 @@
# dnssec_validation above), and true on Debian and on RedHat 6
# and above.
#
# [*forwarders*]
# Array of forwarders IP addresses. Default: empty
#
# [*listen_on*]
# Array of IP addresses on which to listen. Default: empty, meaning "any"
#
# [*listen_on_ipv6*]
# Array of IPv6 addresses on which to listen. Default: empty, meaning "any"
#
# [*listen_on_port*]:
# UDP/TCP port number to use for receiving and sending traffic.
# Default: undefined, meaning 53
#
# [*no_empty_zones*]
# Controls whether to enable/disable empty zones. Boolean values.
# Default: false, meaning enable empty zones
Expand All @@ -93,14 +69,38 @@
# Default: undef, meaning the primary IP address of the DNS server,
# as determined by BIND.
#
# [*statistic_channel_ip*]
# String of one ip for which the statistic api is bound.
# Default: undef, meaning the statistic channel is disable,
# both statistic_channel_port and statistic_channel_ip must be defined
# for the statistic api to be enabled
#
# [*statistic_channel_port*]
# String of one port for which the statistic api is bound.
# Default: undef, meaning the statistic channel is disable
# both statistic_channel_port and statistic_channel_ip must be defined
# for the statistic api to be enabled
#
# [*statistic_channel_allow*]
# Array of IPs that are allowed to query the statistics channel.
# Default: undef, meaning all IPs that can reach statistic_channel_ip are allowed
# to query it
#
# [*transfers*]
# Array of IP addresses or "none" allowed to transfer. Default: empty
#
# [*transfer_source*]
# The source IP address from which to respond to transfer requests.
# Default: undef, meaning the primary IP address of the DNS server,
# as determined by BIND.
#
# [*data_dir*]
# Bind data directory.
# Default: /etc/bind/zones
# [*zone_notify*]
# Controls notifications when a zone for which this server is
# authoritative changes. String of yes (send notifications to zone's
# NS records and to also-notify list), no (no notifications are sent),
# master-only (only send notifications for master zones), or explicit
# (send notifications only to also-notify list).
# Default: undef, meaning the BIND default of "yes"
#
# === Examples
#
Expand All @@ -110,27 +110,28 @@
#
include dns::server::params
define dns::server::options (
$forwarders = [],
$transfers = [],
$listen_on = [],
$listen_on_ipv6 = [],
$listen_on_port = undef,
$allow_query = [],
$allow_recursion = [],
$also_notify = [],
$check_names_master = undef,
$check_names_slave = undef,
$check_names_response = undef,
$allow_query = [],
$statistic_channel_ip = undef,
$statistic_channel_port = undef,
$statistic_channel_allow = undef,
$zone_notify = undef,
$also_notify = [],
$data_dir = $::dns::server::params::data_dir,
$dnssec_validation = $::dns::server::params::default_dnssec_validation,
$dnssec_enable = $::dns::server::params::default_dnssec_enable,
$forwarders = [],
$listen_on = [],
$listen_on_ipv6 = [],
$listen_on_port = undef,
$no_empty_zones = false,
$notify_source = undef,
$query_log_enable = undef,
$statistic_channel_ip = undef,
$statistic_channel_port = undef,
$statistic_channel_allow = undef,
$transfers = [],
$transfer_source = undef,
$data_dir = $::dns::server::params::data_dir,
$zone_notify = undef,
) {
$valid_check_names = ['fail', 'warn', 'ignore']
$cfg_dir = $::dns::server::params::cfg_dir
Expand Down
2 changes: 2 additions & 0 deletions manifests/server/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$cfg_dir = '/etc/bind'
$cfg_file = '/etc/bind/named.conf'
$data_dir = '/etc/bind/zones'
$working_dir = '/var/cache/bind'
$root_hint = "${cfg_dir}/db.root"
$rfc1912_zones_cfg = "${cfg_dir}/named.conf.default-zones"
$rndc_key_file = "${cfg_dir}/rndc.key"
Expand All @@ -30,6 +31,7 @@
$cfg_dir = '/etc/named'
$cfg_file = '/etc/named.conf'
$data_dir = '/var/named'
$working_dir = "${data_dir}/data"
$root_hint = "${data_dir}/named.ca"
$rfc1912_zones_cfg = '/etc/named.rfc1912.zones'
$rndc_key_file = '/etc/named.root.key'
Expand Down
22 changes: 22 additions & 0 deletions templates/named.conf.options.erb
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,25 @@ statistics-channels {
inet <%= @statistic_channel_ip %> port <%= @statistic_channel_port %><% if @statistic_channel_allow -%> allow { <%= @statistic_channel_allow.join('; ') %>; }<% end -%>;
};
<% end -%>

<% if @query_log_enable -%>
logging {

channel query_logging {
file "<%= @working_dir %>/named_querylog"
versions 10 size 100M;
print-time yes;
severity debug 1;
};
category queries {
query_logging;
};

channel syslog_errors {
syslog user;
severity error;
};
category default { syslog_errors; };
category lame-servers { null; };
};
<% end -%>