sslinfo/index.php

19 lines
614 B
PHP
Raw Permalink Normal View History

2016-03-04 21:02:10 +00:00
<?php
require("settings.php");
foreach ($sites as $s) {
2016-03-04 21:32:11 +00:00
$g = stream_context_create (array("ssl" => array("capture_peer_cert" => true)));
2016-03-04 21:02:10 +00:00
$r = stream_socket_client("ssl://" . $s . ":443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $g);
$p = stream_context_get_params($r);
$c = openssl_x509_parse($p["options"]["ssl"]["peer_certificate"]);
2016-03-04 21:32:11 +00:00
2016-03-04 21:02:10 +00:00
$out = $s . " - " . date("Y-m-d H:i:s",$c["validTo_time_t"]);
if ($c["validTo_time_t"] < strtotime("+1 week")) {
2016-03-04 21:32:11 +00:00
print("<font color=\"red\"><b>" . $out . "</b></font><br>");
2016-03-04 21:07:10 +00:00
} else if (isset($_GET["debug"])) {
2016-03-04 21:32:11 +00:00
print($out . "<br>");
};
2016-03-04 21:02:10 +00:00
};
2016-03-04 21:32:11 +00:00