Commit Graph

346 Commits

Author SHA1 Message Date
Robert Adam
07836a0e69 REFAC(deprecated): Replace deprecated QString::SkipEmptyParts
Qt 5.14 has introduced Qt::SplitBehavior which now holds the flag that
were previously contained in the QString class. The fields still exist
in QString but they are deprecated since Qt 5.15.
2020-06-10 19:31:34 +02:00
Terry Geng
e90eb8c4cd
src: Made CryptState an abstract class, in order to support multiple crypto types in the future. Moved all crypto-related files into src/crypto. 2020-06-06 20:37:59 +08:00
Jonas Herzig
be97594046 Safeguard from potential attacks against OCB2
OCB2 is known to be broken under certain conditions:
https://eprint.iacr.org/2019/311

To execute the universal attacks described in the paper, an attacker needs
access to an encryption oracle that allows it to perform encryption queries with
attacker-chosen nonce. Luckily in Mumble the encryption nonce is a fixed counter
which is far too restrictive for the universal attacks to be feasible against
Mumble.

The basic attacks do not require an attacker-chosen nonce and as such are more
applicable to Mumble. They are however of limited use and do require an en- and
a decryption oracle which Mumble seemingly does not provide at the same time.

To be on the safe side, this commit implements the counter-cryptanalysis
measure described in the paper in section 9 for the sender and receiver side.
This way if either server of client are patched, their communication is almost
certainly (merely lacking formal proof) not susceptible to the attacks described
in the paper.
2020-06-05 12:56:18 +02:00
Robert Adam
e839bb2a9e src: Allow listener proxies in the same channel the actual user is in
Before you weren't able to place a listener proxy (ChannelListener) into
the same channel that you're currently in and if you joined a channel
that you were listening to before, your listener proxy would be removed
from that channel.

It was brought to my attention though that there are cases in which a
person wants to hear what's going on in several channels and thus places
listener proxies into them. However if that same person needs to
constantly hop between these listened channels (e.g. to talk to the
folks in there), it gets very annoying as that person constantly has to
think about re-adding the listener proxy into the channel it just left.
2020-05-04 17:54:16 +02:00
Robert Adam
650e18d79e src/murmur: Fix ChannelListener not hearing shout if no real user is in shouted channel
If you placed a listener proxy into an empty channel and someone was
shouting to that channel, you'd still not hear any of that. This is
because the old processing logic was injected into the code for the
normal shouting feature. However if there is no user in the channel, the
shouting feature won't do anything.

This commit added the listener targets as a separate entry in the
WhisperTargetCache in order for it to be processed independently of
normal shouts. It also had to tweak the logic for how and when to clean
the WhisperTargetCache in order for this to work nicely with
ChannelListeners as well.
2020-04-30 09:27:27 +02:00
Sean Talts
37d24f6bf2 src/murmur: Add autobanSuccessfulConnections flag.
The idea here is that sometimes you really do have a lot of folks connecting from a single IP,
and if those connections are successful you don't want to ban any of them.
However, in cases where the server needs to guard against malicious users attempting a DDOS
by reconnecting their valid user account over and over, we need to be able to configure the
server to still ban those successful attempts.
2020-04-20 15:05:04 -04:00
Robert Adam
8aadee917d Feature: Channel Listeners
This implements #3319 by allowing users to "listen" to a channel they
have not joined. Doing so will place a "listener proxy" (in other
software this is sometimes known as a "phantom") in that channel which
will look like a normal user except that it'll have the same name as the
user listening to that channel and an ear-icon instead of the normal
avatar-icon. It will also always show a muted-icon next to it.

If a listener proxy is in a channel, the server will route all audio
packets from that channel to the user the proxy belongs to (as if that
user was in the channel). Note though that the opposite of this is not
true: The users in the channel will not hear audio from the listening
user unless that user decides to join the channel.

Furthermore it is possible to set a local volume adjustment for each
individual proxy that will be applied to all audio that is received
through it.
2020-04-16 09:29:49 +02:00
Robert Adam
dcd5842008 src: Use enum values instead of magic numbers for speech flags 2020-04-09 19:38:29 +02:00
Davide Beatrici
a48aea18b6 src/murmur/Server.cpp: implement workaround for critical QSslSocket issue
A severe bug was introduced in qt/qtbase@93a803a6de: q_SSL_shutdown() causes Qt to emit "error()" from unrelated QSslSocket(s), in addition to the correct one.

The issue causes Server::connectionClosed() to disconnect random authenticated clients.

The workaround consists in ignoring a specific OpenSSL error:
"Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init [20]"

Definitely not ideal, but it fixes a critical vulnerability. Details on how to trigger it are deliberately omitted.
2020-04-04 07:48:46 +02:00
Robert Adam
59b7013539 Qt: Use QAtomicInteger::loadRelaxed() instead of QAtomicInteger::load()
for Qt 5.14 and higher
2020-02-27 15:31:35 +01:00
Raven
6cf5a2247e
Merge pull request #3943 from Krzmbrzl/mkrautz-certificates
Murmur: allow certificates without full chain, but do not deem such certificates 'strong'.
2020-01-18 18:13:57 +01:00
Mikkel Krautz
33f0fff927 Murmur: allow certificates without full chain, but do not deem such certificates 'strong'.
This allows users to connect to Murmur with CA-signed certificates
without a complete certificate chain.

Such cases will be treated as non-strong, just like self-signed
certificates.

Before this, if a client attempted to connect to Murmur with a
client certificate from an OS-trusted CA, but forgot to include
the correct intermediate certificates, the client would not be
allowed in -- and got no proper warning.

With this change, the user is let in. However, because Murmur
can't verify the certificate against the CA store, it is deemed
non-strong.

Ideally, the certificate wizard should warn about cases where
an incomplete certificate chain is used, but I believe this is
a good first step.
2020-01-18 09:26:03 +01:00
Davide Beatrici
4e67a2fafb Auto-update LICENSE.header in source files 2020-01-07 03:09:22 +01:00
Felix Becker
2faf905167 Try to fix channel limit override by subchan delete
Try to remove the ability to join a full channel by
creating a temporary sub channel then joining it
and removing it (discovered by @Natenom).

Check isChannelFull in addition to existing
hasPermissions ChanACL::Enter check.
2019-11-04 00:52:56 +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
062fe2661d Remove QAtomicInt compatibility layer
Qt 4: https://doc.qt.io/archives/qt-4.8/qatomicint.html
Qt 5: https://doc.qt.io/qt-5/qatomicint.html
2019-10-10 03:09:08 +02:00
hbarker
615c72b17d Remove unneeded null pointer checks
'delete' handles null pointers: https://isocpp.org/wiki/faq/freestore-mgmt#delete-handles-null
2019-09-25 03:57:46 +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
e662eb430d Server.cpp: replace deprecated QSslSocket::setCiphers() with QSslConfiguration::setCiphers()
92cda94742
2019-08-01 04:29:00 +02:00
Davide Beatrici
b427333257 Auto-update LICENSE.header in source files 2019-01-25 04:56:19 +01:00
MadMaurice
73a0b2f888 Make Rate limiter configurable.
This adds messagelimit and messageburst to the configuration file murmur.ini as
well as the ability to set these live.

Though adjusting these live is entirely possible, they only take effect for new connections.
2018-09-08 01:58:23 +02:00
Stefan Hacker
9e0526c485 Introduce channelcountlimit to limit max channels per server
Having to many channels on a server can impact performance to the point
of making the instance unusably slow. This can be a problem for hosters
that allow their users unlimited channel creation.

This patch introduces a new per-server configuration parameter
channelcountlimit which can be used to configure a maximum number of
channels that may be created on each of the virtual servers. Once the
limit is reached channel creation will be rejected with permission
denied.

To allow a translated error message we have to bump the client version
to 1.3.1 to be able to use a fallback message for older clients.

As usual dbus, ice and grpc can ignore this limit. It is only enforced
against clients.
2018-06-14 00:50:50 +02:00
Jan Klass
c8ed9f9a00 Fix error when handling TCP tunneled UDP voice packets
0b5579c755 erroneously replaced the
variable (letter) l with the integer 1.

Revert this change and use a more descriptive variable name `len`.

Fixes #3325
2018-01-29 19:10:34 +01:00
davidebeatrici
f2d0a2f16e Server.cpp: Remove line of code accidentally added in commit 0b5579c 2018-01-23 01:07:52 +01:00
davidebeatrici
0b5579c755 Fix and refactor problems found via GCC 7's -Wimplicit-fallthrough.
This commit fixes various problems discovered by building on Debian buster
which uses GCC 7. Building on buster gave various -Wimplicit-fallthrough warnings.

In Group.cpp and Server.cpp, we now use if statements instead of a switch with fallthrough.
This improves readability of the code, and fixes the implicit fallthroughs.

In PulseAudio.cpp, we had unintended fallthroughs in a switch statement, which have been
fixed.

In Cert.cpp, we had a potential fallthrough which was impossible to trigger at runtime,
fixed by adding an error return, like the surrounding code.

Fixes #3306.
2018-01-21 22:54:47 +01:00
Mikkel Krautz
f6ba3a52bf Auto-update LICENSE.header in source files. 2018-01-01 23:05:37 +01:00
Mikkel Krautz
5ede036c7d Net: refactor HostAddress class to its own set of files. 2017-04-10 09:22:56 +02:00
Davide Beatrici
882d972e65 Connection, Server, ServerHandler: Cast "dwFlow" to DWORD pointer to fix
MinGW build.

Fixes:
Connection.cpp:69:126: error: invalid conversion from 'DWORD* {aka long unsigned int*}' to 'PQOS_FLOWID {aka unsigned int*}' [-fpermissive]
 tDescriptor(), NULL, QOSTrafficTypeAudioVideo, QOS_NON_ADAPTIVE_FLOW, &dwFlow))
                                                                              ^

Server.cpp: In member function 'void Server::sendMessage(ServerUser*, const char*, int, QByteArray&, bool)':
Server.cpp:918:158: error: invalid conversion from 'DWORD* {aka long unsigned int*}' to 'PQOS_FLOWID {aka unsigned int*}' [-fpermissive]
 r *>(& u->saiUdpAddress), QOSTrafficTypeVoice, QOS_NON_ADAPTIVE_FLOW, &dwFlow);
                                                                              ^

ServerHandler.cpp: In member function 'void ServerHandler::serverConnectionConnected()':
ServerHandler.cpp:650:0: error: invalid conversion from 'DWORD* {aka long unsigned int*}' to 'PQOS_FLOWID {aka unsigned int*}' [-fpermissive]
     if (! QOSAddSocketToFlow(hQoS, qusUdp->socketDescriptor(), reinterpret_cast<sockaddr *>(&addr), QOSTrafficTypeVoice, QOS_NON_ADAPTIVE_FLOW, &dwFlowUDP))
 ^
2017-03-17 19:14:14 +01:00
Mikkel Krautz
1a0e145a9d Meta: remove use of global QSslSocket::defaultCiphers() list.
This removes use of the global QSslSocket::defaultCiphers() list.

Instead, we set the ciphers on each socket individually.
2017-02-26 19:27:23 +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
7b500db361 Server: treat certs from murmur.ini's sslCA as CA certs for client verification.
The sslCA option is used by people to specify extra CA certificates.

Before this patch series, the certificates from sslCA would be added
to the QSslSocket::defaultCaCertificates() list via MetaParams. Thus,
those certificates were automatically treated by QSslSocket as valid
root certificates -- by all QSslSocket instances in Murmur.

Since we've now stopped adding the sslCA certificates to the global
QSslSocket::defaultCaCertificates() list, we now have to add them to
each QSslSocket as necessary, for them to be treated as CA certificates.

One use-case for murmur.ini's sslCA option is to add extra CA
certificates in case the system CA store doesn't contain the necessary
certificates.

In Murmur, one place where CA certificates are used is when verifying
client certificats. In Murmur, if a user is using a valid CA-signed
certificate, that user has passed the 'strong' check.

As mentioned, before this patchset, all the certificates from the PEM
bundle pointed to by murmur.ini's sslCA option would be added to
QSslSocket's global default CA certificates list, which is available
via QSslSocket::defaultCaCertificates().

Thus, any CA certificates in sslCAs would be treated as CA certificates
when verifying client certificates of conecting clients.

To keep this behavior, we now add MetaParams's qlCAs to the CA list of
the each connecting client's QSslSocket.

This is useful if you are using private CA for signing
identities for Murmur. If you put your CA certificate into the PEM
bundle pointed to by sslCA, Murmur will treat users with a certificate
issued by that CA as having a valid ('strong') certificate.

Another useful use-case for this is if a user is running Murmur on an
unsupported OS, where certificate verification doesn't work due to Murmur
or Qt not being able to find the system's certificate store. In this
scenario, it is possible to point murmur.ini's sslCA option the sytem's
CA bundle, or a PEM copy of the Mozilla CA bundle. That way, verification
of client certificates from generally trusted certificate authorities is
restored.
2017-02-25 23:10:54 +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
a9330a48f7 Revert 91dc3d39f0 ('Move counter variable in processMsg into Opus condition.').
This comit (full SHA-1 is 91dc3d39f0) is
obviously flawed.

So revert it.
2017-02-07 20:03:31 +01:00
Mikkel Krautz
4d6a813e80 Refactor Server::supportsDualStack().
The current implementation tries too hard to avoid duplication
of very few lines of code.

Instead, use two separate code paths, one for Windows, one for
Unix-like sytems.

This makes it more readable, and allows us to handle system-specific
quirks much easier. For example, SOCKET is unsigned on Windows, and
comparing it to -1 technically works (at least for two's complement
machines), but causes a compiler warning for a signed vs. unsigned
comparison.
2017-02-02 00:34:11 +01:00
Mikkel Krautz
91ebb8b0b5 Update tree copyrights to 2017. 2017-01-08 21:05:57 +01:00
Mikkel Krautz
cd8f6b75e0 Refactor LogEmitter from Murmur into its own file in src/.
It's a natural refactoring and it'd be nice to be able to
use LogEmitter in Mumble as well.
2016-12-04 13:26:46 +01:00
Mikkel Krautz
2e6625b191 Murmur: replace all QAtomicInt loads with new QAtomicIntLoad compatibility function.
By using our new portable QAtomicIntLoad function, we ensure compatibility
with both Qt 4 and Qt 5.

Fixes mumble-voip/mumble#2586
2016-10-26 21:31:53 +02:00
Mikkel Krautz
46b5b62781 Murmur: use aiUdpFlag.load() in comparisons to fix Qt <5.2 build.
Fixes mumble-voip/mumble#2420
2016-07-15 00:49:08 +02:00
Mikkel Krautz
c73df62a65 Fix locking in the unknown peer path of UDP receive in Server::run(). 2016-06-24 00:03:12 +02:00
Mikkel Krautz
cb446f1808 Server: convert bUdp to use QAtomicInt for proper synchronization. 2016-06-24 00:03:12 +02:00
Mikkel Krautz
cfb535aa15 Add missing ACL cache lock to Server::processMsg. 2016-06-24 00:03:11 +02:00
Mikkel Krautz
f03b74db2d Add mutex for csCrypt usage in Murmur. 2016-06-24 00:03:11 +02:00
Mikkel Krautz
f260bd1913 Implement correct write locking for addChannel/removeChannel/link/unlink. 2016-06-24 00:03:11 +02:00
Mikkel Krautz
f66b0d34c8 Rename qrwlUsers to qrwlVoiceThread. 2016-06-24 00:03:11 +02:00
Mikkel Krautz
91dc3d39f0 Move counter variable in processMsg into Opus condition. 2016-06-24 00:03:11 +02:00
Mikkel Krautz
77ddc015b0 Move processMsg's 'c' Channel pointer into 'normal speech' code path. 2016-06-24 00:03:11 +02:00
Mikkel Krautz
d6d6f6fa0f Refactor use of 'p' User pointer used in foreach loops.
Improve readability by declaring a local 'User *p' in
each foreach loop.
2016-06-24 00:03:11 +02:00
Mikkel Krautz
f696ddc281 Server: refactor bandwidth check in processMsg. 2016-06-24 00:03:11 +02:00
Mikkel Krautz
3897c794fe Murmur: use non-forceful disconnect when encountering SSL handshake errors on Qt 5.
Due to a regression in Qt 5, we can't use disconnectSocket(true)
to abort a handshake.

Use non-forceful disconnect to work around the Qt 5 bug.

See inline comment for more details.

Fixes mumble-voip/mumble#2334
2016-06-11 01:53:03 +02:00