@@ -18,15 +18,21 @@ For TURN relaying with `coturn` to work, it must be hosted on a server/endpoint
1818Hosting TURN behind a NAT (even with appropriate port forwarding) is known to cause issues
1919and to often not work.
2020
21- ## ` coturn ` Setup
21+ ## ` coturn ` setup
2222
2323### Initial installation
2424
2525The TURN daemon ` coturn ` is available from a variety of sources such as native package managers, or installation from source.
2626
2727#### Debian installation
2828
29- # apt install coturn
29+ Just install the debian package:
30+
31+ ``` sh
32+ apt install coturn
33+ ```
34+
35+ This will install and start a systemd service called ` coturn ` .
3036
3137#### Source installation
3238
@@ -63,38 +69,52 @@ The TURN daemon `coturn` is available from a variety of sources such as native p
63691 . Consider your security settings. TURN lets users request a relay which will
6470 connect to arbitrary IP addresses and ports. The following configuration is
6571 suggested as a minimum starting point:
66-
72+
6773 # VoIP traffic is all UDP. There is no reason to let users connect to arbitrary TCP endpoints via the relay.
6874 no-tcp-relay
69-
75+
7076 # don't let the relay ever try to connect to private IP address ranges within your network (if any)
7177 # given the turn server is likely behind your firewall, remember to include any privileged public IPs too.
7278 denied-peer-ip=10.0.0.0-10.255.255.255
7379 denied-peer-ip=192.168.0.0-192.168.255.255
7480 denied-peer-ip=172.16.0.0-172.31.255.255
75-
81+
7682 # special case the turn server itself so that client->TURN->TURN->client flows work
7783 allowed-peer-ip=10.0.0.1
78-
84+
7985 # consider whether you want to limit the quota of relayed streams per user (or total) to avoid risk of DoS.
8086 user-quota=12 # 4 streams per video call, so 12 streams = 3 simultaneous relayed calls per user.
8187 total-quota=1200
8288
83- Ideally coturn should refuse to relay traffic which isn't SRTP; see
84- < https://github.com/matrix-org/synapse/issues/2009 >
89+ 1 . Also consider supporting TLS/DTLS. To do this, add the following settings
90+ to ` turnserver.conf ` :
91+
92+ # TLS certificates, including intermediate certs.
93+ # For Let's Encrypt certificates, use `fullchain.pem` here.
94+ cert=/path/to/fullchain.pem
95+
96+ # TLS private key file
97+ pkey=/path/to/privkey.pem
8598
86991 . Ensure your firewall allows traffic into the TURN server on the ports
87- you've configured it to listen on (remember to allow both TCP and UDP TURN
88- traffic)
100+ you've configured it to listen on (By default: 3478 and 5349 for the TURN(s)
101+ traffic (remember to allow both TCP and UDP traffic), and ports 49152-65535
102+ for the UDP relay.)
103+
104+ 1 . (Re)start the turn server:
89105
90- 1 . If you've configured coturn to support TLS/DTLS, generate or import your
91- private key and certificate.
106+ * If you used the Debian package (or have set up a systemd unit yourself):
107+ ``` sh
108+ systemctl restart coturn
109+ ```
92110
93- 1 . Start the turn server :
111+ * If you installed from source :
94112
95- bin/turnserver -o
113+ ` ` ` sh
114+ bin/turnserver -o
115+ ` ` `
96116
97- ## synapse Setup
117+ # # Synapse setup
98118
99119Your home server configuration file needs the following extra keys:
100120
@@ -126,7 +146,14 @@ As an example, here is the relevant section of the config file for matrix.org:
126146
127147After updating the homeserver configuration, you must restart synapse:
128148
149+ * If you use synctl:
150+ ` ` ` sh
129151 cd /where/you/run/synapse
130152 ./synctl restart
153+ ` ` `
154+ * If you use systemd:
155+ ```
156+ systemctl restart synapse.service
157+ ```
131158
132159..and your Home Server now supports VoIP relaying!
0 commit comments