http/tlsapln libs typos

json_decode backend response before use;
strict type
This commit is contained in:
kulikov-a 2024-02-08 22:04:30 +03:00
parent 2dce81a09f
commit 2689644b73
2 changed files with 8 additions and 8 deletions

View file

@ -50,7 +50,7 @@ class HttpOpnsense extends Base implements LeValidationInterface
$iplist = array();
// Add IP addresses from auto-discovery feature
if ($this->config->http_opn_autodiscovery == 1) {
if ($this->config->http_opn_autodiscovery == '1') {
$dnslist = explode(',', $this->cert_altnames);
$dnslist[] = $this->cert_name;
foreach ($dnslist as $fqdn) {
@ -73,9 +73,9 @@ 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 = $backend->configdpRun('interface address', [(string)$this->config->http_opn_interface]);
if (!empty($response['address'])) {
$iplist[] = $response['address'];
$response = json_decode($backend->configdpRun('interface address', [(string)$this->config->http_opn_interface]));
if (!empty($response->address)) {
$iplist[] = $response->address;
}
}

View file

@ -51,7 +51,7 @@ class TlsalpnAcme extends Base implements LeValidationInterface
$iplist = array();
// Add IP addresses from auto-discovery feature
if ($this->config->tlsalpn_acme_autodiscovery == 1) {
if ($this->config->tlsalpn_acme_autodiscovery == '1') {
$dnslist = explode(',', $this->cert_altnames);
$dnslist[] = $this->cert_name;
foreach ($dnslist as $fqdn) {
@ -74,9 +74,9 @@ 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 = $backend->configdpRun('interface address', [(string)$this->config->tlsalpn_acme_interface]);
if (!empty($response['address'])) {
$iplist[] = $response['address'];
$response = json_decode($backend->configdpRun('interface address', [(string)$this->config->tlsalpn_acme_interface]));
if (!empty($response->address)) {
$iplist[] = $response->address;
}
}