Background
The configuration of Nextcloud Talk mainly depends on your desired usage:
- As long as it shall be used only within one local network, nothing should be needed at all. Just verify that all browsers support the underlying WebRTC protocol (all famous ones do on current versions) and you should be good to go.
- Talk tries to establish a direct peer-to-peer (P2P) connection, thus on connections throughout the local network (behind a NAT/router), clients do not only need to know each others public IP, but their local IP as well. Processing this, is the job of a STUN server. As there is one preconfigured for Nextcloud Talk, still nothing need to be done.
- In some cases, e.g. in combination with firewalls or symmetric NAT a STUN server will not work as well, and then a so called TURN server is needed. Now no direct P2P connection is established, but all traffic is relayed through the TURN server, thus additional (at least internal) traffic and resources are needed.
- Nextcloud Talk will try direct P2P in the first place, use STUN if needed and TURN as last resort fallback. Thus to be most flexible and guarantee functionality of your Nextcloud Talk instance in all possible connection cases, you most properly want to setup a TURN server.
Install and setup coTURN as TURN server
-
Download/install
- On Debian and Ubuntu there are official repository packages available:
sudo apt install coturn
- For Fedora, an official package it is planned, as far as I can see. For this and other cases check out: Downloads Ā· coturn/coturn Wiki Ā· GitHub
- On Debian and Ubuntu there are official repository packages available:
-
Make coTURN run as daemon on startup
- On Debian and Ubuntu you just need to enable the deployed init.d service by adjusting the related environment variable:
sudo sed -i '/TURNSERVER_ENABLED/c\TURNSERVER_ENABLED=1' /etc/default/coturn
- On Debian Buster the most current package update implements a systemd unit, which does not use
/etc/default/coturn
but is enabled automatically after install. To check whether a systemd unit is available:ls -l /lib/systemd/system/coturn.service
- On other OS/distributions, if you installed coturn manually, you may want to setup an init.d/systemd unit or use another method to run the following during boot:
/path/to/turnserver -c /path/to/turnserver.conf -o
-
-o
starts the server in daemon mode,-c
defines the path to the config file.
- On Debian and Ubuntu you just need to enable the deployed init.d service by adjusting the related environment variable:
-
Configure turnserver.conf for usage with Nextcloud Talk
At last you need to adjust the TURN servers configuration file to work with Nextcloud Talk. On Debian and Ubuntu, it can be found at/etc/turnserver.conf
.-
Uncomment/adjust the following settings. Choose the listening port (default is
3478
) and an authentication secret, where a random hex is recommended:openssl rand -hex 32
:listening-port=<yourChosenPortNumber> fingerprint use-auth-secret static-auth-secret=<yourChosen/GeneratedSecret> realm=your.domain.org total-quota=100 bps-capacity=0 stale-nonce no-multicast-peers
-
(D)TLS is now supported by Nextcloud Talk but does not have any real security benefit. For more details see the changelog below.
If you need to use TLS for your firewall, provide the path to your certificate and key files:tls-listening-port=<yourChosenPortNumber> cert=/path/to/your/cert.pem pkey=/path/to/your/privkey.pem
Note that in case of TLS you only need to set
tls-listening-port
, otherwise onlylistening-port
. Nextcloud Talk uses a single port only, thus the alternative ports offered by the settings file can be ignored.For additional security, you can also configure the cipher list, a custom Diffie-Hellman file and/or disable TLSv1.0 + TLSv1.1. But again, it does not make much sense for my impression to handle it different here than for Nextcloud itself. Just decide how much compatibility you need and security/performance you want and configure webserver + coturn the same:
cipfer-list="..." dh-file=/path/to/your/dhparams.pem no-tlsv1 no-tlsv1_1
-
If your TURN server is running not behind a NAT, but with direct www connection and static public IP, than you can limit the IPs it listens and answers by setting those as
listening-ip
andrelay-ip
. On larger deployments it is recommended to run your TURN server on a dedicated machine that is directly accessible from the internet. -
If your TURN server is behind a NAT, instead in some cases you need to set
external-ip
to your public/external IP (i.e. outside your NAT). This of course only makes sense if you have a static IP instead of a dynamic one. -
The following settings can be used to adjust the logging behaviour. On SBCs with SDcards you may want to adjust this, as by default coturn logs veeery much . The config file explains everything very well:
no-stdout-log log-file=... syslog simple-log
-
-
sudo systemctl restart coturn
or corresponding restart method -
Configure Nextcloud Talk to use your TURN server
Go to Nextcloud admin panel > Talk settings. Btw. if you already have your own TURN server, you can and may want to use it as STUN server as well:STUN servers: your.domain.org:<yourChosenPortNumber> TURN server: your.domain.org:<yourChosenPortNumber> TURN secret: <yourChosen/GeneratedSecret> UDP and TCP
Do not add
http(s)://
here, this causes errors, the protocol is simply a different one. Alsoturn:
or something as prefix is not needed. Just enter the baredomain:port
. -
Port opening/forwarding
The TURN server on<yourChosenPortNumber>
needs to be available for all Talk participants, so you need to open it to the web and if your TURN server is running behind a NAT, forward it to the related machine.
What else
Nextcloud Talk is still based on the Spreed video calls app (just got renamed) and thus the Spreed.ME WebRTC solution. For this reason all guides about how to configure coturn for one of them, applies to all of them.
Further reference
- Use TURN server Ā· spreedbox/spreedbox Wiki Ā· GitHub
- [Question] Clarification about coturn settings Ā· Issue #667 Ā· nextcloud/spreed Ā· GitHub
Thanks to @fancycode and @mario for some clarifications about all of this and if you donāt mind, please review the HowTo for possible mistakes or wrong understandings.
Thanks as well to @sushidave for motivating me to write this HowTo .
ADMIN EDIT
If you need to use Talk with more than 5-10 users, you will need the Spreed High Performance Back-end from Nextcloud GmbH, see Talk - Nextcloud for more info
Changelog
-
Removed old
lt-cred-mech
andno-loopback-peers
settings entirely, updated TLS hints, as it is now supported by Nextcloud Talk, but removed very oldcipher-list
example. -
(D)TLS is currently not supported by Nextcloud Talk and does not have any real security benefit anyway:
-
lt-cred-mech
is required foruse-auth-secret
for coTURN versions below4.5.0.8
but causes a conflict warning and should be removed on coTURN4.5.0.8
or higher: Update the example config file: use-auth-secret overrides lt-cred-mech. Ā· coturn/coturn@84a875b Ā· GitHubRelated log entries:
Jan 19 23:08:20 my.domain.org turnserver[6712]: CONFIGURATION ALERT: You specified --lt-cred-mech and --use-auth-secret in the same time. Jan 19 23:08:20 my.domain.org turnserver[6712]: Be aware that you could not mix the username/password and the shared secret based auth methohds. Jan 19 23:08:20 my.domain.org turnserver[6712]: Shared secret overrides username/password based auth method. Check your configuration!
Related config file comments:
# Be aware that use-auth-secret overrides some part of lt-cred-mech. # Notice that this feature depends internally on lt-cred-mech, so if you set # use-auth-secret then it enables internally automatically lt-cred-mech option # like if you enable both. # # You can use only one of the to auth mechanisms in the same time because, # both mechanism use the username and password validation in different way. # # This way be aware that you can't use both auth mechanisms in the same time! # Use in config either the lt-cred-mech or the use-auth-secret # to avoid any confusion.
-
no-loopback-peers
has been deprecated with coTURNv4.5.1.0
and replaced withallow-loopback-peers
: Change loopback defaults Ā· coturn/coturn@8a60754 Ā· GitHubRelated config file comment:
# (To avoid any security issue that allowing loopback access may raise, # the no-loopback-peers option is replaced by allow-loopback-peers.) # # Allow it only for testing in a development environment! # In production it adds a possible security vulnerability, so for security reasons # it is not allowed using it together with empty cli-password.