Showing with 70 additions and 3 deletions.
  1. +14 −1 CHANGELOG.md
  2. +5 −0 manifests/init.pp
  3. +1 −1 manifests/logging/channel.pp
  4. +6 −0 manifests/zone.pp
  5. +1 −1 metadata.json
  6. +10 −0 spec/classes/dns_init_spec.rb
  7. +16 −0 spec/defines/dns_zone_spec.rb
  8. +8 −0 templates/named.conf.erb
  9. +9 −0 templates/named.zone.erb
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## [10.3.0](https://github.com/theforeman/puppet-dns/tree/10.3.0) (2024-02-19)

[Full Changelog](https://github.com/theforeman/puppet-dns/compare/10.2.0...10.3.0)

**Implemented enhancements:**

- add support for the statistics-channels directive [\#245](https://github.com/theforeman/puppet-dns/pull/245) ([UiP9AV6Y](https://github.com/UiP9AV6Y))
- Add support for empty forwarders in master zone [\#244](https://github.com/theforeman/puppet-dns/pull/244) ([mbarecki](https://github.com/mbarecki))

**Fixed bugs:**

- Fix calling function empty\(\) with Numeric value [\#243](https://github.com/theforeman/puppet-dns/pull/243) ([smortex](https://github.com/smortex))

## [10.2.0](https://github.com/theforeman/puppet-dns/tree/10.2.0) (2023-11-14)

[Full Changelog](https://github.com/theforeman/puppet-dns/compare/10.1.0...10.2.0)
Expand Down Expand Up @@ -69,7 +82,7 @@
**Implemented enhancements:**

- Update to voxpupuli-test 5 [\#214](https://github.com/theforeman/puppet-dns/pull/214) ([ekohl](https://github.com/ekohl))
- Add support for `allow-update` in zones [\#213](https://github.com/theforeman/puppet-dns/pull/213) ([SimonPe](https://github.com/SimonPe))
- Add support for `allow-update` in zones [\#213](https://github.com/theforeman/puppet-dns/pull/213) ([LadyNamedLaura](https://github.com/LadyNamedLaura))
- Manage zone records [\#212](https://github.com/theforeman/puppet-dns/pull/212) ([BDelacour](https://github.com/BDelacour))

## [9.3.0](https://github.com/theforeman/puppet-dns/tree/9.3.0) (2022-04-20)
Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
# Specify a hash of controls. Each key is the name of a network, and its
# value is a hash containing 'port' => integer, 'keys' => array and
# 'allowed_addresses' => array
# @param statistics_channels
# Specify a hash of statistics-channels. Each key is the name of a network,
# and its value is a hash containing 'port' => integer and
# 'allowed_addresses' => array
# @param service_ensure
# The ensure attribute on the service
# @param service_enable
Expand Down Expand Up @@ -170,6 +174,7 @@
Optional[Boolean] $sysconfig_disable_zone_checking = $dns::params::sysconfig_disable_zone_checking,
Hash[String[1], String] $sysconfig_additional_settings = {},
Hash[String, Hash[String, Data]] $controls = $dns::params::controls,
Hash[String, Hash[String, Data]] $statistics_channels = {},
Variant[Enum['running', 'stopped'], Boolean] $service_ensure = 'running',
Boolean $service_enable = true,
Optional[String[1]] $service_restart_command = undef,
Expand Down
2 changes: 1 addition & 1 deletion manifests/logging/channel.pp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
if empty($file_size) {
fail('dns::logging::channel: "file_size" needs to be set with log type file')
}
if empty($file_versions) {
if !$file_versions {
fail('dns::logging::channel: "file_versions" needs to be set with log type file')
}
}
Expand Down
6 changes: 6 additions & 0 deletions manifests/zone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@
# @param zonefilepath
# @param filename
# @param forward
# @param master_empty_forwarders_enable
# Enable empty forwarders option in master zone.
# Applicable when forwarders are empty and zonetype is set to master.
# @param forwarders
# @param dns_notify
# @param zone_statistics
# @param key_directory
# @param inline_signing
# @param dnssec_secure_to_insecure
Expand Down Expand Up @@ -87,8 +91,10 @@
Boolean $manage_file_name = false,
Boolean $replace_file = false,
Enum['first', 'only'] $forward = 'first',
Boolean $master_empty_forwarders_enable = false,
Array $forwarders = [],
Optional[Enum['yes', 'no', 'explicit']] $dns_notify = undef,
Optional[Enum['yes', 'no']] $zone_statistics = undef,
Optional[Dns::UpdatePolicy] $update_policy = undef,
Optional[Stdlib::Absolutepath] $key_directory = undef,
Optional[Enum['yes', 'no']] $inline_signing = undef,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-dns",
"version": "10.2.0",
"version": "10.3.0",
"author": "theforeman",
"summary": "Manage the ISC BIND daemon",
"license": "Apache-2.0",
Expand Down
10 changes: 10 additions & 0 deletions spec/classes/dns_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,16 @@
])}
end

describe 'with statistics channels' do
let(:params) { { :statistics_channels => { '*' => { 'port' => 8053, 'allowed_addresses' => [ '127.0.0.0/8' ] } } } }

it { verify_concat_fragment_contents(catalogue, 'named.conf+10-main.dns', [
'statistics-channels {',
' inet * port 8053 allow { 127.0.0.0/8; };',
'};',
])}
end

describe 'with additional options' do
let(:params) { { :additional_options => { 'max-cache-ttl' => 3600, 'max-ncache-ttl' => 3600 } } }

Expand Down
16 changes: 16 additions & 0 deletions spec/defines/dns_zone_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,22 @@
])
end
end

context 'zone_statistics enabled' do
let(:params) { {
:zone_statistics => 'yes',
} }

it "should have valid zone configuration" do
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10__GLOBAL__example.com.dns', [
'zone "example.com" {',
' type master;',
" file \"#{zonefilepath}/db.example.com\";",
' zone-statistics yes;',
'};',
])
end
end
end
end
end
8 changes: 8 additions & 0 deletions templates/named.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ controls {
inet <%= control_ip %> port <%= control_hash['port'] %> allow { <% control_hash['allowed_addresses'].sort.each do |address| %><%= address %>; <% end %>} keys { <% control_hash['keys'].sort.each do |key| %>"<%= key %>"; <% end %>};
<%- end -%>
};
<%- if scope.lookupvar('::dns::statistics_channels').any? -%>

statistics-channels {
<%- scope.lookupvar('::dns::statistics_channels').sort_by {|k, v| k}.each do |stats_ip, stats_hash| -%>
inet <%= stats_ip %> port <%= stats_hash['port'] %> allow { <% stats_hash['allowed_addresses'].sort.each do |address| %><%= address %>; <% end %>};
<%- end -%>
};
<%- end -%>

options {
include "<%= scope.lookupvar('::dns::optionspath') %>";
Expand Down
9 changes: 9 additions & 0 deletions templates/named.zone.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ zone "<%= @zone %>" {
file "<%= @zonefilename %>";
<% end -%>
<% if @zonetype == 'master' -%>
<% if @forwarders.empty? && @master_empty_forwarders_enable -%>
forwarders {};
<% end -%>
<% unless @forwarders.empty? -%>
forwarders { <%= @forwarders.join('; ') %>; };
<% end -%>
<% if @update_policy.is_a? String -%>
update-policy <%= @update_policy %>;
<% elsif @update_policy -%>
Expand All @@ -23,6 +29,9 @@ zone "<%= @zone %>" {
allow-update { <%= @allow_update.join('; ') %>; };
<% end -%>
<% end -%>
<% if @zone_statistics -%>
zone-statistics <%= @zone_statistics %>;
<% end -%>
<% if @auto_dnssec -%>
auto-dnssec <%= @auto_dnssec %>;
<% end -%>
Expand Down