Commit Graph

70 Commits

Author SHA1 Message Date
Robert Adam
d100ff1467 MAINT: Update copyright to 2022 2022-01-04 20:17:33 +01:00
Robert Adam
59ae429972 MAINT: Update copyright notice to 2021
This was done by running scripts/updateLicenseHeaders.py and then
manually editing the LICENSE file.
2021-03-02 10:15:01 +01:00
freddii
9889a0fa99 DOCS: fixed typos 2021-01-20 22:17:38 +01:00
Robert
af7dac72f4 FORMAT: Run clang-format 10 on all C/CXX source-files 2020-09-11 18:29:33 +02:00
Popkornium18
410837526c REFAC(server): replace NULL with nullptr
This changes all occurances of NULL in the murmur source
dir to nullptr. Additionally explicit comparisons with NULL were
removed.
2020-07-02 00:55:36 +02:00
Davide Beatrici
4e67a2fafb Auto-update LICENSE.header in source files 2020-01-07 03:09:22 +01:00
Davide Beatrici
1ac534915c Remove remaining Qt 4 stuff
For reference: https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5
2019-10-10 03:14:38 +02:00
Davide Beatrici
15831dbca8 Add missing includes for "no-pch" build
This commit adds all the missing includes when the PCH header is not used.

Also, some includes are reordered and/or made consistent (e.g. "#include <QtEndian>" -> "#include <QtCore/QtEndian>").
2019-09-12 22:08:39 +02:00
Davide Beatrici
5a07244a44 Don't include PCH headers directly
According to Qt's documentation the PCH header doesn't need to be included.

From https://doc.qt.io/qt-5/qmake-precompiledheaders.html:

"To make your project use precompiled headers, you only need to define the PRECOMPILED_HEADER variable in your project file."

"qmake will handle the rest, to ensure the creation and use of the precompiled header file. You do not need to include the precompiled header file in HEADERS, as qmake will do this if the configuration supports precompiled headers."
2019-09-12 00:13:35 +02:00
Davide Beatrici
b427333257 Auto-update LICENSE.header in source files 2019-01-25 04:56:19 +01:00
Mikkel Krautz
f6ba3a52bf Auto-update LICENSE.header in source files. 2018-01-01 23:05:37 +01:00
Mikkel Krautz
bed57636e9 murmur/Cert: remove auto-generation of Diffie-Hellman parameters.
Remove automatic generation of Diffie-Hellman parameters for vservers.

There were various problems with this approach.

 - It was somewhat slow.
 - To avoid blocking the main thread while generating the DH parameters,
   the code would enter an event loop. However, this meant that other code
   could still execute (for example, clients could connect to the server
   before the DH params were generated).

As a replacement, we're going to be shipping the Diffie-Hellman parameters
from RFC 7919 bundled into Murmur, and we'll default to one of them.
2017-07-19 12:17:03 +02:00
Mikkel Krautz
a69668aed1 SelfSignedCertificate: new class for creation of self-signed certificates.
This moves the refactored certificate generation code from
src/murmur/Cert.cpp into its own file, src/SelfSignedCertificate.cpp.
Furthermore, the code is refactored to also be able to fulfil the duties
of Mumble's code for generating self-signed certificates.

The old code in both Mumble and Murmur is updated to call the new
SelfSignedCertificate methods for generating client and server
certificates.

This fixes the ability to build Mumble with OpenSSL 1.1.
(Previously, only Murmur could be built.)
2017-07-14 10:58:17 +02:00
Mikkel Krautz
cbeed58633 murmur/Cert: OPENSSL_VERSION -> OPENSSL_VERSION_NUMBER.
I mistakenly checked OPENSSL_VERSION (which doesn't exist), instead of
OPENSSL_VERSION_NUMBER, making the check fail.
2017-05-15 08:56:59 +02:00
Mikkel Krautz
3160fc95e9 murmur/Cert: check for 'Murmur Autogenerated Certificate' prefix instead of explicit version in self-signed cert check.
This commit changes our check for whether a server is using a self-signed
certificate to check for the prefix 'Murmur Autogenerated Certificate'.

Previously, we would only check for 'Murmur Autogenerated Certificate v2'.
(The previous version, 'Murmur Autogenerated Certificate' is no longer valid,
so is not considered in this context.)

This will allow us to bump the version in the certificate, without needing
to update our code to know about these bumps.
2017-05-08 21:45:14 +02:00
Mikkel Krautz
0d08ab3117 selfSignedServerCert_SHA1_RSA_2048: use RSA_generate_key_ex().
This replaces selfSignedServerCert_SHA1_RSA_2048()'s use of
the old, deprecated RSA_generate_key() function with
RSA_generate_key_ex().

The new function is a bit more explicit, so the code is a little
longer.

The RSA factor RSA_F4 is replaced with an explicit BIGNUM of 65537.
RSA_F4 is the flag to use for 65537 when using the old RSA_generate_key()
function.
2017-05-07 21:48:37 +02:00
Mikkel Krautz
f0b33c4a72 murmur/Cert: improve error handling in the add_ext() function.
The add_ext function, like selfSignedServerCert_SHA1_RSA_2048(),
needed an overhaul with regards to error handling.

This commit implements that.
2017-05-07 21:48:36 +02:00
Mikkel Krautz
70da3baeca selfSignedServerCert_SHA1_RSA_2048: add error handling.
This adds much needed error handling to the
selfSignedServerCert_SHA1_RSA_2048() function.

This covers thorough checking of return values for calls
into OpenSSL API, as well as strict null checking on values
that one would expect to be non-null.

Better safe than sorry.
2017-05-07 21:48:34 +02:00
Mikkel Krautz
3210091774 selfSignedServerCert_SHA1_RSA_2048: refactor variable declarations.
The control flow is going to change in this function once we add
error handling.

Prepare for that by declaring all variables at the beginning of
the function.
2017-05-07 21:48:33 +02:00
Mikkel Krautz
e7c27873e3 selfSignedServerCert_SHA1_RSA_2048: nullify output variables on failure.
This commit ensures that we assign a null-valued QSslCertificate and
QSslKey on failure.
2017-05-07 21:48:31 +02:00
Mikkel Krautz
402596b2c1 murmur/Cert: move self-signed server certificate generation to its own function.
This moves the code that generates Murmur's self-signed certificate into its own
function, selfSignedServerCert_SHA1_RSA_2048.

This is done in preperation of refactoring the code to use non-deprecated OpenSSL
functionality.
2017-05-07 21:48:25 +02:00
Mikkel Krautz
2a08974eb4 Murmur: fix warning about unused mumble_BN_GENCB_new/mumble_BN_GENCB_free.
These functions are only used when the QSslDiffieHellmanParameters
class is available.

This commit moves the functions into an #if
defined(USE_QSSLDIFFIEHELLMANPARAMETERS) block.
2017-05-06 23:47:46 +02:00
Mikkel Krautz
4dabb1bcf1 Use BN_GENCB_new() and BN_GENCB_free() where applicable.
This commit gets rid of manually allocated BN_GENCB structs
in favour of objects returned from BN_GENCB_new().

Why do this? OpenSSL structs are now considered opaque. Therefore, it is
not wise for us to allocate them based on their size in the current
OpenSSL header, since its size can change in the future.
Instead, we let OpenSSL allocate the object for us using the
BN_GENCB_new() method (and corresponding BN_GENCB_free() method for
freeing the allocated object).

These functions are only available in OpenSSL 1.1. To remedy this, this
commit implements mumble_BN_GENCB_new() and mumble_BN_GENCB_free().
On OpenSSL >= 1.1, these functions use OpenSSL's own new and free
functions. On prior versions, we allocate using malloc/free.
2017-05-02 00:15:29 +02:00
Mikkel Krautz
7925c375c2 Cert: reset Server's SSL state in initializeCert().
This changes Server::initializeCert() to always reset the
Server's SSL state before reloading it.

Previously, we didn't reset the state.

Not doing so *does* actually works for the case where we
load the certificate and key from the per-vserver configuration
in ServerDB.

However, it doesn't work when reading from Meta, because
the old Server::initializeCert() would only use the settings
from Meta if qscCert/qskKey were null.
2017-03-04 19:07:24 +01:00
Mikkel Krautz
28d5b8e3fe Cert: require Qt 5.5 for QSsl::Ec.
It was not implemented until Qt 5.5:
962ea5690c

No trace in the Qt docs.
2017-02-28 02:04:24 +01:00
Mikkel Krautz
250a93bbf4 Server: add bUsingMetaCert flag.
This flag is necessary for hot certificate reload.

We need to know which servers are using the Meta certificate/key,
since we will only be able to live-reload SSL settings via SIGUSR1
for those servers. Servers that use their own SSL certificate/key
can't be reloaded via the SIGUSR1 mechanism.

This is because servers that use their own SSL certificate/key store
them in the database. Thus, it is only possible to update those via
RPC using the updateCertificate() method.
2017-02-26 19:25:39 +01:00
Mikkel Krautz
45276e8f7a Cert: for servers using the cert/key specified in murmur.ini, also inherit its intermediates. 2017-02-25 23:11:00 +01:00
Mikkel Krautz
1c8b637cbf Server: rename qlCA to qlIntermediates, to properly reflect its function.
The list doesn't actually contain CA certificates, but intermediates.

So let us name it appropriately.
2017-02-25 23:10:47 +01:00
Mikkel Krautz
32ca3cfe7d Server, Cert: make use of Server::privateKeyFromPEM() method. 2017-02-20 23:44:54 +01:00
Mikkel Krautz
441063f8f8 Server, Cert: add Server::privateKeyFromPEM() method.
This adds a new method, Server::privateKeyFromPEM(), a helper
method for loading private keys.

In various places throughout the codebase, we use the same
sequence of operations for loading private keys from a PEM
bytestream.

This method moves that sequence to a single method, to avoid
the unnecessary duplication that is currently going on.
2017-02-20 23:44:49 +01:00
Steven Noonan
e75e737130 murmur: add support for EC private keys
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2017-02-20 23:44:45 +01:00
Mikkel Krautz
645603771d Murmur: use final Qt 5.8 API for QSslDiffieHellmanParameters. 2017-01-22 22:05:52 +01:00
Mikkel Krautz
91ebb8b0b5 Update tree copyrights to 2017. 2017-01-08 21:05:57 +01:00
Mikkel Krautz
18e801431b Cert: add ERR_clear_error() to the end of initializeCert(). 2016-06-06 21:42:59 +02:00
Mikkel Krautz
54c28d3ee1 src/murmur: update to use LICENSE.header. 2016-05-10 22:42:02 +02:00
James Fraser
25422e7f94 Add comments to some conditionals in initializeCert() 2016-04-26 15:54:52 +02:00
Nick Heindl
93427affde Fix typo in comment: Issue #2070
Changed DH_generate_parameterss_ex to DH_generate_parameters_ex
2016-02-25 20:28:16 +01:00
Stefan Hacker
4795ae57bc Fix qFatal message generation in Diffie Hellmann error path
Tried to pass a QString as an argument to a variadic C-Style
function (qFatal) which would have crashed and burned at
runtime.
2015-10-28 21:49:54 +01:00
Stefan Hacker
68205b9311 Fix remaining warnings in murmur code
Fixes remaining unused function, shadow and cast warnings
in murmur code.
2015-10-27 00:01:13 +01:00
Mikkel Krautz
8bd3f76a8e Murmur: add support for EDH cipher suites, and for specifying Diffie-Hellman parmeters.
This change allows server admins to specify Diffie-Hellman
parameters for Murmur to use. This is done using the sslDHParams
option in the config file. Diffie-Hellman parameters can also be
set on a per-server basis using the sslDHParams option.

Note: the functionality implemented in this change requires the
QSslDiffieHellmanParameters class in Qt, which has not yet landed
upstream in the Qt 5 'dev' branch. This means that the functionality
discussed in this change will, for now, only work in binaries provided
by the Mumble project, or binaries that are built using our build
environments, and not binaries that link against any released versions
of Qt at present.

This change modifies the default TLS cipher suite string to add
EDH+aRSA+AESGCM, DHE-RSA-AES256-SHA and DHE-RSA-AES128-SHA.

This yields the following ciphers, in TLS/RFC notation:

    TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
    TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
    TLS_DHE_RSA_WITH_AES_256_CBC_SHA
    TLS_DHE_RSA_WITH_AES_128_CBC_SHA

This change also allows Murmur servers to provide forward secrecy
to older clients, such as our own pre-built binaries before 1.2.9.

It also provides forward secrecy for users that use Mumble 1.2.x
versions on Linux distros, and other Unix-like systems. This is
because Mumble 1.2.x on Unix-like systems builds against Qt 4, which
limits the connection to TLS 1.0.

Before this change, Murmur was not able to negotiate an ephemeral
Diffie-Hellman key exchange for those clients. This is now possible.
2015-09-26 22:33:49 +02:00
Stefan Hacker
12eb26431f Replace all uses of QT_VERSION_CHECK with explicit version.
Qt4's moc is not able to expand QT_VERSION_CHECK which may lead
to invalid codegen when used for backwards compatibility work.
Replaced all occurances with explicit check against numeric
version which are treated correctly. Even though bad interactions
might be rare we should no longer use this macro as long as we
want to compile with Qt 4. Also see:
http://lists.qt-project.org/pipermail/interest/2013-August/008351.html
2014-08-22 01:55:34 +02:00
Mikkel Krautz
84bc19c818 mumble: migrate hardcoded 0x050000 Qt version to the QT_VERSION_CHECK macro. 2013-06-29 16:56:42 +02:00
Mikkel Krautz
5cb337049b mumble, murmur: Qt 5 support for Linux. 2013-06-29 16:56:41 +02:00
EarlOfWenc
09d5c07a3d Replaced last traces of MD5 by SHA-1 2012-08-20 21:38:30 +02:00
Benjamin Jemlich
07737a314c Fix include guards and PCH includes 2011-11-09 00:12:10 +01:00
Thorvald Natvig
45bd8139fe Fix murmur warnings 2011-05-15 16:45:46 -07:00
Thorvald Natvig
f3437a6ba7 Update copyright year ranges of dev team. 2011-03-18 05:52:51 +01:00
Thorvald Natvig
16339bfc91 Update license to 2010 2010-01-05 08:49:22 +01:00
Thorvald Natvig
3976433cc7 Multibind for nix 2009-06-22 20:01:44 +02:00
Thorvald Natvig
5248ca4fc3 Avoid cert warning when falling back to .ini cert 2009-06-08 13:41:53 +02:00