From de6d4dbd1e8845e08c2d87cd89a919e5b21ba619 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 21 Jun 2021 16:47:06 -0400 Subject: Fix various spelling issues (#1883). Signed-off-by: Josh Soref --- src/modules/extra/m_mysql.cpp | 6 +++--- src/modules/extra/m_pgsql.cpp | 2 +- src/modules/extra/m_ssl_gnutls.cpp | 2 +- src/modules/extra/m_ssl_mbedtls.cpp | 2 +- src/modules/extra/m_ssl_openssl.cpp | 22 +++++++++++----------- 5 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 64a460f77..b34cd0324 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -63,9 +63,9 @@ /* THE NONBLOCKING MYSQL API! * - * MySQL provides no nonblocking (asyncronous) API of its own, and its developers recommend + * MySQL provides no nonblocking (asynchronous) API of its own, and its developers recommend * that instead, you should thread your program. This is what i've done here to allow for - * asyncronous SQL requests via mysql. The way this works is as follows: + * asynchronous SQL requests via mysql. The way this works is as follows: * * The module spawns a thread via class Thread, and performs its mysql queries in this thread, * using a queue with priorities. There is a mutex on either end which prevents two threads @@ -88,7 +88,7 @@ * threadsafe. This module is designed to be threadsafe and is careful with its use of threads, * however, if we were to call a module's OnRequest even from within a thread which was not the * one the module was originally instantiated upon, there is a chance of all hell breaking loose - * if a module is ever put in a re-enterant state (stack corruption could occur, crashes, data + * if a module is ever put in a reentrant state (stack corruption could occur, crashes, data * corruption, and worse, so DONT think about it until the day comes when InspIRCd is 100% * guaranteed threadsafe!) */ diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index e1db996c8..65ae621f9 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -93,7 +93,7 @@ struct QueueItem /** PgSQLresult is a subclass of the mostly-pure-virtual class SQLresult. * All SQL providers must create their own subclass and define it's methods using that - * database library's data retriveal functions. The aim is to avoid a slow and inefficient process + * database library's data retrieval functions. The aim is to avoid a slow and inefficient process * of converting all data to a common format before it reaches the result structure. This way * data is passes to the module nearly as directly as if it was using the API directly itself. */ diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 670ff79b1..86c2c43b7 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -779,7 +779,7 @@ class GnuTLSIOHook : public SSLIOHook } else { - // Change the seesion state + // Change the session state this->status = ISSL_HANDSHAKEN; VerifyCertificate(); diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index c3d040ad0..a33ea367e 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -546,7 +546,7 @@ class mbedTLSIOHook : public SSLIOHook int ret = mbedtls_ssl_handshake(&sess); if (ret == 0) { - // Change the seesion state + // Change the session state this->status = ISSL_HANDSHAKEN; VerifyCertificate(); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index f84468da8..cd96022c8 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -336,7 +336,7 @@ namespace OpenSSL /** OpenSSL makes us have two contexts, one for servers and one for clients */ Context ctx; - Context clictx; + Context clientctx; /** Digest to use when generating fingerprints */ @@ -406,11 +406,11 @@ namespace OpenSSL : name(profilename) , dh(ServerInstance->Config->Paths.PrependConfig(tag->getString("dhfile", "dhparams.pem", 1))) , ctx(SSL_CTX_new(SSLv23_server_method())) - , clictx(SSL_CTX_new(SSLv23_client_method())) + , clientctx(SSL_CTX_new(SSLv23_client_method())) , allowrenego(tag->getBool("renegotiation")) // Disallow by default , outrecsize(tag->getUInt("outrecsize", 2048, 512, 16384)) { - if ((!ctx.SetDH(dh)) || (!clictx.SetDH(dh))) + if ((!ctx.SetDH(dh)) || (!clientctx.SetDH(dh))) throw Exception("Couldn't set DH parameters"); const std::string hash = tag->getString("hash", "md5", 1); @@ -421,7 +421,7 @@ namespace OpenSSL const std::string ciphers = tag->getString("ciphers"); if (!ciphers.empty()) { - if ((!ctx.SetCiphers(ciphers)) || (!clictx.SetCiphers(ciphers))) + if ((!ctx.SetCiphers(ciphers)) || (!clientctx.SetCiphers(ciphers))) { ERR_print_errors_cb(error_callback, this); throw Exception("Can't set cipher list to \"" + ciphers + "\" " + lasterr); @@ -432,7 +432,7 @@ namespace OpenSSL if (!ciphers.empty()) { #if OPENSSL_VERSION_NUMBER >= 0x10101000L - if ((!ctx.SetCiphersuites(ciphersuites)) || (!clictx.SetCiphersuites(ciphersuites))) + if ((!ctx.SetCiphersuites(ciphersuites)) || (!clientctx.SetCiphersuites(ciphersuites))) { ERR_print_errors_cb(error_callback, this); throw Exception("Can't set ciphersuite list to \"" + ciphersuites + "\" " + lasterr); @@ -449,20 +449,20 @@ namespace OpenSSL #endif SetContextOptions("server", tag, ctx); - SetContextOptions("client", tag, clictx); + SetContextOptions("client", tag, clientctx); /* Load our keys and certificates * NOTE: OpenSSL's error logging API sucks, don't blame us for this clusterfuck. */ std::string filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("certfile", "cert.pem", 1)); - if ((!ctx.SetCerts(filename)) || (!clictx.SetCerts(filename))) + if ((!ctx.SetCerts(filename)) || (!clientctx.SetCerts(filename))) { ERR_print_errors_cb(error_callback, this); throw Exception("Can't read certificate file: " + lasterr); } filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("keyfile", "key.pem", 1)); - if ((!ctx.SetPrivateKey(filename)) || (!clictx.SetPrivateKey(filename))) + if ((!ctx.SetPrivateKey(filename)) || (!clientctx.SetPrivateKey(filename))) { ERR_print_errors_cb(error_callback, this); throw Exception("Can't read key file: " + lasterr); @@ -470,7 +470,7 @@ namespace OpenSSL // Load the CAs we trust filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("cafile", "ca.pem", 1)); - if ((!ctx.SetCA(filename)) || (!clictx.SetCA(filename))) + if ((!ctx.SetCA(filename)) || (!clientctx.SetCA(filename))) { ERR_print_errors_cb(error_callback, this); ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Can't read CA list from %s. This is only a problem if you want to verify client certificates, otherwise it's safe to ignore this message. Error: %s", filename.c_str(), lasterr.c_str()); @@ -482,14 +482,14 @@ namespace OpenSSL const std::string crlmode = tag->getString("crlmode", "chain", 1); ctx.SetCRL(crlfile, crlpath, crlmode); - clictx.SetVerifyCert(); + clientctx.SetVerifyCert(); if (tag->getBool("requestclientcert", true)) ctx.SetVerifyCert(); } const std::string& GetName() const { return name; } SSL* CreateServerSession() { return ctx.CreateServerSession(); } - SSL* CreateClientSession() { return clictx.CreateClientSession(); } + SSL* CreateClientSession() { return clientctx.CreateClientSession(); } const EVP_MD* GetDigest() { return digest; } bool AllowRenegotiation() const { return allowrenego; } unsigned int GetOutgoingRecordSize() const { return outrecsize; } -- cgit v1.3.1-10-gc9f91 From caab4c101a7bea30e6b6d7860e90db91278a90c4 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 24 Jun 2021 22:43:17 +0100 Subject: Add a log message to the SSL mods to remind users how to reload profiles. --- src/modules/extra/m_ssl_gnutls.cpp | 5 +++++ src/modules/extra/m_ssl_mbedtls.cpp | 5 +++++ src/modules/extra/m_ssl_openssl.cpp | 5 +++++ 3 files changed, 15 insertions(+) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 86c2c43b7..210e38489 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -1357,6 +1357,11 @@ class ModuleSSLGnuTLS : public Module ServerInstance->GenRandom = RandGen::Call; } + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE + { + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "IMPORTANT: SSL profiles are not reloaded on rehash. To reload SSL profiles you must do `/REHASH -ssl` or load the sslrehashsignal module and send SIGUSR1 to the IRCd process."); + } + void OnModuleRehash(User* user, const std::string ¶m) CXX11_OVERRIDE { if (!irc::equals(param, "tls") && !irc::equals(param, "ssl")) diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index a33ea367e..d10321e5a 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -943,6 +943,11 @@ class ModuleSSLmbedTLS : public Module ReadProfiles(); } + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE + { + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "IMPORTANT: SSL profiles are not reloaded on rehash. To reload SSL profiles you must do `/REHASH -ssl` or load the sslrehashsignal module and send SIGUSR1 to the IRCd process."); + } + void OnModuleRehash(User* user, const std::string ¶m) CXX11_OVERRIDE { if (!irc::equals(param, "tls") && !irc::equals(param, "ssl")) diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index cd96022c8..16a10bbf4 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -1092,6 +1092,11 @@ class ModuleSSLOpenSSL : public Module ReadProfiles(); } + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE + { + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "IMPORTANT: SSL profiles are not reloaded on rehash. To reload SSL profiles you must do `/REHASH -ssl` or load the sslrehashsignal module and send SIGUSR1 to the IRCd process."); + } + void OnModuleRehash(User* user, const std::string ¶m) CXX11_OVERRIDE { if (!irc::equals(param, "tls") && !irc::equals(param, "ssl")) -- cgit v1.3.1-10-gc9f91 From d9572c0a252ed3ec0990b65650778085c2f38b41 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 24 Jun 2021 23:00:32 +0100 Subject: Allow reloading SSL profiles on rehash. --- src/modules/extra/m_ssl_gnutls.cpp | 5 +++-- src/modules/extra/m_ssl_mbedtls.cpp | 5 +++-- src/modules/extra/m_ssl_openssl.cpp | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 210e38489..0d8821cd9 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -1353,13 +1353,14 @@ class ModuleSSLGnuTLS : public Module void init() CXX11_OVERRIDE { ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "GnuTLS lib version %s module was compiled for " GNUTLS_VERSION, gnutls_check_version(NULL)); - ReadProfiles(); ServerInstance->GenRandom = RandGen::Call; } void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "IMPORTANT: SSL profiles are not reloaded on rehash. To reload SSL profiles you must do `/REHASH -ssl` or load the sslrehashsignal module and send SIGUSR1 to the IRCd process."); + ConfigTag* tag = ServerInstance->Config->ConfValue("gnutls"); + if (status.initial || tag->getBool("onrehash")) + ReadProfiles(); } void OnModuleRehash(User* user, const std::string ¶m) CXX11_OVERRIDE diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index d10321e5a..982e5d025 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -940,12 +940,13 @@ class ModuleSSLmbedTLS : public Module if (!ctr_drbg.Seed(entropy)) throw ModuleException("CTR DRBG seed failed"); - ReadProfiles(); } void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "IMPORTANT: SSL profiles are not reloaded on rehash. To reload SSL profiles you must do `/REHASH -ssl` or load the sslrehashsignal module and send SIGUSR1 to the IRCd process."); + ConfigTag* tag = ServerInstance->Config->ConfValue("mbedtls"); + if (status.initial || tag->getBool("onrehash")) + ReadProfiles(); } void OnModuleRehash(User* user, const std::string ¶m) CXX11_OVERRIDE diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 16a10bbf4..5f0ec68a3 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -1088,13 +1088,13 @@ class ModuleSSLOpenSSL : public Module exdataindex = SSL_get_ex_new_index(0, exdatastr, NULL, NULL, NULL); if (exdataindex < 0) throw ModuleException("Failed to register application specific data"); - - ReadProfiles(); } void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "IMPORTANT: SSL profiles are not reloaded on rehash. To reload SSL profiles you must do `/REHASH -ssl` or load the sslrehashsignal module and send SIGUSR1 to the IRCd process."); + ConfigTag* tag = ServerInstance->Config->ConfValue("openssl"); + if (status.initial || tag->getBool("onrehash")) + ReadProfiles(); } void OnModuleRehash(User* user, const std::string ¶m) CXX11_OVERRIDE -- cgit v1.3.1-10-gc9f91