quassel/quassel_0.12.5_CVE-2021-348...

21 lines
1009 B
Diff

diff -ruN a/src/core/sslserver.cpp b/src/core/sslserver.cpp
--- a/src/core/sslserver.cpp 2018-04-23 21:44:48.000000000 +0000
+++ b/src/core/sslserver.cpp 2021-06-22 04:27:39.596212479 +0000
@@ -52,6 +52,16 @@
// Initialize the certificates for first-time usage
if (!loadCerts()) {
+ // If the core is unable to load a certificate, and "--require-ssl" is specified,
+ // do not proceed, throw an exception and quit. This prevents the core from falling
+ // back to a plaintext-only core when they should be expecting SSL/TLS only.
+ if (Quassel::isOptionSet("require-ssl")) {
+ quWarning()
+ << "--require-ssl is set, but no SSL certificate is available. "
+ << "Exiting.\nPlease see https://quassel-irc.org/faq/cert to learn"
+ << "how to enable SSL support.";
+ exit(EXIT_FAILURE);
+ }
if (!sslWarningShown) {
quWarning()
<< "SslServer: Unable to set certificate file\n"