mirror of
https://github.com/itflow-org/itflow
synced 2026-03-05 21:34:51 +00:00
remove get Cert Expiry date from cron job as its in functions now
This commit is contained in:
@@ -23,46 +23,6 @@ if ( $argv[1] !== $config_cron_key ) {
|
|||||||
exit("Cron Key invalid -- Quitting..");
|
exit("Cron Key invalid -- Quitting..");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Certificate Expiry Date for a domain Function
|
|
||||||
function getCertificateExpiryDate($domain, $port = 443, $timeout = 10) {
|
|
||||||
$context = stream_context_create([
|
|
||||||
'ssl' => [
|
|
||||||
'capture_peer_cert' => true,
|
|
||||||
'verify_peer' => false, // We're only capturing the cert details; not verifying if it's valid
|
|
||||||
'verify_peer_name' => false,
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$client = @stream_socket_client(
|
|
||||||
"ssl://{$domain}:{$port}",
|
|
||||||
$errno,
|
|
||||||
$errstr,
|
|
||||||
$timeout,
|
|
||||||
STREAM_CLIENT_CONNECT,
|
|
||||||
$context
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$client) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$contextParams = stream_context_get_params($client);
|
|
||||||
|
|
||||||
if (!isset($contextParams['options']['ssl']['peer_certificate'])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cert = $contextParams['options']['ssl']['peer_certificate'];
|
|
||||||
$certInfo = openssl_x509_parse($cert);
|
|
||||||
|
|
||||||
if (!isset($certInfo['validTo_time_t'])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the expiration date in a human-readable format, e.g., "2023-09-20"
|
|
||||||
return date('Y-m-d', $certInfo['validTo_time_t']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ###############################################################################################################
|
* ###############################################################################################################
|
||||||
* UPDATE CERTIFICATE EXPIRY DATE
|
* UPDATE CERTIFICATE EXPIRY DATE
|
||||||
|
|||||||
Reference in New Issue
Block a user