From c823778cee18bfe8705863cf9ef1ae216465cd55 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Thu, 11 Nov 2021 10:11:34 +0100 Subject: [PATCH] Mark certificates that will expire in the next 7 days as "EXPIRING" --- lib/GUI.pm | 2 +- lib/GUI/X509_browser.pm | 8 +++++++- lib/OpenSSL.pm | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/GUI.pm b/lib/GUI.pm index 1273bd6..73d72e7 100644 --- a/lib/GUI.pm +++ b/lib/GUI.pm @@ -2814,7 +2814,7 @@ sub about { $aboutdialog->set_program_name("TinyCA2"); $aboutdialog->set_version($main->{'version'}); $aboutdialog->set_comments("using OpenSSL version " . $main->{'OpenSSL'}->get_version()); - $aboutdialog->set_copyright("2002-2006 Stephan Martin\n 2020 Thomas Hooge"); + $aboutdialog->set_copyright("2002-2006 Stephan Martin\n 2020-2021 Thomas Hooge"); $aboutdialog->set_license("GNU Public License (GPL)"); $aboutdialog->set_website("https://www.hoogi.de/tinyca/"); $aboutdialog->set_authors( diff --git a/lib/GUI/X509_browser.pm b/lib/GUI/X509_browser.pm index c538a1c..f5a2807 100644 --- a/lib/GUI/X509_browser.pm +++ b/lib/GUI/X509_browser.pm @@ -273,7 +273,13 @@ sub add_list { $column->set_cell_data_func ($renderer, sub { my ($column, $cell, $model, $iter) = @_; $text = $model->get($iter, 7); - $color = $text eq _("VALID")?'green':'red'; + if ($text eq _("VALID")) { + $color = 'green'; + } elsif ($text eq _("EXPIRING")) { + $color = 'orange'; + } else { + $color = 'red'; + } $cell->set (text => $text, foreground => $color); }); } diff --git a/lib/OpenSSL.pm b/lib/OpenSSL.pm index 1542ed3..336f589 100644 --- a/lib/OpenSSL.pm +++ b/lib/OpenSSL.pm @@ -775,6 +775,9 @@ sub parsecert { if($crl->{'ISSUER'} eq $tmp->{'ISSUER'}) { _set_expired($tmp->{'SERIAL'}, $indexfile); } + } elsif ($tmp->{'EXPDATE'} - $time < 608400) { + # cert expires in less than 7 days + $tmp->{'STATUS'} = _("EXPIRING"); } if (defined($tmp->{'SERIAL'})) {