From afee192d2a77afa1c11d25156d0a44df94e19aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20T=C3=A4ffner?= <darkalex@firesplash.de> Date: Sat, 23 Jan 2016 13:30:37 +0100 Subject: [PATCH] fixed the cronjob and noticed a bug in ISPC but not able to report as FlySpray is offline --- server/lib/classes/cron.d/550-bind_dnssec.inc.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/lib/classes/cron.d/550-bind_dnssec.inc.php b/server/lib/classes/cron.d/550-bind_dnssec.inc.php index ae01b8b4ed..a8c643fb65 100644 --- a/server/lib/classes/cron.d/550-bind_dnssec.inc.php +++ b/server/lib/classes/cron.d/550-bind_dnssec.inc.php @@ -48,12 +48,14 @@ class cronjob_bind_dnssec extends cronjob { //TODO : change this when distribution information has been integrated into server record $filespre = (file_exists('/etc/gentoo-release')) ? 'pri/' : 'pri.'; - $soas = $app->db->queryAllRecords('SELECT * FROM dns_soa WHERE dnssec_wanted=\'Y\' AND dnssec_initialized=\'Y\' AND dnssec_last_signed < '.(time()-(3600*24*5-900))); //Resign zones every 5 days (expiry is 16 days so we have enough safety, 15 minutes tolerance) + $soas = $app->db->queryAllRecords('SELECT * FROM dns_soa WHERE dnssec_wanted=\'Y\' AND dnssec_initialized=\'Y\' AND dnssec_last_signed < '.(time()-(3600*24*5)+900)); //Resign zones every 5 days (expiry is 16 days so we have enough safety, 15 minutes tolerance) - while ($data = next($soas)) { + foreach ($soas as $data) { $domain = substr($data['origin'], 0, strlen($data['origin'])-1); if (!file_exists($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain)) return false; + $app->log('DNSSEC Auto-Resign: Resigning zone '.$domain, LOGLEVEL_INFO); + $zonefile = file_get_contents($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain); $keycount=0; foreach (glob($dns_config['bind_zonefiles_dir'].'/K'.$domain.'*.key') as $keyfile) { @@ -68,7 +70,7 @@ class cronjob_bind_dnssec extends cronjob { exec('cd '.escapeshellcmd($dns_config['bind_zonefiles_dir']).';'. '/usr/sbin/dnssec-signzone -A -e +1382400 -3 $(head -c 1000 /dev/random | sha1sum | cut -b 1-16) -N increment -o '.escapeshellcmd($domain).' -t '.$filespre.escapeshellcmd($domain)); - //Write Data back ino DB + //Write Data back into DB $dnssecdata = "DS-Records:\n".file_get_contents($dns_config['bind_zonefiles_dir'].'/dsset-'.$domain.'.'); $dnssecdata .= "\n------------------------------------\n\nDNSKEY-Records:\n"; foreach (glob($dns_config['bind_zonefiles_dir'].'/K'.$domain.'*.key') as $keyfile) { @@ -76,6 +78,7 @@ class cronjob_bind_dnssec extends cronjob { } $app->db->query('UPDATE dns_soa SET dnssec_info=\''.$dnssecdata.'\', dnssec_initialized=\'Y\', dnssec_last_signed=\''.time().'\' WHERE id='.$data['id']); + $data = next($soas); } parent::onRunJob(); -- GitLab