This moves the SSL loading code from MetaParams::read() into a separate
method, loadSSLSettings(). It also hooks up the SIGUSR1 signal handler
to reload SSL settings and apply the setings to each suitable virtual
server.
A follow-up commit will change MetaParams::read() to also use loadSSLSettings(),
however it was left out of this commit to aid in reviewability.
This replaces our ad-hoc password generator in ServerDB for generating
the initial SuperUser password.
The original implementation had several problems, including use of a
non-cryptographically secure random number generator, as well as problems
with modulo bias.
The class implements an API similar to OpenBSD's arc4random:
- A way to get a random uint32_t. (arc4random)
- A way to get a random uint32_t with an upper bound. (arc4random_uniform)
- A way to fill a buffer with random data. (arc4random_buf)
The ad-hoc RSA checks in updateCertificate are unnecessary: we already have a
function that can check whether a given certificate belongs to a given private
key: Server::isKeyForCert().
Rip out the old RSA-specific code (which limited updateCertificate() to only
work with RSA keys), with the more general Server::isKeyForCert().
This change moves the QSslSocket::supportsSsl() check from MetaParams:read()
to main.cpp. This also ensures that the SSL check happens very early in Murmur's
initialization process, rather than after we might have already attempted to
call some SSL-related APIs.
This change also moves the log message that prints the OpenSSL version to main.cpp,
and integrates it with the QSslSocket::supportsSsl() check.
In order to reload the SSL settings live, we need to know the .ini file
Murmur used when initially loading its settings, in order to re-load the
settings from the same file.
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.
This moves the qmConfig.clear() call in MetaParams::read() to the
top of the function.
This allows the SSL part of MetaParams::read() to be moved out to a
separate function in the upcoming PR for live-reloading SSL settings
via the SIGUSR1 signal.
Hot certificate reloading will use the USR1 signal.
This adds the meat of the implementation to UnixMurmur, such that
the PR for live-reloading SSL settings via the SIGUSR1 signal is
more easily digestable.
This allows the setting to be loaded from an arbitrary QSettings instance.
We need this to be able to implement live reloading of SSL settings via the SIGUSR1 signal.
Explicitly set QT = core in order to force Qt's QTEST_MAIN
to use a QCoreApplicaiton instead of a QApplication.
Also, while we're here, move from the deprecated
CONFIG += qtestlib
to
QT += testlib
For packets we receive from Murmur, we check that they're a valid voice
packet on receipt.
However, some packets are not received by Murmur, but generated by the
client itself: packets for RecordUser, and local loopback packets.
If we mess up their type due to a bug, we'd previously allow them into the
AudioOutput system. This commit discards them before they get there.
Otherwise, a malformed packet could lead to a crash.
Note that this only affects packets generated by Mumble itself,
such as local loopback packets and voice recorder packets.
Packets from the network are filtered in such a way that a
packet with an invalid type will never be able to enter the
audio subsystem -- it is discarded in the network subsystem.
@tatokis reported a voice recorder crash on IRC.
(Also filed as mumble-voip/mumble#2863)
The main culprit was missing error checking in flushCheck() for the values
of iTarget and iPrevTarget.
The problem is that iPrevTarget can be set to -1 in error situations,
when using voice target shortcuts. (Whispers and shouts.)
When that happens, the message type output by flushCheck() will be set
to an invalid value (7), because iPrevTarget is -1.
In flushCheck(), when the packet is a terminator, we set the packet's flags
to the value of iPrevTarget. However, in some error states, iPrevTarget is -1.
When flags is set to -1, all bits are high (say, 0xffffffff on 32-bit
systems). Since all bits are high, our attempt to set the message type in
the flags byte fail, because we attempt to splice it in there via binary
OR.
The result is a packet with an invalid message type of 7 gets into our
audio subsystem and wreaks havoc. Due to mistakes in other code in
AudioOutputSpeech, that invalid value could cause a crash. (The problem
was that we expected that all packets that weren't Opus or CELT to be
Speex. Even 'unknown' message types. This will be fixed in a separate
commit.)
Fixesmumble-voip/mumble#2863
This commits adds a 'make check' target to Mumble's build.
To enable tests, add CONFIG+=tests when configuring the
Mumble build.
It's all based on Qt's existing support for this.
To add a testcase, simply add CONFIG+=testcase to its .pro file.
Then, that test will automatically be built and run when 'make check'
is run.
This commit also adds the recent TestCryptographicHash test to the
test suite, as the -- for now -- only test.