| | |
| | | class cronjob_bind_dnssec extends cronjob { |
| | | |
| | | // job schedule |
| | | //protected $_schedule = '30 3 * * *'; //daily at 3:30 a.m. |
| | | protected $_schedule = '* * * * *'; //temp 4 test |
| | | protected $_schedule = '30 3 * * *'; //daily at 3:30 a.m. |
| | | |
| | | private function increase_serial($serial){ |
| | | global $app, $conf; |
| | |
| | | |
| | | //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 `id`,`serial`,`origin` FROM dns_soa WHERE server_id=? AND active=\'Y\' AND dnssec_wanted=\'Y\' AND dnssec_initialized=\'Y\' AND (dnssec_last_signed < ? OR dnssec_last_signed > ?)', intval($conf['server_id']), time()-(3600*24*5)+900, time()+900); //Resign zones every 5 days (expiry is 16 days so we have enough safety, 15 minutes tolerance) |
| | | |
| | | 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; |
| | | if (!file_exists($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain)) continue; |
| | | |
| | | $app->log('DNSSEC Auto-Resign: Touching zone '.$domain, LOGLEVEL_INFO); |
| | | $app->log('DNSSEC Auto-Resign: Touching zone '.$domain, LOGLEVEL_DEBUG); |
| | | $app->db->datalogUpdate('dns_soa', array("serial" => $this->increase_serial($data['serial'])), 'id', $data['id']); |
| | | } |
| | | |