From e96cb2b6b94418e175e96b44d9131f985d25ed6d Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Tue, 10 Sep 2019 22:17:20 +0200 Subject: [PATCH] security/acme-client: check if BIND plugin is installed, refs #1491 --- .../AcmeClient/Api/SettingsController.php | 18 ++++++++++++++++++ .../AcmeClient/forms/dialogValidation.xml | 15 ++++++++++----- .../models/OPNsense/AcmeClient/AcmeClient.xml | 2 +- .../views/OPNsense/AcmeClient/validations.volt | 6 ++++++ .../scripts/OPNsense/AcmeClient/certhelper.php | 5 +++++ 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/Api/SettingsController.php b/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/Api/SettingsController.php index f78611844..307c98229 100644 --- a/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/Api/SettingsController.php +++ b/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/Api/SettingsController.php @@ -390,4 +390,22 @@ class SettingsController extends ApiMutableModelControllerBase return $result; } + + /** + * Check wether the BIND plugin is installed. + * @return array status action + */ + public function getBindPluginStatusAction() + { + $result = array("result" => "0"); + + $mdlAcme = $this->getModel(); + + // Check if the required plugin is installed + if ((string)$mdlAcme->isPluginInstalled('bind') == "1") { + $result['result'] = "1"; + } + + return $result; + } } diff --git a/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/forms/dialogValidation.xml b/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/forms/dialogValidation.xml index 727abe3a9..27a097063 100644 --- a/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/forms/dialogValidation.xml +++ b/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/forms/dialogValidation.xml @@ -717,10 +717,6 @@ header - - - info - validation.dns_opnsense_host @@ -730,7 +726,7 @@ validation.dns_opnsense_port text - + validation.dns_opnsense_key @@ -747,6 +743,15 @@ checkbox Uncheck this box if you have a valid certificate for your OPNsense interface. + + + header + + + + + info + header diff --git a/security/acme-client/src/opnsense/mvc/app/models/OPNsense/AcmeClient/AcmeClient.xml b/security/acme-client/src/opnsense/mvc/app/models/OPNsense/AcmeClient/AcmeClient.xml index f03201ef4..5733ea91d 100644 --- a/security/acme-client/src/opnsense/mvc/app/models/OPNsense/AcmeClient/AcmeClient.xml +++ b/security/acme-client/src/opnsense/mvc/app/models/OPNsense/AcmeClient/AcmeClient.xml @@ -381,7 +381,7 @@ netcup DNS API NS1.com API nsupdate (RFC 2136) - OPNsense Bind Plugin + OPNsense BIND Plugin OVH, kimsufi, soyoustart and runabove API PowerDNS.com API selectel.com / selectel.ru domain API diff --git a/security/acme-client/src/opnsense/mvc/app/views/OPNsense/AcmeClient/validations.volt b/security/acme-client/src/opnsense/mvc/app/views/OPNsense/AcmeClient/validations.volt index fe51b231e..cb94acec0 100644 --- a/security/acme-client/src/opnsense/mvc/app/views/OPNsense/AcmeClient/validations.volt +++ b/security/acme-client/src/opnsense/mvc/app/views/OPNsense/AcmeClient/validations.volt @@ -62,6 +62,12 @@ POSSIBILITY OF SUCH DAMAGE. $(".gcloud_plugin_warning").hide(); } }); + // Show a warning if the BIND plugin is missing. + ajaxCall(url="/api/acmeclient/settings/getBindPluginStatus", sendData={}, callback=function(data,status) { + if (data['result'] != 0) { + $(".bind_plugin_warning").hide(); + } + }); }); $("#validation\\.http_service").change(function(){ var service_id = 'table_http_' + $(this).val(); diff --git a/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php b/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php index dfba36492..1ae9639ae 100755 --- a/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php +++ b/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php @@ -829,6 +829,11 @@ function run_acme_validation($certObj, $valObj, $acctObj) $proc_env['NSUPDATE_SERVER'] = (string)$valObj->dns_nsupdate_server; break; case 'dns_opnsense': + # BIND plugin must be installed. + if ((string)$modelObj->isPluginInstalled('bind') != "1") { + log_error("AcmeClient: BIND plugin is NOT installed. Please install os-bind."); + return(1); + } $proc_env['OPNs_Host'] = (string)$valObj->dns_opnsense_host; $proc_env['OPNs_Port'] = (string)$valObj->dns_opnsense_port; $proc_env['OPNs_Key'] = (string)$valObj->dns_opnsense_key;