Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuration CoTurn on Ubuntu not working

I don't get any candidates while testing my STUN & TURN server (CoTurn) with Trickle ICE on a MacBook 10.12.6 using Chrome 62.0.3202.89:

https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/

with:

stun:<ip-adres>:3478
turn:<ip-adres>:3478 [username:test]    

On Digital Ocean I created a droplet Ubuntu 16.04.3 x64 and installed CoTurn version 4.5.0.3 doing:

sudo apt-get update
sudo apt-get install coturn

By default the firewall is inactive.

Next, I edited sudo vi /etc/turnserver.conf and give the following options:

fingerprint
lt-cred-mech
user=username:test
realm=<ip-adres>
listening-ip=<ip-adres>
relay-ip=<ip-adres>
external-ip=<ip-adres>

Next, I edit sudo vi /etc/default/coturn and uncomment the option:

TURNSERVER_ENABLED=1

Then I start the Coturn daemon:

sudo systemctl start coturn
sudo systemctl status coturn

This gives the output:

● coturn.service - LSB: coturn TURN Server
   Loaded: loaded (/etc/init.d/coturn; bad; vendor preset: enabled)
   Active: active (exited) since Sat 2017-11-11 20:27:10 UTC; 52s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1386 ExecStart=/etc/init.d/coturn start (code=exited, status=0/SUCCESS)
    Tasks: 0
   Memory: 0B
      CPU: 0

Nov 11 20:27:10 coturn systemd[1]: Starting LSB: coturn TURN Server...
Nov 11 20:27:10 coturn coturn[1386]:  * coturn disabled in /etc/default/coturn turnserver
Nov 11 20:27:10 coturn coturn[1386]:    ...done.
Nov 11 20:27:10 coturn coturn[1386]:  * See /etc/default/coturn for instructions on enabling turnserver
Nov 11 20:27:10 coturn coturn[1386]:    ...done.
Nov 11 20:27:10 coturn systemd[1]: Started LSB: coturn TURN Server.
Nov 11 20:27:53 coturn systemd[1]: Started LSB: coturn TURN Server.

Please help me, what is still needed here to let it work?

like image 334
Herman Fransen Avatar asked Nov 08 '17 20:11

Herman Fransen


1 Answers

Starting doesn't work:

sudo systemctl start coturn

This seems like a bug.

To fix this bug:

sudo systemctl edit --full coturn

Delete everything and paste this:

[Unit]  
Description=coturn  
Documentation=man:coturn(1) man:turnadmin(1) man:turnserver(1)
After=syslog.target network.target

[Service]
Type=forking
User=turnserver
Group=turnserver
RuntimeDirectory=turnserver
RuntimeDirectoryMode=0750
EnvironmentFile=/etc/default/coturn
PIDFile=/run/turnserver/turnserver.pid
ExecStart=/usr/bin/turnserver --daemon --pidfile /run/turnserver/turnserver.pid --syslog -c /etc/turnserver.conf $EXTRA_OPTIONS
Restart=on-abort
LimitCORE=infinity
LimitNOFILE=1000000
LimitNPROC=60000
LimitRTPRIO=infinity
LimitRTTIME=7000000
CPUSchedulingPolicy=other
UMask=0007

[Install]
WantedBy=multi-user.target

After modifying the unit file, I reload the systemd process itself to pick up my changes:

sudo systemctl daemon-reload

Now starting actual works:

sudo systemctl start coturn

To make it automatically restart at reboot:

sudo systemctl enable coturn
like image 90
Herman Fransen Avatar answered Nov 08 '22 19:11

Herman Fransen