dns: Fix dns::server for OpenBSD 5.8.

This commit is contained in:
Timo Makinen 2015-11-23 13:55:12 +02:00
parent db058e1801
commit 6fdcea8395

View file

@ -12,15 +12,24 @@ class dns::server {
$bind_package = "bind-chroot" $bind_package = "bind-chroot"
} }
} }
$bind_service = "named"
} }
"debian","ubuntu": { "debian","ubuntu": {
$bind_package = "bind9" $bind_package = "bind9"
$bind_service = "bind9"
} }
"openbsd": { "openbsd": {
$bind_package = undef if versioncmp($::operatingsystemrelease, "5.8") < 0 {
$bind_package = undef
$bind_service = "named"
} else {
$bind_package = "isc-bind"
$bind_service = "isc_named"
}
} }
default: { default: {
$bind_package = "bind-chroot" $bind_package = "bind-chroot"
$bind_service = "named"
} }
} }
@ -70,6 +79,13 @@ class dns::server {
} }
case $::operatingsystem { case $::operatingsystem {
"openbsd": {
if versioncmp($::operatingsystemrelease, "5.8") < 0 {
$group = "named"
} else {
$group = "_bind"
}
}
"ubuntu": { "ubuntu": {
$group = "bind" $group = "bind"
} }
@ -117,9 +133,9 @@ class dns::server {
mode => "0640", mode => "0640",
owner => "root", owner => "root",
group => $group, group => $group,
require => $::operatingsystem ? { require => $bind_package ? {
"openbsd" => undef, undef => undef,
default => Package["bind"], default => Package["bind"],
}, },
} }
exec { "rndc-confgen": exec { "rndc-confgen":
@ -127,7 +143,7 @@ class dns::server {
"" => "rndc-confgen -r /dev/urandom -a", "" => "rndc-confgen -r /dev/urandom -a",
default => "rndc-confgen -r /dev/urandom -a -t ${chroot}", default => "rndc-confgen -r /dev/urandom -a -t ${chroot}",
}, },
path => "/bin:/usr/bin:/sbin:/usr/sbin", path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin",
unless => "test -s ${chroot}${rndckey}", unless => "test -s ${chroot}${rndckey}",
require => File["${chroot}${rndckey}"], require => File["${chroot}${rndckey}"],
} }
@ -143,30 +159,19 @@ class dns::server {
exec { "named-checkconf": exec { "named-checkconf":
command => $chroot ? { command => $chroot ? {
"" => "/usr/sbin/named-checkconf -z", "" => "named-checkconf -z",
default => "/usr/sbin/named-checkconf -z -t ${chroot}" default => "named-checkconf -z -t ${chroot}"
}, },
path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin",
refreshonly => true, refreshonly => true,
require => Exec["rndc-confgen"], require => Exec["rndc-confgen"],
notify => Service["named"], notify => Service["named"],
} }
service { "named": service { "named":
name => $::operatingsystem ? { name => $bind_service,
"ubuntu" => "bind9",
default => "named",
},
ensure => running, ensure => running,
enable => true, enable => true,
status => "/usr/sbin/rndc status",
stop => $::operatingsystem ? {
"openbsd" => "pkill -u named",
default => undef,
},
start => $::operatingsystem ? {
"openbsd" => "/usr/sbin/named ${options}",
default => undef,
},
} }
file { "named.conf": file { "named.conf":
@ -175,9 +180,9 @@ class dns::server {
mode => "0640", mode => "0640",
owner => "root", owner => "root",
group => $group, group => $group,
require => $::operatingsystem ? { require => $bind_package ? {
"openbsd" => undef, undef => undef,
default => Package["bind"], default => Package["bind"],
}, },
notify => Exec["generate-named-conf"], notify => Exec["generate-named-conf"],
} }
@ -209,9 +214,9 @@ class dns::server {
mode => "0640", mode => "0640",
owner => "root", owner => "root",
group => $group, group => $group,
require => $::operatingsystem ? { require => $bind_package ? {
"openbsd" => undef, undef => undef,
default => Package["bind"], default => Package["bind"],
}, },
notify => Exec["named-checkconf"], notify => Exec["named-checkconf"],
} }
@ -224,9 +229,9 @@ class dns::server {
mode => "0640", mode => "0640",
owner => "root", owner => "root",
group => $group, group => $group,
require => $::operatingsystem ? { require => $bind_package ? {
"openbsd" => undef, undef => undef,
default => Package["bind"], default => Package["bind"],
}, },
notify => Exec["named-checkconf"], notify => Exec["named-checkconf"],
} }