system: step 1: expose DNS ports to service data as discussed

This commit is contained in:
Franco Fichtner 2023-03-24 10:46:26 +01:00
parent e4cfc252cd
commit 69b7f9d532
2 changed files with 25 additions and 19 deletions

View File

@ -47,6 +47,8 @@ function dnsmasq_configure()
function dnsmasq_services()
{
global $config;
$services = [];
if (!dnsmasq_enabled()) {
@ -55,6 +57,7 @@ function dnsmasq_services()
$pconfig = [];
$pconfig['name'] = 'dnsmasq';
$pconfig['ports'] = [$config['dnsmasq']['port'] ?? '53'];
$pconfig['description'] = gettext('Dnsmasq DNS');
$pconfig['php']['restart'] = ['dnsmasq_configure_do'];
$pconfig['php']['start'] = ['dnsmasq_configure_do'];

View File

@ -38,31 +38,34 @@ function unbound_enabled()
function unbound_configure()
{
return array(
'bootup' => array('unbound_configure_do'),
'dns' => array('unbound_configure_do'),
'early' => array('unbound_cache_flush'),
'local' => array('unbound_configure_do'),
'newwanip' => array('unbound_configure_do:2'),
'unbound_start' => array('unbound_configure_do'),
'unbound_stop' => array('unbound_service_stop'),
);
return [
'bootup' => ['unbound_configure_do'],
'dns' => ['unbound_configure_do'],
'early' => ['unbound_cache_flush'],
'local' => ['unbound_configure_do'],
'newwanip' => ['unbound_configure_do:2'],
'unbound_start' => ['unbound_configure_do'],
'unbound_stop' => ['unbound_service_stop'],
];
}
function unbound_services()
{
$services = array();
$services = [];
if (!unbound_enabled()) {
return $services;
}
$pconfig = array();
$mdl = new \OPNsense\Unbound\Unbound();
$pconfig = [];
$pconfig['name'] = 'unbound';
$pconfig['ports'] = [(string)$mdl->general->port];
$pconfig['description'] = gettext('Unbound DNS');
$pconfig['php']['restart'] = array('unbound_configure_do');
$pconfig['php']['start'] = array('unbound_configure_do');
$pconfig['php']['stop'] = array('unbound_service_stop');
$pconfig['php']['restart'] = ['unbound_configure_do'];
$pconfig['php']['start'] = ['unbound_configure_do'];
$pconfig['php']['stop'] = ['unbound_service_stop'];
$pconfig['pidfile'] = '/var/run/unbound.pid';
$services[] = $pconfig;
@ -71,14 +74,14 @@ function unbound_services()
function unbound_xmlrpc_sync()
{
$result = array();
$result = [];
$result[] = array(
'description' => gettext('Unbound DNS'),
$result[] = [
'section' => 'unbound,OPNsense.unboundplus',
'description' => gettext('Unbound DNS'),
'services' => ['unbound'],
'id' => 'dnsresolver',
'services' => ["unbound"],
);
];
return $result;
}