]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
OpenVPN: Show indication when OpenVPN certificates expire
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 22 Feb 2023 12:25:33 +0000 (12:25 +0000)
committerPeter Müller <peter.mueller@ipfire.org>
Sun, 5 Mar 2023 14:50:33 +0000 (14:50 +0000)
This will help with #11742 - OpenVPN: No method to replace expired
certificates.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Acked-by: Peter Müller <peter.mueller@ipfire.org>
12 files changed:
doc/language_issues.en
doc/language_issues.es
doc/language_issues.fr
doc/language_issues.it
doc/language_issues.nl
doc/language_issues.pl
doc/language_issues.ru
doc/language_issues.tr
doc/language_missings
html/cgi-bin/ovpnmain.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl

index 08fda35b7c33fbd893a2c19beb5ec3ff192a84c3..131278a2042132b91b25d6ee25e8db38359e61c2 100644 (file)
@@ -1413,6 +1413,8 @@ WARNING: untranslated string: only digits allowed in max retries field = Only di
 WARNING: untranslated string: only digits allowed in the idle timeout = Only digits allowed in the idle timeout.
 WARNING: untranslated string: open connections = Open Connections
 WARNING: untranslated string: openssl produced an error = OpenSSL produced an error
+WARNING: untranslated string: openvpn cert expires soon = Expires Soon
+WARNING: untranslated string: openvpn cert has expired = Expired
 WARNING: untranslated string: openvpn client = OpenVPN client
 WARNING: untranslated string: openvpn default = Default
 WARNING: untranslated string: openvpn destination port used = The destination port is already used by another OpenVPN server.
index ffe423bd1d6a118d89aa9c2520829be62d4f7b15..501f607647e1860ac5989137d60fe91fbf742b3f 100644 (file)
@@ -982,6 +982,8 @@ WARNING: untranslated string: hardware vulnerabilities = Hardware Vulnerabilitie
 WARNING: untranslated string: info messages = unknown string
 WARNING: untranslated string: invalid ip or hostname = Invalid IP Address or Hostname
 WARNING: untranslated string: no data = unknown string
+WARNING: untranslated string: openvpn cert expires soon = Expires Soon
+WARNING: untranslated string: openvpn cert has expired = Expired
 WARNING: untranslated string: pakfire ago = ago.
 WARNING: untranslated string: route config changed = unknown string
 WARNING: untranslated string: routing config added = unknown string
index cb06f0ab3908f75fb84e6ef0f0cc6955c82a7dfe..bbf686b74e9a7a9c97fc3e30f656a384b3aa26a3 100644 (file)
@@ -946,6 +946,8 @@ WARNING: untranslated string: guardian logtarget_file = unknown string
 WARNING: untranslated string: guardian logtarget_syslog = unknown string
 WARNING: untranslated string: guardian no entries = unknown string
 WARNING: untranslated string: guardian service = unknown string
+WARNING: untranslated string: openvpn cert expires soon = Expires Soon
+WARNING: untranslated string: openvpn cert has expired = Expired
 WARNING: untranslated string: pakfire ago = ago.
 WARNING: untranslated string: route config changed = unknown string
 WARNING: untranslated string: routing config added = unknown string
index dd794f57aa5c8784e5dda4ff21c1416680b173df..f9fa74de1117ae3265807fd25d3a976df991dcf5 100644 (file)
@@ -1174,6 +1174,8 @@ WARNING: untranslated string: one month = One Month
 WARNING: untranslated string: one week = One Week
 WARNING: untranslated string: one year = One Year
 WARNING: untranslated string: open connections = Open Connections
+WARNING: untranslated string: openvpn cert expires soon = Expires Soon
+WARNING: untranslated string: openvpn cert has expired = Expired
 WARNING: untranslated string: optional = Optional
 WARNING: untranslated string: otp qrcode = OTP QRCode
 WARNING: untranslated string: outgoing compression in bytes per second = Outgoing compression
index 4f100abd2578da7608cbd3f34e8531febaab5c79..d406e72994fb0df1a486fce2784eeb59052cfdd1 100644 (file)
@@ -1197,6 +1197,8 @@ WARNING: untranslated string: one month = One Month
 WARNING: untranslated string: one week = One Week
 WARNING: untranslated string: one year = One Year
 WARNING: untranslated string: open connections = Open Connections
+WARNING: untranslated string: openvpn cert expires soon = Expires Soon
+WARNING: untranslated string: openvpn cert has expired = Expired
 WARNING: untranslated string: optional = Optional
 WARNING: untranslated string: otp qrcode = OTP QRCode
 WARNING: untranslated string: outgoing compression in bytes per second = Outgoing compression
index e91e62c5b34b951d270bf61d8540dfff27b3e298..54aba0c6613dd47899ecfbad40ef9094e8643256 100644 (file)
@@ -1355,6 +1355,8 @@ WARNING: untranslated string: one month = One Month
 WARNING: untranslated string: one week = One Week
 WARNING: untranslated string: one year = One Year
 WARNING: untranslated string: open connections = Open Connections
+WARNING: untranslated string: openvpn cert expires soon = Expires Soon
+WARNING: untranslated string: openvpn cert has expired = Expired
 WARNING: untranslated string: openvpn default = Default
 WARNING: untranslated string: openvpn destination port used = The destination port is already used by another OpenVPN server.
 WARNING: untranslated string: openvpn fragment allowed with udp = Using fragment is only allowed when using the UDP protocol.
index 7dd1a63d7b4302bffd3f334739320529ca6de41a..05ee8461e945c04ec3db94a8ee2399490b7424e6 100644 (file)
@@ -1353,6 +1353,8 @@ WARNING: untranslated string: one month = One Month
 WARNING: untranslated string: one week = One Week
 WARNING: untranslated string: one year = One Year
 WARNING: untranslated string: open connections = Open Connections
+WARNING: untranslated string: openvpn cert expires soon = Expires Soon
+WARNING: untranslated string: openvpn cert has expired = Expired
 WARNING: untranslated string: openvpn default = Default
 WARNING: untranslated string: openvpn destination port used = The destination port is already used by another OpenVPN server.
 WARNING: untranslated string: openvpn fragment allowed with udp = Using fragment is only allowed when using the UDP protocol.
index 3443b1f1a0adae3ba9e1703f38d49a6f8d49cdd3..6871ea35aa59a81b088b61046c64b0fd2b878319 100644 (file)
@@ -1091,6 +1091,8 @@ WARNING: untranslated string: no entries = No entries at the moment.
 WARNING: untranslated string: not affected = Not Affected
 WARNING: untranslated string: not validating = Not validating
 WARNING: untranslated string: open connections = Open Connections
+WARNING: untranslated string: openvpn cert expires soon = Expires Soon
+WARNING: untranslated string: openvpn cert has expired = Expired
 WARNING: untranslated string: optional = Optional
 WARNING: untranslated string: otp qrcode = OTP QRCode
 WARNING: untranslated string: ovpn connection name = Connection Name
index 78b9e8a2d5ed626a3899b46e9da6769ab7ffd8d0..956303c927df5f932e29f7714c82f689929d2bc0 100644 (file)
 < dns servers
 < hardware vulnerabilities
 < invalid ip or hostname
+< openvpn cert expires soon
+< openvpn cert has expired
 < service boot setting unavailable
 < transport mode does not support vti
 < wlanap
 < dhcp fixed ip address in dynamic range
 < g.dtm
 < g.lite
+< guaranteed bandwidth
+< retbleed
+< service boot setting unavailable
+< show dh
+< openvpn cert expires soon
+< openvpn cert has expired
 < upload fcdsl.o
 ############################################################################
 # Checking cgi-bin translations for language: it                           #
 < one week
 < one year
 < open connections
+< openvpn cert expires soon
+< openvpn cert has expired
 < optional
 < otp qrcode
 < outgoing compression in bytes per second
 < one week
 < one year
 < open connections
+< openvpn cert expires soon
+< openvpn cert has expired
 < optional
 < otp qrcode
 < outgoing compression in bytes per second
 < one week
 < one year
 < open connections
+< openvpn cert expires soon
+< openvpn cert has expired
 < openvpn default
 < openvpn destination port used
 < openvpn disabled
 < one week
 < one year
 < open connections
+< openvpn cert expires soon
+< openvpn cert has expired
 < openvpn default
 < openvpn destination port used
 < openvpn disabled
 < not validating
 < okay
 < open connections
+< openvpn cert expires soon
+< openvpn cert has expired
 < optional
 < otp qrcode
 < ovpn connection name
index 42a7354fc9368efc249c24613dab2286b96de46a..87bda4f1efda44c926f04bc8393283e23637a6af 100644 (file)
@@ -33,6 +33,7 @@ use File::Temp qw/ tempfile tempdir /;
 use strict;
 use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
 use Sort::Naturally;
+use Date::Parse;
 require '/var/ipfire/general-functions.pl';
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
@@ -5352,31 +5353,45 @@ END
 END
                }
        if ($confighash{$key}[0] eq 'on') { $gif = 'on.gif'; } else { $gif = 'off.gif'; }
-       if ($id % 2) {
-               print "<tr>";
-               $col="bgcolor='$color{'color20'}'";
-       } else {
-               print "<tr>";
-               $col="bgcolor='$color{'color22'}'";
-       }
-       print "<td align='center' nowrap='nowrap' $col>$confighash{$key}[1]</td>";
-       print "<td align='center' nowrap='nowrap' $col>" . $Lang::tr{"$confighash{$key}[3]"} . " (" . $Lang::tr{"$confighash{$key}[4]"} . ")</td>";
-       #if ($confighash{$key}[4] eq 'cert') {
-           #print "<td align='left' nowrap='nowrap'>$confighash{$key}[2]</td>";
-       #} else {
-           #print "<td align='left'>&nbsp;</td>";
-       #}
-       my @cavalid = &General::system_output("/usr/bin/openssl", "x509", "-text", "-in", "${General::swroot}/ovpn/certs/$confighash{$key}[1]cert.pem");
-       my $cavalid;
 
+       # Fetch information about the certificate
+       my @cavalid = &General::system_output("/usr/bin/openssl", "x509", "-text",
+               "-in", "${General::swroot}/ovpn/certs/$confighash{$key}[1]cert.pem");
+
+       my $expiryDate = 0;
+
+       # Parse the certificate information
        foreach my $line (@cavalid) {
                if ($line =~ /Not After : (.*)[\n]/) {
-                       $cavalid    = $1;
-
+                       $expiryDate = &Date::Parse::str2time($1);
                        last;
                }
        }
 
+       # Calculate the remaining time
+       my $remainingTime = $expiryDate - time();
+
+       # Create some simple booleans to check the status
+       my $hasExpired = ($remainingTime <= 0);
+       my $expiresSoon = ($remainingTime <= 30 * 24 * 3600);
+
+       print "<tr>";
+
+       if ($hasExpired || $expiresSoon) {
+               $col="bgcolor='$color{'color14'}'";
+       } elsif ($id % 2) {
+               $col="bgcolor='$color{'color20'}'";
+       } else {
+               $col="bgcolor='$color{'color22'}'";
+       }
+       print "<td align='center' nowrap='nowrap' $col>$confighash{$key}[1]";
+       if ($hasExpired) {
+               print " ($Lang::tr{'openvpn cert has expired'})";
+       } elsif ($expiresSoon) {
+               print " ($Lang::tr{'openvpn cert expires soon'})";
+       }
+       print "</td>";
+       print "<td align='center' nowrap='nowrap' $col>" . $Lang::tr{"$confighash{$key}[3]"} . " (" . $Lang::tr{"$confighash{$key}[4]"} . ")</td>";
        print "<td align='center' $col>$confighash{$key}[25]</td>";
        $col1="bgcolor='${Header::colourred}'";
        my $active = "<b><font color='#FFFFFF'>$Lang::tr{'capsclosed'}</font></b>";
index 5fbab2ff8a71b70624e8d1f04c74ffe4017f49ce..a57b62ad8f0dd893500cca5310dfdbf959664a6c 100644 (file)
 'open connections' => 'Offene Verbindungen',
 'open to all' => 'Überschreibe externen Zugang zu ALL',
 'openssl produced an error' => 'OpenSSL hat einen Fehler verursacht',
+'openvpn cert expires soon' => 'Läuft bald ab',
+'openvpn cert has expired' => 'Abgelaufen',
 'openvpn client' => 'OpenVPN-Client',
 'openvpn default' => 'Vorgabe',
 'openvpn destination port used' => 'Der Zielport wird bereits von einer anderen OpenVPN-Server-Instanz genutzt.',
index 5a72f53b8c8b37fa6f36d53160dcf5f8af4c9dcd..cc7704e9dcf1c06dbbaccbb174743c197d2195a7 100644 (file)
 'open connections' => 'Open Connections',
 'open to all' => 'Override external access to ALL',
 'openssl produced an error' => 'OpenSSL produced an error',
+'openvpn cert expires soon' => 'Expires Soon',
+'openvpn cert has expired' => 'Expired',
 'openvpn client' => 'OpenVPN client',
 'openvpn default' => 'Default',
 'openvpn destination port used' => 'The destination port is already used by another OpenVPN server.',