Commit Graph

370 Commits

Author SHA1 Message Date
Lorenz Brun
f70ebcccab REFAC(server): Replace non-standard u_char with uint8_t
u_char is an old nonstandard BSD alias and should
not be used in portable code.
2021-03-27 13:27:55 +01:00
Robert Adam
dda161138b REFAC: Make sure all macros are #undef'd again
If they are not there is the potential of name clashes when performing a
unity build.

See: https://stackoverflow.com/questions/847974/the-benefits-disadvantages-of-unity-builds
2021-03-06 18:57:22 +01:00
Robert Adam
6657a6f2a1
Merge pull request #4817: FIX(Server): Unauthenticated connections no longer add to user count
This commit fixes both issues discussed in #4277 which were related to
the fact that any socket connection was allocated an ID and marked as
a user. This bug allowed for a malicious user to lock out all users of
a server regardless of server password usage. This change simply moves ID
allocation to after a connection is marked as Authenticated.

FIXES: #4277
2021-03-03 07:35:22 +01:00
Lucas Toole
eabfbab403 FIX(Server): Unauthenticated connections no longer add to user count
This commit fixes both issues discussed in #4277 which were related to
the fact that any socket connection was allocated an ID and marked as
a user. This bug allowed for a malicious user to lock out all users of
a server regardless of server password usage. This change simply moves ID
allocation to after a connection is marked as Authenticated.

FIXES: #4277
2021-03-02 08:59:28 -06: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
KetchupBomb
da26386827 FEAT(server): Remove broadcast of new welcometext when changing via Ice.
When changing the welcome text via Ice, Murmur would broadcast the new text to all connected clients. It is a matter of opinion if this is proper behavior or not, but it seems too proactive of an action. Let the clients see the new welcometext when they next connect, or let the Murmur administrator explicitly perfor a sendMessage() to all connected clients after changing the welcometext.

Closes: #4788

Co-Authored-By: Robert Adam <dev@robert-adam.de> <krzmbrzl@gmail.com>
Co-Authored-By: Robert Adam <dev@robert-adam.de> <krzmbrzl@users.noreply.github.com>
2021-02-25 22:16:26 +00:00
freddii
9889a0fa99 DOCS: fixed typos 2021-01-20 22:17:38 +01:00
Robert Adam
bbdfd10430 FIX(server): Prevent listeners from hearing all shouts
Before this commit, the code on the server made sure that a
ChannelListener would always receive audio that was being shouted to a
channel. It didn't respect though if the shout was actually restricted
to be received by only a specific group.

This patch now makes sure that listeners are also checked for their
group so that a listener that doesn't belong to the target group (if one
is set) won't receive the audio either.
2020-12-08 09:33:26 +01:00
Davide Beatrici
ee731f8405 FEAT(client, server): use native mDNS/DNS-SD API on Windows, if available
This allows:

- The client to find servers advertized via zeroconf without the need for Bonjour to be installed.
- The server to advertize itself via zeroconf without the need for Bonjour to be installed.

The Win32 API was introduced in the version 10.0.18362.0 (1903/19H1) of Windows SDK. Before that, only the UWP interface was available (introduced in Windows 10 1507).

This commit was successfully tested on Windows 10 1809, which probably means that the API can be used on previous versions as well.

Even if that isn't the case, it's not a problem: if the code fails to load the required symbols, it falls back to Bonjour.

"Q_OS_WIN64" is used instead of "Q_OS_WIN" because of an issue that appears when certain DNS functions are used in an x86 (32 bit) build: https://developercommunity.visualstudio.com/content/problem/1191345/some-dns-api-functions-cause-lnk2019-errors-in-32.html

This means that until the issue is fixed we can safely use the native mDNS-DNS-SD API only on x86_64 (64 bit).
2020-09-22 07:36:43 +02:00
Davide Beatrici
6a59ae2443 REFAC(client, server): replace "Bonjour" with "Zeroconf", except for 3rdparty
This should make it more clear that we don't include Bonjour-related stuff in our project. We use external libraries depending on the OS.

For compatibility, the server option is still called "bonjour". We should probably add a new option called "zeroconf" and then handle the old one if present in the configuration file.
2020-09-22 07:35:52 +02:00
Robert
b42100e129 REFAC: Fix warning about boost bind
Compiling with Boost a somewhat recent version of Boost would produce
warnings about deprecated usage of boost::bind.
These have been fixed now.

The warning was
The practice of declaring the Bind placeholders (_1, _2, ...) in the
global namespace is deprecated. Please use
<boost/bind/bind.hpp> + using namespace boost::placeholders, or
define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.

Fixes #4295
2020-09-12 13:46:55 +02:00
Robert
af7dac72f4 FORMAT: Run clang-format 10 on all C/CXX source-files 2020-09-11 18:29:33 +02:00
TredwellGit
e5c8c2a08c FIX(server): Use valid format string type
Format specifies type 'void *' but the argument has type 'QObject *'. Using an argument of an unexpected type is undefined behavior.
2020-09-02 15:58:03 -04:00
Robert Adam
ced1fdd37c FIX(cmake): Set QT_RESTRICTED_CAST_FROM_ASCII
With the old qmake buildsystem we used to set QT_NO_CAST_FROM_ASCII (for
the Mumble client) in order to avoid problems with character encodings
in our Strings. This was not done in the new cmake system yet.

Instead of the aforementioned macro, this commit sets (for all targets)
QT_RESTRICTED_CAST_FROM_ASCII instead in order to be able to
automatically convert direct String literals to QString as these usually
don't contain any problematic characters (non-ASCII) in the first place.
And this allows to e.g. compare a QString against a String literal or do
something like
QString myString = "This is a test";
which we know to be unproblematic.

Note however that (quote from Qt's docs)
"Using this macro together with source strings outside the 7-bit range,
non-literals, or literals with embedded NUL characters is undefined."
2020-08-31 09:59:05 +02:00
MadMaurice
b47e309f31 FIX(certificate): Retrieve QSslConfiguration after setting CA
Commit bdb12c6 added a regression for servers built with QT older than version
5.15. After this commit these servers do not serve intermediate certificates
anymore.  This happens because the QSslConfiguration is retrieved before adding
the CA certificates to the socket and is reinserted into the socket again after
adding the CA certificates, thereby overwriting the CA certificates added in
between.

This commit fixes that by retrieving the QSslConfiguration just after setting
the CA certificates in case an older QT version than 5.15 is used.
2020-08-11 23:06:25 +02:00
Robert Adam
0fbdbf13a4 FIX(server): Enforce max. packet size for UDPTunnel
Before this commit the packet size for packets sent through the
UDPTunnel was not checked for whether it exceeded the maximum allowed
size. This might open Mumble for attacks of some sort as the code
usually expects the packets to be of at most that size.
2020-08-02 17:15:57 +02:00
Robert Adam
28c3a62acf FIX(server): Don't allow poslen > len
This case can crash the server as the calculated buffer length without
positional data (which is the normal case) is negative (len - poslen).
2020-08-02 17:14:51 +02:00
Robert Adam
30b67b76eb
Merge pull request #4344: FEAT(server): Allow loading welcome text from file
This allows specifying welcometextfile in murmur.ini. If no welcometext
is set in the ini-file, the welcome text is loaded from the file.

Fixes #3723
2020-07-14 17:57:05 +02:00
Popkornium18
39e12d3325 FEAT(server): Allow loading welcome text from file
This allows specifying welcometextfile in murmur.ini. If no welcometext
is set in the ini-file, the welcome text is loaded from the file.

Fixes #3723
2020-07-08 20:10:32 +02:00
Robert Adam
9d244227aa
Merge pull request #4147: FEAT(server): Add rememberduration option
This option allows to set a threshold on how long a user's channel
should be remembered. This is useful for scenarios where users usually
don't want their channel to be remembered by the server unless they had
a disconnect (aka have ot re-connect after a short period of time).

Implements #4143
2020-07-08 19:21:27 +02:00
Terry Geng
8de96f5073
FIX(cert, mac): Avoid adding key pairs into system's keychain of MacOS.
One unexpected behavior of Qt's SSL backend is: it will add the key pair
it uses in a connection into the default keychain, and when access the private
key afterwards, a pop up will show up asking for user's permission.
In some case (OS X 10.15.5), this pop up will be suppressed somehow and no private
key is returned.
This env variable will avoid Qt directly adding the key pair into the default keychain,
using a temporary keychain instead.
See #4298 and https://codereview.qt-project.org/c/qt/qtbase/+/184243

Fixes #4298
2020-07-08 22:39:44 +08:00
deluxghost
13b85a3ae2 FEAT(server): Add rememberduration option
This option allows to set a threshold on how long a user's channel
should be remembered. This is useful for scenarios where users usually
don't want their channel to be remembered by the server unless they had
a disconnect (aka have ot re-connect after a short period of time).

Implements #4143
2020-07-03 19:27:45 +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
Robert Adam
bdb12c6622 REFAC(deprecated): set certificates on QSslConfiguration
Previously the certificates were added to the QSslSocket object directly
but Qt 5.15 added this functionality to the QSslConfiguration object and
deprecated the ones in QSslSocket.
2020-06-11 10:23:29 +02:00
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