From cab23a684b902e5af00815a06bba7841a62d80a9 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 2 Aug 2024 10:34:30 +0200 Subject: [PATCH] security/acme-client: change interface again for reasons If we call the backend without an interface parameter we will return all of them. To provide parity with single interface check keep the interface key so we need to access it directly as well. --- .../OPNsense/AcmeClient/LeValidation/HttpOpnsense.php | 7 ++++--- .../OPNsense/AcmeClient/LeValidation/TlsalpnAcme.php | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidation/HttpOpnsense.php b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidation/HttpOpnsense.php index d834b1075..12ab4ba56 100644 --- a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidation/HttpOpnsense.php +++ b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidation/HttpOpnsense.php @@ -73,14 +73,15 @@ class HttpOpnsense extends Base implements LeValidationInterface // Add IP address from chosen interface if (!empty((string)$this->config->http_opn_interface)) { $backend = new \OPNsense\Core\Backend(); - $response = json_decode($backend->configdpRun('interface address', [(string)$this->config->http_opn_interface])); + $interface = (string)$this->config->http_opn_interface; + $response = json_decode($backend->configdpRun('interface address', [$interface])); // XXX Returns both IPv4 and IPv6 now. While "[0]" and // "[1]" should remain in this order it would make sense // to ensure "family" matches "inet" or "inet6" and/or // pull both addresses for missing IPv6 support depending // on how this should work. - if (!empty($response[0]->address)) { - $iplist[] = $response[0]->address; + if (!empty($response->$interface[0]->address)) { + $iplist[] = $response->$interface[0]->address; } } diff --git a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidation/TlsalpnAcme.php b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidation/TlsalpnAcme.php index b5d97581b..03a4f9d76 100644 --- a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidation/TlsalpnAcme.php +++ b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeValidation/TlsalpnAcme.php @@ -74,14 +74,15 @@ class TlsalpnAcme extends Base implements LeValidationInterface // Add IP address from chosen interface if (!empty((string)$this->config->tlsalpn_acme_interface)) { $backend = new \OPNsense\Core\Backend(); - $response = json_decode($backend->configdpRun('interface address', [(string)$this->config->tlsalpn_acme_interface])); + $interface = (string)$this->config->tlsalpn_acme_interface; + $response = json_decode($backend->configdpRun('interface address', [$interface])); // XXX Returns both IPv4 and IPv6 now. While "[0]" and // "[1]" should remain in this order it would make sense // to ensure "family" matches "inet" or "inet6" and/or // pull both addresses for missing IPv6 support depending // on how this should work. - if (!empty($response[0]->address)) { - $iplist[] = $response[0]->address; + if (!empty($response->$interface[0]->address)) { + $iplist[] = $response->$interface[0]->address; } }