Showing with 423 additions and 4 deletions.
  1. +13 −0 CHANGELOG.md
  2. +17 −1 manifests/config.pp
  3. +38 −0 manifests/init.pp
  4. +31 −0 manifests/params.pp
  5. +3 −3 metadata.json
  6. +275 −0 spec/classes/dns_init_spec.rb
  7. +14 −0 templates/sysconfig.Debian.erb
  8. +32 −0 templates/sysconfig.RedHat.erb
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## [6.1.0](https://github.com/theforeman/puppet-dns/tree/6.1.0) (2019-06-12)

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

**Implemented enhancements:**

- Add support for managing sysconfig settings [\#145](https://github.com/theforeman/puppet-dns/pull/145) ([antaflos](https://github.com/antaflos))
- Make managing BIND system group optional [\#139](https://github.com/theforeman/puppet-dns/pull/139) ([antaflos](https://github.com/antaflos))

**Merged pull requests:**

- Allow puppetlabs/concat and puppetlabs/stdlib 6.x [\#146](https://github.com/theforeman/puppet-dns/pull/146) ([alexjfisher](https://github.com/alexjfisher))

## [6.0.0](https://github.com/theforeman/puppet-dns/tree/6.0.0) (2019-04-15)

[Full Changelog](https://github.com/theforeman/puppet-dns/compare/5.4.0...6.0.0)
Expand Down
18 changes: 17 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Configure dns
# @api private
class dns::config {
group { $dns::params::group: }
if $dns::group_manage {
group { $dns::params::group: }
}

concat { $dns::publicviewpath:
owner => root,
Expand Down Expand Up @@ -57,4 +59,18 @@
group => $dns::params::group,
mode => '0640',
}

# Only Debian and RedHat OS provide a sysconfig or default file where we can
# set startup options and other environment settings for named. In FreeBSD
# such settings must be set in the global, common /etc/rc.conf file and under
# ArchLinux we must use systemd override files to change the startup
# commandline. These cases are outside of this module's scope.
if $facts['osfamily'] in ['Debian', 'RedHat'] {
file { $dns::sysconfig_file:
owner => 'root',
group => 'root',
mode => '0644',
content => template($dns::sysconfig_template),
}
}
}
38 changes: 38 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
# Path of the config file holding all the zones
# @param vardir
# Directory holding the variable or working files
# @param group_manage
# Should this module manage the Unix system group under which BIND runs (see
# dns::params)? Defaults to true. Set to false if you want to manage the
# system group yourself.
# @param namedservicename
# Name of the service
# @param zonefilepath
Expand Down Expand Up @@ -54,6 +58,33 @@
# an array of subnet strings.
# @param optionsconf_template
# The template to be used for options.conf
# @param sysconfig_file
# Path to the sysconfig or default file used to set startup options for
# named. Under Debian this is /etc/default/bind9, under RedHat this is
# /etc/sysconfig/named. FreeBSD/DragonFly and ArchLinux do not feature such
# files, thus the sysconfig parameters are not relevant for these operating
# systems.
# @param sysconfig_template
# The template used to model /etc/default/bind9 or /etc/sysconfig/named.
# Default is "dns/sysconfig.${facts[osfamily]}.erb" for Debian and RedHat,
# and undef for others.
# @param sysconfig_startup_options
# Startup options for the `named` process, rendered as the `OPTIONS` string
# in the sysconfig file (see above). Use this to set commandline flags and
# options for `named`. For example, to use IPv4 only and disable IPv6 support
# in named on Debian set this parameter to `-u bind -4`. The default value
# depends on the underlying OS.
# @param sysconfig_resolvconf_integration
# Should named integrate with resolvconf upon startup? Default is false, and
# this only pertains to the Debian OS family.
# @param sysconfig_disable_zone_checking
# Should zone checking be disabled upon named startup? Default is undef, and
# this only pertains to the RedHat OS family.
# @param sysconfig_additional_settings
# Additional settings to add to the sysconfig file. This is a simple hash of
# key-value strings that will be rendered as `KEY="value"` in the sysconfig
# file. Use this to add custom (environment) variables relevant for named.
# Default is empty.
# @param controls
# 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
Expand Down Expand Up @@ -85,6 +116,7 @@
Stdlib::Absolutepath $optionspath = $dns::params::optionspath,
Stdlib::Absolutepath $publicviewpath = $dns::params::publicviewpath,
Stdlib::Absolutepath $vardir = $dns::params::vardir,
Boolean $group_manage = $dns::params::group_manage,
String $namedservicename = $dns::params::namedservicename,
Stdlib::Absolutepath $zonefilepath = $dns::params::zonefilepath,
Variant[Enum['unmanaged'], Stdlib::Absolutepath] $localzonepath = $dns::params::localzonepath,
Expand All @@ -102,6 +134,12 @@
String $namedconf_template = $dns::params::namedconf_template,
Hash[String, Array[String]] $acls = $dns::params::acls,
String $optionsconf_template = $dns::params::optionsconf_template,
Optional[Stdlib::Absolutepath] $sysconfig_file = $dns::params::sysconfig_file,
Optional[String] $sysconfig_template = $dns::params::sysconfig_template,
Optional[String] $sysconfig_startup_options = $dns::params::sysconfig_startup_options,
Optional[Boolean] $sysconfig_resolvconf_integration = $dns::params::sysconfig_resolvconf_integration,
Optional[Boolean] $sysconfig_disable_zone_checking = $dns::params::sysconfig_disable_zone_checking,
Optional[Hash[String[1], String]] $sysconfig_additional_settings = $dns::params::sysconfig_additional_settings,
Hash[String, Hash[String, Data]] $controls = $dns::params::controls,
Variant[Enum['running', 'stopped'], Boolean] $service_ensure = $dns::params::service_ensure,
Boolean $service_enable = $dns::params::service_enable,
Expand Down
31 changes: 31 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
$user = 'bind'
$group = 'bind'
$rndcconfgen = '/usr/sbin/rndc-confgen'
$sysconfig_file = '/etc/default/bind9'
$sysconfig_template = "dns/sysconfig.${facts['osfamily']}.erb"
$sysconfig_startup_options = '-u bind'
$sysconfig_resolvconf_integration = false

# This option is not relevant for Debian
$sysconfig_disable_zone_checking = undef
}
'RedHat': {
$dnsdir = '/etc'
Expand All @@ -31,6 +38,13 @@
$user = 'named'
$group = 'named'
$rndcconfgen = '/usr/sbin/rndc-confgen'
$sysconfig_file = '/etc/sysconfig/named'
$sysconfig_template = "dns/sysconfig.${facts['osfamily']}.erb"
$sysconfig_startup_options = undef
$sysconfig_disable_zone_checking = undef

# This option is not relevant for RedHat
$sysconfig_resolvconf_integration = undef
}
/^(FreeBSD|DragonFly)$/: {
$dnsdir = '/usr/local/etc/namedb'
Expand All @@ -46,6 +60,12 @@
$user = 'bind'
$group = 'bind'
$rndcconfgen = '/usr/local/sbin/rndc-confgen'
# The sysconfig settings are not relevant for FreeBSD
$sysconfig_file = undef
$sysconfig_template = undef
$sysconfig_startup_options = undef
$sysconfig_disable_zone_checking = undef
$sysconfig_resolvconf_integration = undef
}
'Archlinux': {
$dnsdir = '/etc'
Expand All @@ -61,15 +81,26 @@
$user = 'named'
$group = 'named'
$rndcconfgen = '/usr/sbin/rndc-confgen'
# The sysconfig settings are not relevant for ArchLinux
$sysconfig_file = undef
$sysconfig_template = undef
$sysconfig_startup_options = undef
$sysconfig_disable_zone_checking = undef
$sysconfig_resolvconf_integration = undef
}
default: {
fail ("Unsupported operating system family ${facts['osfamily']}")
}
}

# This module will manage the system group by default
$group_manage = true

$namedconf_template = 'dns/named.conf.erb'
$optionsconf_template = 'dns/options.conf.erb'

$sysconfig_additional_settings = {}

$namedconf_path = "${dnsdir}/named.conf"

#pertaining to rndc
Expand Down
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-dns",
"version": "6.0.0",
"version": "6.1.0",
"author": "theforeman",
"summary": "Manage the ISC BIND daemon",
"license": "Apache-2.0",
Expand All @@ -18,11 +18,11 @@
"dependencies": [
{
"name": "puppetlabs/concat",
"version_requirement": ">= 1.0.0 < 6.0.0"
"version_requirement": ">= 4.1.0 < 7.0.0"
},
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.13.1 < 6.0.0"
"version_requirement": ">= 4.13.1 < 7.0.0"
}
],
"requirements": [
Expand Down
Loading