]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Abort if CRL file can't be stat-ed in ssl_init
authorMax Fillinger <maximilian.fillinger@foxcrypto.com>
Thu, 15 Apr 2021 09:34:54 +0000 (11:34 +0200)
committerGert Doering <gert@greenie.muc.de>
Tue, 20 Apr 2021 11:17:08 +0000 (13:17 +0200)
Now that the path for the CRL file is handled correctly when using
chroot, there's no good reason for the file to be inaccessible during
ssl_init().

This commit ensures that the CRL file is accessed successfully at least
once, which fixes a bug where the mbedtls version of OpenVPN wouldn't
use a reloaded CRL if it initially failed to access the file.

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20210415093454.18324-1-maximilian.fillinger@foxcrypto.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22118.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 940619c88067d95a1c9865795624bc3822a89bd7)

src/openvpn/ssl.c

index cc624926ba065d4ecb4ea0971676457ca8f5e04c..b1b6d221970b426dfd909a670f8b35efb6f527f6 100644 (file)
@@ -558,7 +558,15 @@ tls_ctx_reload_crl(struct tls_root_ctx *ssl_ctx, const char *crl_file,
     }
     else if (platform_stat(crl_file, &crl_stat) < 0)
     {
-        msg(M_WARN, "WARNING: Failed to stat CRL file, not (re)loading CRL.");
+        /* If crl_last_mtime is zero, the CRL file has not been read before. */
+        if (ssl_ctx->crl_last_mtime == 0)
+        {
+            msg(M_FATAL, "ERROR: Failed to stat CRL file during initialization, exiting.");
+        }
+        else
+        {
+            msg(M_WARN, "WARNING: Failed to stat CRL file, not reloading CRL.");
+        }
         return;
     }