From 547cebc73f8c252884af621f02962e7e4ee1b5f4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 7 Dec 2023 16:20:06 +0900 Subject: [PATCH] Debian/Ubuntu: Fix rndc.key file path in rndc.conf In Debian families, the rndc.key file is created in /etc/bind instead of /etc. This fixes the key file path in rndc.conf. Also this updates the rncd.conf path to place it in the same directory. Change-Id: If6fa440541b5c8b3073b72de97d9550dbe6f8c2a --- copy_logs.sh | 3 +++ manifests/bind.pp | 5 ++++- manifests/designate.pp | 5 ++++- templates/rndc.conf.erb | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/copy_logs.sh b/copy_logs.sh index 9d5388a59..b7402c690 100755 --- a/copy_logs.sh +++ b/copy_logs.sh @@ -159,6 +159,9 @@ fi # bind if [ -d /etc/named ]; then sudo cp -r /etc/named $LOG_DIR/etc + if [ -f /etc/rndc.conf ]; then + sudo cp -r /etc/rndc.conf $LOG_DIR/rndc.conf + fi elif [ -d /etc/bind ]; then sudo cp -r /etc/bind $LOG_DIR/etc fi diff --git a/manifests/bind.pp b/manifests/bind.pp index da3f75ad1..2b3c59b6a 100644 --- a/manifests/bind.pp +++ b/manifests/bind.pp @@ -42,10 +42,13 @@ class openstack_integration::bind { }, } + $dnsdir = $::dns::params::dnsdir + # ::dns creates the rndc key but not a rndc.conf. # Contribute this in upstream ::dns ? - file { '/etc/rndc.conf': + file { 'rndc.conf': ensure => present, + path => "${dnsdir}/rndc.conf", owner => $::dns::params::user, group => $::dns::params::group, content => template("${module_name}/rndc.conf.erb"), diff --git a/manifests/designate.pp b/manifests/designate.pp index cb7444ad3..44d1d62e4 100644 --- a/manifests/designate.pp +++ b/manifests/designate.pp @@ -124,10 +124,13 @@ class openstack_integration::designate ( bind9_hosts => [$::openstack_integration::config::host], dns_port => 5322, mdns_hosts => [$::openstack_integration::config::host], - rndc_config_file => '/etc/rndc.conf', + rndc_config_file => "${::dns::params::dnsdir}/rndc.conf", rndc_key_file => $::dns::params::rndckeypath, manage_pool => true, # Configure bind using openstack_integration::bind configure_bind => false, } + + File['rndc.conf'] -> Anchor['designate::service::begin'] + Class['dns::service'] -> Anchor['designate::service::begin'] } diff --git a/templates/rndc.conf.erb b/templates/rndc.conf.erb index 62a784623..92c52c4a9 100644 --- a/templates/rndc.conf.erb +++ b/templates/rndc.conf.erb @@ -1,4 +1,4 @@ -include "/etc/rndc.key"; +include "<%= @dnsdir %>/rndc.key"; options { default-key "rndc-key"; default-server <%= @bind_host %>;