Skip to content

Commit

Permalink
unbound: log a warning if an overlapping PTR exists
Browse files Browse the repository at this point in the history
  • Loading branch information
swhite2 committed Aug 3, 2022
1 parent 5539913 commit 4d2350a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/etc/inc/plugins.inc.d/unbound.inc
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ function unbound_add_host_entries($ifconfig_details = null)
$local_zone_type = 'transparent';
$ptr_records = [];

openlog("unbound", LOG_DAEMON, LOG_LOCAL4);

if (!empty($config['unbound']['local_zone_type'])) {
$local_zone_type = $config['unbound']['local_zone_type'];
}
Expand Down Expand Up @@ -575,6 +577,8 @@ function unbound_add_host_entries($ifconfig_details = null)
*/
$unbound_entries .= "local-data-ptr: \"{$host->server} {$alias['hostname']}{$alias['domain']}\"\n";
$ptr_records[] = $host->server;
} else {
syslog(LOG_WARNING, 'PTR record already exists for ' . $alias['hostname'] . $alias['domain'] . '(' . $host->server . ')');
}
$unbound_entries .= "local-data: \"{$alias['hostname']}{$alias['domain']} IN {$host->rr} {$host->server}\"\n";
}
Expand Down Expand Up @@ -614,6 +618,8 @@ function unbound_add_host_entries($ifconfig_details = null)
}

file_put_contents('/var/unbound/host_entries.conf', $unbound_entries);

closelog();
}

function unbound_acls_subnets()
Expand Down

0 comments on commit 4d2350a

Please sign in to comment.