From bd2f6b000aca217a680b24b59effb2fb6489be4b Mon Sep 17 00:00:00 2001 From: Michael Marley Date: Wed, 13 Nov 2013 11:48:15 -0500 Subject: [PATCH] Add core commandline option to require SSL for client connections. If the --require-ssl commandline option is passed when starting the core, it will reject any client that does not use SSL. --- src/common/main.cpp | 3 +++ src/core/coreauthhandler.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/common/main.cpp b/src/common/main.cpp index 198e76be..ced7d5bd 100644 --- a/src/common/main.cpp +++ b/src/common/main.cpp @@ -115,6 +115,9 @@ int main(int argc, char **argv) cliParser->addOption("change-userpass ", 0, "Starts an interactive session to change the password of the user identified by username"); cliParser->addSwitch("oidentd", 0, "Enable oidentd integration"); cliParser->addOption("oidentd-conffile ", 0, "Set path to oidentd configuration file"); +#ifdef HAVE_SSL + cliParser->addSwitch("require-ssl", 0, "Require SSL for client connections"); +#endif #endif #ifdef HAVE_KDE diff --git a/src/core/coreauthhandler.cpp b/src/core/coreauthhandler.cpp index 4b2824f5..7356d5b4 100644 --- a/src/core/coreauthhandler.cpp +++ b/src/core/coreauthhandler.cpp @@ -101,6 +101,11 @@ void CoreAuthHandler::handle(const RegisterClient &msg) // TODO: only in compat mode bool useSsl = false; #ifdef HAVE_SSL + if (Quassel::isOptionSet("require-ssl") && !msg.sslSupported) { + _peer->dispatch(ClientDenied(tr("SSL is required!
You need to use SSL in order to connect to this core."))); + _peer->close(); + return; + } if (Core::sslSupported() && msg.sslSupported) useSsl = true; #endif -- 2.20.1