summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemy <relst@relst.nl>2015-04-22 08:41:29 +0200
committerRemy <relst@relst.nl>2015-04-22 08:41:29 +0200
commit89c0e6c38ff88b25d68435c19218b2b3755b756e (patch)
treeca6e5b40da34a5ebf0e2e6ce9c3f92b26beb542f
parentc09417ee3a6c084b7c221ecd4c22ef90f955b979 (diff)
downloadssl-decoder-89c0e6c38ff88b25d68435c19218b2b3755b756e.zip
ssl-decoder-89c0e6c38ff88b25d68435c19218b2b3755b756e.tar.gz
ssl-decoder-89c0e6c38ff88b25d68435c19218b2b3755b756e.tar.bz2
Add warning if cert expires in < 30 days
-rw-r--r--CHANGELOG.md4
-rw-r--r--functions/parse_certificate.php11
-rw-r--r--functions/variables.php2
3 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4b083f8..e01d7ac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## 2.3
+
+- Add warning if certificate expires in < 30 days.
+
## 2.2
- Add SSLv2 test
diff --git a/functions/parse_certificate.php b/functions/parse_certificate.php
index e926e47..576969a 100644
--- a/functions/parse_certificate.php
+++ b/functions/parse_certificate.php
@@ -724,6 +724,17 @@ function cert_parse_json($raw_cert_data, $raw_next_cert_data=null, $host=null, $
$result['warning'][] = "Certificate expired! Expiration date: " . date(DATE_RFC2822,$cert_data['validTo_time_t']);
}
}
+ // almost expired
+ if (!empty($cert_data['validTo_time_t'])) {
+ $certExpiryDate = strtotime(date(DATE_RFC2822,$cert_data['validTo_time_t']));
+ $certExpiryDiff = $certExpiryDate - strtotime($today);
+ if ($certExpiryDiff < 2592000) {
+ $result['cert_expires_in_less_than_thirty_days'] = true;
+ $result['warning'][] = "Certificate expires in " . round($certExpiryDiff / 84600) . " days!. Expiration date: " . date(DATE_RFC2822,$certExpiryDate);
+ } else {
+ $result['cert_expires_in_less_than_thirty_days'] = false;
+ }
+ }
if ( array_search(explode("Policy: ", explode("\n", $cert_data['extensions']['certificatePolicies'])[0])[1], $ev_oids) ) {
$result["validation_type"] = "extended";
diff --git a/functions/variables.php b/functions/variables.php
index 6869f71..53556cd 100644
--- a/functions/variables.php
+++ b/functions/variables.php
@@ -17,7 +17,7 @@
date_default_timezone_set('UTC');
ini_set('default_socket_timeout', 2);
-$version = 2.2;
+$version = 2.3;
$random_blurp = rand(1000,99999);