Go to file
Paul Kramer d3e353fbb0 Fix memory corruption on socket close (#1113)
Fix memory corruption introduced by commit
c8663f4a91

If there was an unsuccessful session registration in
open_client_connection_session, it adds a timer (before it didn't).

Later during runtime, at session destruction, it removes the
client_socket in close_ioa_socket. Then the timer gets triggered and
runs the cleanup method client_to_be_allocated_timeout_handler and tries
to access the stored client_socket. This then fails as it already was
freed.

The fix just sets the client_socket pointer to null and then the timer
should detect this and not access already freed memory.

The issue affects version 4.6.0, 4.6.0-r0 and 4.6.0-r1.

Co-authored-by: Paul Kramer <paul.kramer@logmein.com>
2022-12-03 20:44:41 +01:00
.github Improve GitHub release notes of Docker image 2022-09-13 15:52:09 +03:00
cmake Add cmake 2021-02-26 09:02:50 +08:00
docker Upgrade Docker image to 4.6.0 Coturn version 2022-09-13 12:38:37 +03:00
examples Fix duplicate TCP flag in run_tests.sh script (#971) 2022-09-04 14:56:10 +02:00
man/man1 Merge branch 'sysvinit/toggle-username-labels-upstream' of github.com:wireapp/coturn into wireapp-sysvinit/toggle-username-labels-upstream 2022-07-29 09:47:17 +02:00
rpm Fixes #692 2021-01-18 10:31:25 +01:00
src Fix memory corruption on socket close (#1113) 2022-12-03 20:44:41 +01:00
turndb Add hash algorithm for key value to redis userdb schema 2021-01-14 09:57:10 -06:00
.dockerignore Avoid duplication via common rootfs/ dir 2021-04-20 10:36:52 +03:00
.gitignore Add 'debian' image and run as non-root 2021-04-01 17:41:55 +03:00
.travis.yml Remove trusty add focal 2021-05-08 06:39:35 +02:00
AUTHORS replace email address 2018-09-27 22:09:10 +02:00
ChangeLog Fix ChangeLog for 4.6.0 release (#976) 2022-09-13 12:34:00 +03:00
CMakeLists.txt Fix cmake build on macOS (#949) 2022-08-22 16:27:21 -07:00
configure Merge pull request #869 from micmac1/no-intl 2022-08-01 10:25:12 +02:00
INSTALL Modify INSTALL 2021-04-05 11:26:49 +08:00
LICENSE initial code import 2014-04-20 21:10:18 +00:00
LICENSE.OpenSSL initial code import 2014-04-20 21:10:18 +00:00
make-man.sh man pages util fixed 2017-02-20 01:10:38 -08:00
Makefile.in Move acme to new file 2020-12-15 13:04:11 +00:00
netarch.txt fix typo in netarch.txt 2018-09-04 08:02:42 +02:00
NOTE working on 4.4.5.4 2015-07-18 21:54:16 -07:00
postinstall.txt fix(doc): Updated copy on postinstall.txt 2018-05-14 16:32:32 -07:00
README.md Fix "enabeled" typo in README (#831) 2021-10-05 14:12:10 +03:00
README.turnadmin Update README to fix #658 2020-12-08 13:40:49 +01:00
README.turnserver Merge branch 'sysvinit/toggle-username-labels-upstream' of github.com:wireapp/coturn into wireapp-sysvinit/toggle-username-labels-upstream 2022-07-29 09:47:17 +02:00
README.turnutils Update README to fix #658 2020-12-08 13:40:49 +01:00
STATUS working on multi-tenant server based upon oauth 2015-09-14 00:16:13 -07:00
TODO TODO updated 2015-04-11 05:45:18 +00:00

This project evolved from rfc5766-turn-server project (https://code.google.com/p/rfc5766-turn-server/). There are many new advanced TURN specs which are going far beyond the original RFC 5766 document. This project takes the code of rfc5766-turn-server as the starter, and adds new advanced features to it.

Downloads page

Docker image

Wiki pages

Free open source implementation of TURN and STUN Server

The TURN Server is a VoIP media traffic NAT traversal server and gateway. It can be used as a general-purpose network traffic TURN server and gateway, too.

On-line management interface (over telnet or over HTTPS) for the TURN server is available.

The implementation also includes some extra experimental features.

Supported RFCs:

TURN specs:

STUN specs:

  • RFC 3489 - "classic" STUN
  • RFC 5389 - base "new" STUN specs
  • RFC 5769 - test vectors for STUN protocol testing
  • RFC 5780 - NAT behavior discovery support
  • RFC 7443 - ALPN support for STUN & TURN
  • RFC 7635 - oAuth third-party TURN/STUN authorization

Supported ICE and related specs:

  • RFC 5245 - ICE
  • RFC 5768 ICESIP
  • RFC 6336 ICEIANA Registry
  • RFC 6544 ICETCP
  • RFC 5928 - TURN Resolution Mechanism

The implementation fully supports the following client-to-TURN-server protocols:

Supported relay protocols:

  • UDP (per RFC 5766)
  • TCP (per RFC 6062)

Supported user databases (for user repository, with passwords or keys, if authentication is required):

  • SQLite
  • MySQL
  • PostgreSQL
  • Redis
  • MongoDB

Redis can also be used for status and statistics storage and notification.

By default a prometheus exporter endpoint is disabled, if it is enabled it will listen on port 9641 under path /metrics

Supported message integrity digest algorithms:

  • HMAC-SHA1, with MD5-hashed keys (as required by STUN and TURN standards)

Supported TURN authentication mechanisms:

  • 'classic' long-term credentials mechanism;
  • TURN REST API (a modification of the long-term mechanism, for time-limited secret-based authentication, for WebRTC applications: http://tools.ietf.org/html/draft-uberti-behave-turn-rest-00);
  • experimental third-party oAuth-based client authorization option;

When used as a part of an ICE solution, for VoIP connectivity, this TURN server can handle thousands simultaneous calls per CPU (when TURN protocol is used) or tens of thousands calls when only STUN protocol is used. For virtually unlimited scalability a load balancing scheme can be used. The load balancing can be implemented with the following tools (either one or a combination of them):

  • DNS SRV based load balancing;
  • built-in 300 ALTERNATE-SERVER mechanism (requires 300 response support by the TURN client);
  • network load-balancer server.

Traffic bandwidth limitation and congestion avoidance algorithms implemented.

The supported project target platforms are:

  • Linux (Debian, Ubuntu, Mint, CentOS, Fedora, Redhat, Amazon Linux, Arch Linux, OpenSUSE)
  • BSD (FreeBSD, NetBSD, OpenBSD, DragonFlyBSD)
  • Solaris 11
  • Mac OS X
  • Cygwin (for non-production R&D purposes)

Other server platforms can be supported by request.

Any client platform is supported, including Android, iOS, Linux, OS X, Windows, and Windows Phone.

This project can be successfully used on other *NIX platforms, too, but that is not officially supported.

The implementation is supposed to be simple, easy to install and configure. The project focuses on performance, scalability and simplicity. The aim is to provide an enterprise-grade TURN solution.

To achieve high performance and scalability, the TURN server is implemented with the following features:

  • High-performance industrial-strength Network IO engine libevent2 is used
  • Configurable multi-threading model implemented to allow full usage of available CPU resources (if OS allows multi-threading)
  • Multiple listening and relay addresses can be configured
  • Efficient memory model used
  • The TURN project code can be used in a custom proprietary networking environment. In the TURN server code, an abstract networking API is used. Only couple files in the project have to be re-written to plug-in the TURN server into a proprietary environment. With this project, only implementation for standard UNIX Networking/IO API is provided, but the user can implement any other environment. The TURN server code was originally developed for a high-performance proprietary corporate environment, then adopted for UNIX Networking API
  • The TURN server works as a user space process, without imposing any special requirements on the system

To download the TURN Server software, the client messaging library and the test programs, click the tab "Downloads".

Contact information:

https://groups.google.com/forum/#!forum/turn-server-project-rfc5766-turn-server

email:misi@majd.eu mom040267@gmail.com

Feedback is very welcome (bugs, issues, suggestions, stories, questions).

Volunteers are welcome, too.