1
0
mirror of https://github.com/coturn/coturn.git synced 2025-12-25 18:01:01 +01:00

754 Commits

Author SHA1 Message Date
z00316370
5cf657cdff Fix user quota release #786 2021-07-15 19:26:31 +08:00
Mészáros Mihály
6492f51a63
Merge pull request #767 from ggalperi/patch-1
Fix server->log_binding usage
2021-06-17 12:57:45 +02:00
Mark Hills
713bbefd5e Fix a segfault when a TLS context is not used
If the configuration contains entries such as:

  no-tlsv1
  no-tlsv1_1

then the SSL context is NULL. The previous code was simple enough that it
handled this case; the new code needs to deal with it explicitly.

[*] https://github.com/coturn/coturn/issues/770
2021-06-15 23:44:02 +02:00
Mészáros Mihály
7ad04a37d6 Not send SOFTWARE attr, if no_sotware_attribute on 2021-06-05 22:10:31 +02:00
Mészáros Mihály
708b83ea78 RESPONSE_ORIGIN attribute only if rfc5780 is on 2021-06-05 22:10:31 +02:00
Mészáros Mihály
54ef051844 Disable stun backward compatibility 2021-06-05 22:10:31 +02:00
Mészáros Mihály
eda11698f0 Add option no-rfc5780
To avoid any amplifiaction STUN binding attacks.
2021-06-05 22:10:31 +02:00
Mészáros Mihály
8c9622ad18 Add a check, don't SSL_CTX_up_ref a null pointer
This cause segmentation failure. Regression..
2021-06-05 22:10:31 +02:00
Mészáros Mihály
88f5119e1b Include ssl.h 2021-06-05 22:10:31 +02:00
ggalperi
0ac3fda6dd
Fix server->log_binding usage
The server->log_binding ptr should be dereferenced
2021-05-14 16:34:52 -04:00
Mészáros Mihály
d90c689c99
Merge pull request #739 from hills/ssl-reload-crashes
SSL reload has hidden bugs which cause crashes
2021-05-07 21:10:18 +02:00
KangLin
9f6defdac4 CMake: add -Wno-deprecated-declarations 2021-03-29 07:22:12 -07:00
KangLin
2110991cd6 CMake: add turnadmin 2021-03-28 21:32:47 -07:00
KangLin
73da474804 CMake: add runtime install 2021-03-28 20:19:15 -07:00
Mark Hills
8f1908d7bd A use-after-free can occur on the SSL_ctx on a busy system
When openssl_load_certificates() is called as a result of USR2
signal, it has the effect of SSL_free() on certificates.

But pointers to these certificates are borrowed by the ioa_engines
where they are used for new connections.

The tls_mutex when loading the certificates does not prevent this use
because it's released before despatching asynchronous events to each
ioa_engine asking them to pick up the new SSL context.

So there is a race; if a new connection arrives quickly after
openssl_load_certificates() but before the tls_ctx_update_ev.

This patch resolves this using OpenSSL's own fine grained locking.
The ioa_engines now 'copy' the SSL context (actually a refcounted copy)
2021-03-23 16:02:06 +00:00
Mark Hills
da5cda7761 Do not take a copy of the SSL context
When SSL certificates are renewed during runtime (via SIGUSR2),
e->dtls_ctx is replaced with a context based on the new certificate.
But this code continues to operate on its own borrowed pointer.

This is clearly visible using valgrind, but the bug is subtle and not
always noticed at runtime, possibly due to some fortunate re-use of
memory.

At the point of SSL_new():

==28413== Thread 5:
==28413== Invalid read of size 8
==28413==    at 0x4F6198F: SSL_new (in /lib/libssl.so.1.1)
==28413==    by 0x137A72: dtls_server_input_handler (dtls_listener.c:291)
==28413==    by 0x137A72: handle_udp_packet (dtls_listener.c:443)
==28413==    by 0x138153: udp_server_input_handler (dtls_listener.c:728)
==28413==    by 0x4FC499E: ??? (in /usr/lib/libevent_core-2.1.so.7.0.0)
==28413==    by 0x4FC50AF: event_base_loop (in /usr/lib/libevent_core-2.1.so.7.0.0)
==28413==    by 0x121F34: run_events (netengine.c:1579)
==28413==    by 0x121F34: run_general_relay_thread (netengine.c:1707)
==28413==    by 0x40517B6: start (pthread_create.c:195)
==28413==    by 0x40538EF: ??? (clone.s:22)
==28413==  Address 0x49a75e0 is 0 bytes inside a block of size 1,024 free'd
==28413==    at 0x48A074F: free (vg_replace_malloc.c:540)
==28413==    by 0x4F5F6F1: SSL_CTX_free (in /lib/libssl.so.1.1)
==28413==    by 0x11CEC4: set_ctx (mainrelay.c:3104)
==28413==    by 0x11D233: openssl_load_certificates (mainrelay.c:3173)
==28413==    by 0x11D328: reload_ssl_certs (mainrelay.c:3190)
==28413==    by 0x4FC4601: ??? (in /usr/lib/libevent_core-2.1.so.7.0.0)
==28413==    by 0x4FC50AF: event_base_loop (in /usr/lib/libevent_core-2.1.so.7.0.0)
==28413==    by 0x122582: run_events (netengine.c:1579)
==28413==    by 0x122582: run_listener_server (netengine.c:1603)
==28413==    by 0x110BB8: main (mainrelay.c:2536)
==28413==  Block was alloc'd at
==28413==    at 0x489F72A: malloc (vg_replace_malloc.c:309)
==28413==    by 0x4DFA2C6: CRYPTO_zalloc (in /lib/libcrypto.so.1.1)
==28413==    by 0x4F5F79E: SSL_CTX_new (in /lib/libssl.so.1.1)
==28413==    by 0x11CA80: set_ctx (mainrelay.c:2875)
==28413==    by 0x11D233: openssl_load_certificates (mainrelay.c:3173)
==28413==    by 0x110A19: openssl_setup (mainrelay.c:3139)
==28413==    by 0x110A19: main (mainrelay.c:2396)
==28413==
2021-03-23 16:02:06 +00:00
Mark Hills
bdf27616ba Do not mutate something which the DTLS listener server does not own
Multiple DTLS listener servers are created, and server->dtls_ctx is
the same object shared between them.

Set these callbacks once, and logically this is at the point where the
SSL context is created.
2021-03-23 16:02:06 +00:00
Mészáros Mihály
31c936d51d
Merge pull request #721 from KangLin/cmake
Add to support cmake
2021-03-23 09:31:59 +01:00
Mészáros Mihály
6a5d067d7c
Merge pull request #703 from hills/no-stdout-log
Restore no_stdout_log behaviour
2021-03-23 09:18:17 +01:00
Mészáros Mihály
2204778ce1 Replace keep-address-family with allocation-default-address-family 2021-03-12 23:05:18 +01:00
Mészáros Mihály
e2c99c6803 Remove extra new line in error 2021-03-11 22:15:22 +01:00
KangLin
677e5dc5d3 Add cmake 2021-02-26 09:02:50 +08:00
Mark Hills
9bcc898b05 Restore no_stdout_log behaviour
In commit 599a61ee this was removed, by accident it could seem.
2021-01-25 09:31:47 +00:00
Mészáros Mihály
e5d4e62dec Fix typo "finsihed" reported by Felipe Cecagno 2021-01-14 15:14:53 +01:00
Mészáros Mihály
cc637d2db9 Uneccessary semicolon 2021-01-14 15:06:53 +01:00
brevilo
a52df6cafb
Define OPENSSL_VERSION_1_1_1 on systems where it doesn't (yet) exist
Otherwise preprocessor logic will fail and cause incompatible pointer type issues (by using wrong callback API)
2021-01-13 01:54:25 +01:00
Mészáros Mihály
abfe1fd08d Merge branch 'advisory-fix-1' CVE-2020-26262 2021-01-10 20:59:14 +01:00
Mészáros Mihály
104ab83f09 Automatically notify systemd if compiled 2021-01-10 20:57:43 +01:00
Mészáros Mihály
e367fabb0e Fix typo 2021-01-10 17:20:40 +01:00
Mészáros Mihály
c1437902e2 Remove earlier deleted function definitions 2021-01-10 10:43:36 +01:00
Mészáros Mihály
f1d946c1b4 Refactoring Prometheus
* Fix c++ support
* Simplify: Remove session id/allocation
2021-01-10 00:32:49 +00:00
Mészáros Mihály
a28fee8cde Fix typo in acme 2021-01-08 09:19:33 +00:00
Mészáros Mihály
2edc14a193 Fixes #601 2021-01-07 21:38:43 +00:00
Mészáros Mihály
13082beae8 Fixes #600 2021-01-07 21:31:12 +00:00
Mészáros Mihály
9fcd86f3cc Fixes #621 2021-01-07 21:25:27 +00:00
Mészáros Mihály
ef7916842d Add systemd notification support 2021-01-07 17:51:34 +00:00
Mészáros Mihály
5b13fdd37b Fix: Read log options in first pass. Fixes #602 2021-01-07 10:33:14 +00:00
Mészáros Mihály
50ebef7a3f Fix g++ 2 errors and many warnings
Resolves #661 #654
2021-01-05 21:47:50 +00:00
Mészáros Mihály
288c486676
Merge pull request #672 from jelmd/acme_fix
fix acme wrt. security, redundancy, consistency
2021-01-05 11:42:03 +01:00
Mészáros Mihály
6ce463e8e2 Removed wiki, due it was outdated and redundant. 2021-01-05 09:57:16 +00:00
Mészáros Mihály
27b261eb58 Disable binding logging to avoid DoS attack
* Add new option log-binding
2021-01-05 09:55:55 +00:00
Mészáros Mihály
86b78aa6fa Tidy: fix spacing 2021-01-05 07:44:58 +00:00
Jens Elkner
8c99505614 fix acme wrt. security, redundancy, consistency 2020-12-31 16:39:00 +01:00
Mészáros Mihály
8dc5bbcb3b Tidy: too long line length 2020-12-22 17:05:42 +00:00
Mészáros Mihály
6101ebd51b external-ip private part to white list fixes#584 2020-12-22 16:58:00 +00:00
Mészáros Mihály
ae541958cd Tidy: remoe trailing space 2020-12-18 08:22:02 +00:00
Mészáros Mihály
2f790ec18b Tidy acme code 2020-12-18 08:06:25 +00:00
Mészáros Mihály
377e8f7687 Ugly Hack: Parse HTTP request 2020-12-18 08:05:56 +00:00
Mészáros Mihály
174d039c73 fix acme-redirect help 2020-12-15 13:56:21 +00:00
Mészáros Mihály
fa01cfeed6 Move acme to new file 2020-12-15 13:25:56 +00:00