diff --git a/pfsense_zbx.php b/pfsense_zbx.php index 8a365b1..5975f50 100644 --- a/pfsense_zbx.php +++ b/pfsense_zbx.php @@ -1116,7 +1116,7 @@ function pfz_get_cert_date($valuekey){ global $config; // Contains a list of refs that were revoked and should not be considered - $revoked_cert_refs; + $revoked_cert_refs = []; foreach ($config["crl"] as $crl) { foreach ($crl["cert"] as $revoked_cert) { $revoked_cert_refs[] = $revoked_cert["refid"]; @@ -1129,7 +1129,7 @@ function pfz_get_cert_date($valuekey){ case "validFrom.max": foreach ($config[$cert_type] as $cert) { if ( ! in_array($cert['refid'], $revoked_cert_refs) ) { - $certinfo = openssl_x509_parse(base64_decode($cert[crt])); + $certinfo = openssl_x509_parse(base64_decode($cert["crt"])); if ($value == 0 or $value < $certinfo['validFrom_time_t']) $value = $certinfo['validFrom_time_t']; } } @@ -1137,7 +1137,7 @@ function pfz_get_cert_date($valuekey){ case "validTo.min": foreach ($config[$cert_type] as $cert) { if ( ! in_array($cert['refid'], $revoked_cert_refs) ) { - $certinfo = openssl_x509_parse(base64_decode($cert[crt])); + $certinfo = openssl_x509_parse(base64_decode($cert["crt"])); if ($value == 0 or $value > $certinfo['validTo_time_t']) $value = $certinfo['validTo_time_t']; } } diff --git a/pfsense_zbx_rc.php b/pfsense_zbx_rc.php index bd82c12..74dda34 100644 --- a/pfsense_zbx_rc.php +++ b/pfsense_zbx_rc.php @@ -135,8 +135,6 @@ const CARP_RES = [ // Abstract undefined symbols and globals from code class PfEnv { - public const CRT = crt; - public static function cfg() { global $config; @@ -1063,7 +1061,7 @@ class Command $all_certs = Util::array_flatten($certs_and_cas); return Util::result(array_reduce($all_certs, function ($value, $certificate) use ($field) { - $cert_info = openssl_x509_parse(base64_decode($certificate[PfEnv::CRT])); + $cert_info = openssl_x509_parse(base64_decode($certificate["crt"])); if ($value == 0 || $value < $cert_info[$field]) { return $cert_info[$field];