1032 lines
36 KiB
HTML
1032 lines
36 KiB
HTML
<script>window.demoVersion = '2018.10.30';</script>
|
|
|
|
<!--
|
|
> Muaz Khan - https://github.com/muaz-khan
|
|
> MIT License - https://www.webrtc-experiment.com/licence/
|
|
> Experiments - https://github.com/muaz-khan/WebRTC-Experiment
|
|
-->
|
|
|
|
<!DOCTYPE html>
|
|
<html id="home" lang="en">
|
|
|
|
<head>
|
|
<title>TURN server installation Guide | Muaz Khan</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
|
<link rel="author" type="text/html" href="https://plus.google.com/+MuazKhan">
|
|
<meta name="author" content="Muaz Khan">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
<link rel="stylesheet" href="https://cdn.webrtc-experiment.com/style.css">
|
|
|
|
<style>
|
|
p { padding: .8em; }
|
|
|
|
li {
|
|
border-bottom: 1px solid rgb(189, 189, 189);
|
|
border-left: 1px solid rgb(189, 189, 189);
|
|
padding: .5em;
|
|
}
|
|
|
|
.image-container {
|
|
margin: 2em 0;
|
|
text-align: center;
|
|
}
|
|
|
|
.image-parent {
|
|
border: 2px solid black;
|
|
border-radius: 5px;
|
|
margin: 0 2em;
|
|
}
|
|
|
|
.image-parent img { width: 100%; }
|
|
|
|
.experiment h2 {
|
|
color: rgb(26, 86, 214);
|
|
line-height: 1.5;
|
|
}
|
|
|
|
li h2 {
|
|
color: rgb(223, 32, 101)!important;
|
|
}
|
|
|
|
p {
|
|
margin-top: 0!important;
|
|
margin-bottom: 0!important;
|
|
padding: 10px 10px!important;
|
|
}
|
|
|
|
blockquote {
|
|
margin: 10px;
|
|
border-radius: 10px;
|
|
background: rgb(253, 253, 253);
|
|
padding: 8px 20px;
|
|
font-size: 25px;
|
|
line-height: 1.5;
|
|
word-spacing: 5px;
|
|
}
|
|
|
|
section blockquote {
|
|
color: #EC008C;
|
|
}
|
|
|
|
h2, h1 {
|
|
font-size: 35px;
|
|
padding: 5px 10px;
|
|
border-bottom: 1px dotted #EC008C;
|
|
}
|
|
|
|
h2 a {
|
|
color: #EC008C;
|
|
}
|
|
|
|
h1 {
|
|
font-size: 40px;
|
|
color: #EC008C;
|
|
}
|
|
|
|
pre {
|
|
border: 0;
|
|
background: #fbfbfb!important;
|
|
margin: 0 -10px!important;
|
|
margin-top: 20px!important;
|
|
}
|
|
|
|
pre code {
|
|
font-size: 16px!important;
|
|
margin-top: -25px!important;
|
|
margin-left: -11px!important;
|
|
}
|
|
|
|
.hljs, .hljs-subst {
|
|
color: #2592bf!important;
|
|
}
|
|
|
|
.hljs-comment {
|
|
color: #fb471a!important;
|
|
}
|
|
|
|
.hljs-built_in, .hljs-bullet, .hljs-code, .hljs-addition {
|
|
color: #e0951d!important;
|
|
}
|
|
</style>
|
|
<!-- for HTML5 el styling -->
|
|
<script>
|
|
document.createElement('article');
|
|
document.createElement('footer');
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<article>
|
|
<header style="text-align: center;">
|
|
<h1>TURN server installation Guide</h1>
|
|
|
|
<p>
|
|
<a href="https://www.webrtc-experiment.com/">HOME</a>
|
|
<span> © </span>
|
|
<a href="http://www.MuazKhan.com/" target="_blank">Muaz Khan</a>
|
|
|
|
.
|
|
<a href="http://twitter.com/WebRTCWeb" target="_blank" title="Twitter profile for WebRTC Experiments">@WebRTCWeb</a>
|
|
|
|
.
|
|
<a href="https://github.com/muaz-khan?tab=repositories" target="_blank" title="Github Profile">Github</a>
|
|
|
|
.
|
|
<a href="https://github.com/muaz-khan/WebRTC-Experiment/issues?state=open" target="_blank">Latest issues</a>
|
|
|
|
.
|
|
<a href="https://github.com/muaz-khan/WebRTC-Experiment/commits/master" target="_blank">What's New?</a>
|
|
</p>
|
|
</header>
|
|
|
|
<section style="margin: 20px; text-align: center; color: red;">
|
|
<small id="demoVersion"></small>
|
|
<script>var date=new Date(window.demoVersion),month=date.toLocaleString("en-us",{month:"long"}),day=date.getUTCDate();day.toString().length<=9&&(day=day.toString().length == 1 ? "0"+day : day);var year=date.getUTCFullYear(); document.getElementById("demoVersion").innerHTML="Last Updated On: <time>"+month+" "+day+" "+year+"</time>";</script>
|
|
</section>
|
|
|
|
<blockquote class="inline" id="top">
|
|
This document is aimed to explain TURN server installation steps for different operating systems.
|
|
|
|
<br>
|
|
<ol>
|
|
<li>
|
|
<a href="#coturn">CoTURN installation on Ubuntu</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="#restund">restund installation on Ubuntu </a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="#centos">TURN installation on CentOS</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="#windows">TURN installation on Windows</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="#reTurnServer">reTurnServer installation on Ubuntu</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="#pion">Pion TURN server</a>
|
|
</li>
|
|
</ol>
|
|
|
|
<p>
|
|
You can test a TURN <a href="https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/" target="_blank">here LIVE</a> or use "apt-get install stun" and then "stun domain.com:port".
|
|
</p>
|
|
</blockquote>
|
|
|
|
<section class="experiment" id="coturn">
|
|
<h2 style="float: right;margin-top: 0px;display: block;border-left: 1px solid rgb(189, 189, 189);padding: 0px 10px 5px 10px;border-bottom-left-radius: 12px;cursor: pointer;background: #F9F9F9;"><a href="#top">Top</a></h2>
|
|
<h2>
|
|
<a href="#coturn">CoTURN installation on Ubuntu</a>
|
|
</h2>
|
|
|
|
<p>
|
|
<a href="https://github.com/muaz-khan/RTCMultiConnection/blob/master/dev/IceServersHandler.js">Example LIVE server</a>
|
|
</p>
|
|
|
|
<ol>
|
|
<li>
|
|
Make sure that you're using latest up-to-dated Ubuntu (TLS 14+)
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Find a useful FTP link for your region.</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
https://packages.debian.org/jessie/amd64/coturn/download
|
|
</code></pre>
|
|
<br>
|
|
Simply copy the link. Don't try any command yet.
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Modify sources.list file:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
vi /etc/apt/sources.list
|
|
</code></pre>
|
|
<br>
|
|
|
|
<h2>And add above FTP_domain in the sources-list. E.g.</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
# at the bottom of the sources.list file
|
|
|
|
# assuming that you found this domain:
|
|
# http://ftp.hk.debian.org/debian
|
|
|
|
deb http://ftp.hk.debian.org/debian jessie main
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Make sure you have installed "Aptitude":</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
# https://wiki.debian.org/Aptitude
|
|
|
|
# update-to-latest version
|
|
aptitude update
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>If "aptitude update" fails:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
# replace "8B48AD6246925553" and "7638D0442B90D010" with the error_key displayed on your OWN-screen
|
|
|
|
# GPG error: http://ftp.hk.debian.org jessie Release:
|
|
# The following signatures could not be verified because the public key is
|
|
# not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010 NO_PUBKEY CBF8D6FD518E17E1
|
|
|
|
# execute below commands
|
|
|
|
gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553
|
|
gpg -a --export 8B48AD6246925553 | apt-key add -
|
|
|
|
gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010
|
|
gpg -a --export 7638D0442B90D010 | apt-key add -
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Try "Aptitude" again if failed on initial try:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
aptitude update
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Now install "coturn" package using "aptitude":</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
# below command may require [sudo] privileges
|
|
aptitude install coturn
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Modify following file after "coturn" installation:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
vi /etc/turnserver.conf
|
|
</code></pre>
|
|
<br>
|
|
<h2>Remove all text from the file, and replace with this:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
# you can listen ports 3478 and 5349 instead of 80/443
|
|
listening-port=80
|
|
tls-listening-port=443
|
|
|
|
listening-ip=your-ip-address
|
|
|
|
relay-ip=your-ip-address
|
|
external-ip=your-ip-address
|
|
|
|
realm=yourdomain.com
|
|
server-name=yourdomain.com
|
|
|
|
lt-cred-mech
|
|
userdb=/etc/turnuserdb.conf
|
|
|
|
# use real-valid certificate/privatekey files
|
|
cert=/etc/ssl/certificate.pem
|
|
pkey=/etc/ssl/private.key
|
|
|
|
no-stdout-log
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Modify following file after modifying above "turnserver.conf":</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
vi /etc/turnuserdb.conf
|
|
</code></pre>
|
|
<br>
|
|
<h2>Remove all text from the file, and replace with this:</h2>
|
|
|
|
<br><br>
|
|
|
|
<pre>
|
|
yourName:yourPassword
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>
|
|
Instead of "turnuserdb.conf", you can try following as well:
|
|
</h2>
|
|
|
|
<pre><code class="bash">
|
|
# rquires: apt-get install sqlite3 libsqlite3-dev
|
|
# now: find / -name 'turndb'
|
|
|
|
# vi /etc/turnserver.conf
|
|
|
|
userdb=/var/lib/turn/turndb
|
|
|
|
# in this case, please add following:
|
|
# lt-cred-mech # remove or comment this one
|
|
oauth # add this
|
|
user=youruser:yourpassword # add this
|
|
|
|
# source: askubuntu.com/a/819264
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Now type following command:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
turnserver
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Try following if above "turnserver" command fails:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
# you can listen ports 3478 and 5349 instead of 80/443
|
|
|
|
lsof -n -i4TCP:80 | grep LISTEN
|
|
lsof -n -i4TCP:443 | grep LISTEN
|
|
</code></pre>
|
|
|
|
<br>
|
|
<h2>Kill "existing" processes using this command:</h2><br><br>
|
|
|
|
<pre>
|
|
kill processId
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Now type following command again and it should work:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
turnserver
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Make sure that ports 80/443 (or 3478/5349) are opened in the firewall:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
# you can listen ports 3478 and 5349 instead of 80/443
|
|
|
|
iptables -A INPUT -p udp --dport 80 -j ACCEPT
|
|
iptables -A INPUT -p udp --dport 443 -j ACCEPT
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Run following command:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
# pm2 is strongly recommended
|
|
# https://github.com/Unitech/pm2
|
|
pm2 start turnserver
|
|
pm2 save # after: pm2 startup
|
|
|
|
# if you do not want to use "pm2"
|
|
nohup turnserver > /dev/null 2>&1 &
|
|
|
|
# or simply
|
|
nohup turnserver &
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Now check all UDP+TCP ports:</h2><br><br>
|
|
|
|
<pre><code class="bash">
|
|
# recommended
|
|
netstat -tulpn
|
|
|
|
# or
|
|
netstat -nat | grep LISTEN
|
|
</code></pre>
|
|
|
|
<br>
|
|
You will see that port 80/443 is listened by turnserver (both for UDP/TCP).
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Otherwise (alternative coTURN installation solutions):</h2>
|
|
|
|
<pre><code class="bash">
|
|
// Please follow this link:
|
|
groups.google.com/d/msg/easyrtc/ypjJ5Yu3wZM/u5Lq6VNfabcJ
|
|
|
|
// or
|
|
apt-get install coturn
|
|
|
|
// or: stackoverflow.com/a/37290864
|
|
sudo -i # ignore if you already in admin mode
|
|
apt-get update && apt-get install libssl-dev libevent-dev libhiredis-dev make -y # install the dependencies
|
|
wget -O turn.tar.gz http://turnserver.open-sys.org/downloads/v4.5.0.3/turnserver-4.5.0.3.tar.gz # Download the source tar
|
|
tar -zxvf turn.tar.gz # unzip
|
|
cd turnserver-*
|
|
./configure
|
|
make && make install
|
|
|
|
// or: stackoverflow.com/a/52408246
|
|
</code></pre>
|
|
</li>
|
|
</ol>
|
|
|
|
|
|
</section>
|
|
|
|
<section class="experiment" id="restund">
|
|
<h2 style="float: right;margin-top: 0px;display: block;border-left: 1px solid rgb(189, 189, 189);padding: 0px 10px 5px 10px;border-bottom-left-radius: 12px;cursor: pointer;background: #F9F9F9;"><a href="#top">Top</a></h2>
|
|
<h2>
|
|
<a href="#restund">restund installation on Ubuntu</a> (<a href="https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/#deploying-stun-and-turn-servers" target="_blank">via</a>)
|
|
</h2>
|
|
|
|
<p>
|
|
"make" and "gcc" are required. <a href="https://github.com/muaz-khan/RTCMultiConnection/blob/master/dev/IceServersHandler.js#L100-L102">Example LIVE server</a>
|
|
</p>
|
|
|
|
<ol>
|
|
<li>
|
|
<h2>Download "re":</h2>
|
|
<pre><code class="bash">
|
|
mkdir /home/restund
|
|
cd /home/restund
|
|
|
|
# via: http://creytiv.com/pub/
|
|
wget http://webrtcweb.com/re-latest.tar.gz
|
|
tar zxvf re-latest.tar.gz
|
|
cd re-0.4.17
|
|
make
|
|
make install # "sudo" is preferred
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Download "restund":</h2>
|
|
<pre><code class="bash">
|
|
# via: http://www.creytiv.com/pub/
|
|
# choose latest version
|
|
# replace "0.4.12" with latesat version (06-Oct-2015)
|
|
cd ..
|
|
wget http://webrtcweb.com/restund-0.4.12.tar.gz
|
|
tar zxvf restund-0.4.12.tar.gz
|
|
cd restund-0.4.12
|
|
make
|
|
make install # "sudo" is preferred
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Modify "etc/restund.conf" file:</h2>
|
|
<p>
|
|
It will be located at: restund-0.4.12/etc/restund.conf
|
|
</p>
|
|
<pre><code class="bash">
|
|
# cd etc && vi restund.conf
|
|
# "etc" is a directory inside "restund-0.4.12"
|
|
|
|
udp_listen your-ip:4455
|
|
tcp_listen your-ip:5544 # different port than UDP
|
|
|
|
turn_relay_addr your-ip
|
|
|
|
debug yes
|
|
realm yourdomain.com
|
|
|
|
# you will get a HTTP server for stats
|
|
# example stats:
|
|
# Version: 0.4.12
|
|
# Built: Nov 10 2016 23:39:41
|
|
# Uptime: 21 hours 25 mins 56 secs
|
|
# LIVE Example: http://webrtcweb.com:4050/
|
|
|
|
status_udp_addr your-ip
|
|
status_udp_port 33000
|
|
status_http_addr your-ip
|
|
status_http_port 4050
|
|
|
|
# filedb (your username/password are stored in this file)
|
|
filedb_path /etc/restund.auth
|
|
|
|
# modules (STUN messages are processed in module loading order)
|
|
module_path /usr/local/lib/restund/modules
|
|
module stat.so
|
|
module binding.so
|
|
module auth.so
|
|
module turn.so
|
|
module filedb.so
|
|
module syslog.so
|
|
module status.so
|
|
|
|
syncinterval 600
|
|
auth_nonce_expiry 3600
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Modify "etc/restund.auth" file:</h2>
|
|
<p>
|
|
It will be located at: restund-0.4.12/etc/restund.auth
|
|
</p>
|
|
<pre><code class="bash">
|
|
# remove default credentials
|
|
</code></pre>
|
|
|
|
<p>
|
|
First of all, execute this command:
|
|
</p>
|
|
|
|
<pre><code class="bash">
|
|
cd ..
|
|
util/genha1.sh username yourdomain.com password
|
|
</code></pre>
|
|
<p>
|
|
Above command will print something. Copy whatever is printed; and paste inside "etc/restund.auth":
|
|
</p>
|
|
|
|
<pre><code class="bash">
|
|
cd etc
|
|
vi restund.auth
|
|
|
|
|
|
# copy/paste inside the "restund.auth" file
|
|
username:sha1
|
|
</code></pre>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Copy all "etc" files to "/etc/"</h2>
|
|
<pre><code class="bash">
|
|
cd ..
|
|
|
|
# move .conf and .auth files to /etc/ directory
|
|
cp ./etc/* /etc/
|
|
|
|
# or use absolute path:
|
|
# cp /home/restund/restund-0.4.12/etc/ /etc/
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Run the "restund" server</h2>
|
|
<pre><code class="bash">
|
|
restund
|
|
</code></pre>
|
|
<p>
|
|
Above command will print something like this:
|
|
</p>
|
|
|
|
<pre><code class="bash">
|
|
udp listen: your-ip:4455
|
|
tcp listen: your-ip:5544
|
|
stat: module loaded
|
|
binding: module loaded
|
|
auth: module loaded (nonce_expiry=3600s)
|
|
turn: lifetime=600 ext=your-ip ext6=::1 bsz=512
|
|
filedb: module loaded (/etc/restund.auth)
|
|
syslog: module loaded facility=24
|
|
status: module loaded (udp=your-ip:33000 http=your-ip:4050)
|
|
</code></pre>
|
|
<p>
|
|
You can open stats server here: http://your-ip:4050
|
|
</p>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>If webrtc access to "restund" fails:</h2>
|
|
<pre><code class="bash">
|
|
iptables -I INPUT 1 -i eth0 -p udp --dport 33000 -j ACCEPT
|
|
|
|
iptables -I INPUT 1 -i eth0 -p udp --dport 4455 -j ACCEPT
|
|
iptables -I INPUT 1 -i eth0 -p tcp --dport 4455 -j ACCEPT
|
|
|
|
iptables -I INPUT 1 -i eth0 -p udp --dport 5544 -j ACCEPT
|
|
iptables -I INPUT 1 -i eth0 -p tcp --dport 5544 -j ACCEPT
|
|
|
|
iptables -I INPUT 1 -i eth0 -p tcp --dport 4050 -j ACCEPT
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<p>
|
|
Now open this: http://your-ip.com:4050/
|
|
</p>
|
|
</li>
|
|
</ol>
|
|
</section>
|
|
|
|
<section class="experiment" id="centos">
|
|
<h2 style="float: right;margin-top: 0px;display: block;border-left: 1px solid rgb(189, 189, 189);padding: 0px 10px 5px 10px;border-bottom-left-radius: 12px;cursor: pointer;background: #F9F9F9;"><a href="#top">Top</a></h2>
|
|
<h2>
|
|
<a href="#centos">TURN installation on CentOS</a>
|
|
</h2>
|
|
<blockquote>
|
|
Use "sudo" if you see "permission-denied" errors.
|
|
</blockquote>
|
|
|
|
<ol>
|
|
<li>
|
|
<h2>First Step: Download & Install Prerequisite for CentOS</h2>
|
|
<pre><code class="bash">
|
|
yum install -y make gcc cc gcc-c++ wget
|
|
yum install -y openssl-devel libevent libevent-devel mysql-devel mysql-server
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Second Step: Download & Install LibEvent modules</h2>
|
|
<pre><code class="bash">
|
|
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
|
|
tar xvfz libevent-2.0.21-stable.tar.gz
|
|
cd libevent-2.0.21-stable && ./configure
|
|
make && make install && cd ..
|
|
|
|
# you can use "sudo" if permission-denied kind of erros occurred.
|
|
# sudo make && sudo make install && cd ..
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Third Step: <a href="https://code.google.com/p/rfc5766-turn-server/wiki/newDownloadsSite" target="_blank">Download & Install</a> TURN modules</h2>
|
|
<pre><code class="bash">
|
|
wget http://turnserver.open-sys.org/downloads/v3.2.3.8/turnserver-3.2.3.8.tar.gz
|
|
tar -xvzf turnserver-3.2.3.8.tar.gz
|
|
cd turnserver-3.2.3.8 && ./configure
|
|
make && make install
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Fifth Step: Configure "turnserver.conf" file</h2>
|
|
<pre><code class="bash">
|
|
vi /etc/turnserver/turnserver.conf
|
|
|
|
# setting static accounts
|
|
# Remember, "static" accounts are not dynamically checked by the turnserver process.
|
|
user=username:password
|
|
|
|
# listen ports
|
|
listening-port=2222
|
|
listening-ip=127.1.1
|
|
|
|
# Now press "insert" key; then "Esc" key
|
|
# Then type:
|
|
:wq #-- this command will save your settings and close turnserver.conf file
|
|
|
|
# if you don't want to save settings; and quite. Simply type:
|
|
:q
|
|
</code></pre>
|
|
You can:
|
|
<ol>
|
|
<li>
|
|
Use Only STUN
|
|
</li>
|
|
<li>
|
|
Use Only TURN
|
|
</li>
|
|
|
|
<li>
|
|
Use Both STUN and TURN
|
|
</li>
|
|
|
|
<li>
|
|
Discard requests from all SSL/TLS version of protocols
|
|
</li>
|
|
|
|
<li>
|
|
Use short-live credentials. Other authentication mechanisms coming soon in next few weeks.
|
|
</li>
|
|
|
|
<li>
|
|
You can disable DTLS and TLS.
|
|
</li>
|
|
|
|
<li>
|
|
You can set both static and dynamic accounts.
|
|
</li>
|
|
|
|
<li>
|
|
You can give anonymous access to TURN server as well.
|
|
</li>
|
|
|
|
<li>
|
|
You can set credentials for stun-only option as well; usually STUN-binding requests are anonymous.
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Sixth Step: Run TURN server instance</h2>
|
|
<pre><code class="bash">
|
|
cd /etc/turnserver/
|
|
|
|
turnserver -v -r ip:port -a -b turnuserdb.conf -c turnserver.conf -u turn-username -r ip:port -p turn-password
|
|
</code></pre>
|
|
<ol>
|
|
<li>
|
|
Replace "ip:port" with yours! E.g. 127.1.1:2222:
|
|
</li>
|
|
|
|
<li>
|
|
<pre><code class="bash">
|
|
turnserver -v -r 127.1.1:2222 -a -b turnuserdb.conf -c turnserver.conf -u turn-username -r 127.1.1:2222 -p turn-password
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
Replace "turn-username" with custom-username; and "turn-password" with custom-password.
|
|
</li>
|
|
|
|
<li>
|
|
<pre><code class="bash">
|
|
turnserver -v -r 127.1.1:2222 -a -b turnuserdb.conf -c turnserver.conf -u custom-username -r 127.1.1:2222 -p custom-password
|
|
</code></pre>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Last Step: "Permanently" run TURN server instance</h2>
|
|
<pre><code class="bash">
|
|
nohup turnserver -v -r ip:port -a -b turnuserdb.conf -c turnserver.conf -u turn-username -r ip:port -p turn-password &
|
|
</code></pre>
|
|
|
|
<ol>
|
|
<li>
|
|
You can see that the entire TURN execution command is placed between "nohup" and "&".
|
|
</li>
|
|
|
|
<li>
|
|
<pre><code class="bash">
|
|
<strong>nohup</strong> TURN-execution-command <strong>&</strong>
|
|
</code></pre>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
</section>
|
|
|
|
<section class="experiment" id="windows">
|
|
<h2 style="float: right;margin-top: 0px;display: block;border-left: 1px solid rgb(189, 189, 189);padding: 0px 10px 5px 10px;border-bottom-left-radius: 12px;cursor: pointer;background: #F9F9F9;"><a href="#top">Top</a></h2>
|
|
<h2>
|
|
<a href="#windows">TURN installation on Windows</a>
|
|
</h2>
|
|
<blockquote style="font-size: 16px; text-align: center;">
|
|
Alternatives: <a href="http://www.stunprotocol.org/" target="_blank">STUNTMAN</a> or <a href="http://www.codeproject.com/Articles/18492/STUN-Client" target="_blank">C# STUN Client</a> or <a href="https://github.com/pions/turn/releases" target="_blank">Pion TURN-server for Windows</a>.
|
|
</blockquote>
|
|
<p style="text-align: right;">Please check PION link above for a <b>Windows TURN client</b>.</p>
|
|
<p style="font-size: 11px; text-align: right;">Note: Below section is taken from <a href="http://www.slideshare.net/amiteshawa/web-rtc-media-stra" target="_blank">slideshare</a>; and its credit goes to @amiteshawa!</p>
|
|
<ol>
|
|
<li>
|
|
Install "Cygwin" application
|
|
</li>
|
|
|
|
<li>
|
|
Follow all steps from above section. E.g. install all dependencies; LibEvent and TURN modules.
|
|
</li>
|
|
|
|
<li>
|
|
You'll face some issues when invoking "./configure" command for TURN configuration:
|
|
|
|
<ol>
|
|
<li><strong>Missing libpq.a, hiredis, postgreSql</strong></li>
|
|
<li>You can ignore them, because these modules are optional</li>
|
|
</ol>
|
|
</li>
|
|
|
|
<li>
|
|
During "make" command invocation; you'll face error like "<strong>error: 'struct sockaddr_in' has no member named 'sin_len'</strong>"
|
|
</li>
|
|
|
|
<li>
|
|
Edit "na_turn_ioaddr.c" and comment line number "169":
|
|
<pre><code class="bash">
|
|
vi /turnserver-1.8.4.0/src/client/na_turn_ioaddr.c
|
|
|
|
# commenting line number #169
|
|
# addr->s4.sin_len = sizeof(struct sockaddr_in);
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
Now, "make" and "make install" commands for TURN modules installation will work.
|
|
</li>
|
|
|
|
<li>
|
|
Then copy "turnserver.conf" file from "../examples/etc/" directory to "/usr/local/etc/":
|
|
</li>
|
|
|
|
<li>
|
|
<pre><code class="bash">
|
|
cp /turnserver-1.8.4.0/examples/etc/turnserver.conf /usr/local/etc/
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
Now, you can follow "fifth" step from previous section to edit "turnserver.conf" for setting "username", "password", "listening-port" and "listening-ip".
|
|
</li>
|
|
|
|
</ol>
|
|
</section>
|
|
|
|
<!-- for psql: https://rtcquickstart.org/guide/multi/turn-reTurnServer.html -->
|
|
<section class="experiment" id="reTurnServer">
|
|
<h2 style="float: right;margin-top: 0px;display: block;border-left: 1px solid rgb(189, 189, 189);padding: 0px 10px 5px 10px;border-bottom-left-radius: 12px;cursor: pointer;background: #F9F9F9;"><a href="#top">Top</a></h2>
|
|
<h2>
|
|
<a href="#reTurnServer">reTurnServer installation on Ubuntu</a>
|
|
</h2>
|
|
|
|
<ol>
|
|
<li>
|
|
<h2>First Step: Install reTurnServer:</h2>
|
|
<pre><code class="bash">
|
|
# Ubuntu
|
|
apt-get install resiprocate-turn-server
|
|
|
|
# CentOS
|
|
yum install resiprocate-turn-server
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Second Step: Edit "/etc/reTurn/reTurnServer.config" file:</h2>
|
|
<pre><code class="bash">
|
|
TurnAddress = your-first-ip
|
|
AltStunAddress = your-second-ip
|
|
|
|
TurnPort = 3478
|
|
AltStunPort = 5349
|
|
|
|
AuthenticationRealm = domain.com
|
|
|
|
UserDatabaseFile = /etc/reTurn/users.txt
|
|
UserDatabaseHashedPasswords = true # required for HashString
|
|
|
|
# for more info:
|
|
# https://github.com/resiprocate/resiprocate/blob/master/reTurn/reTurnServer.config
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Next Step: Edit "/etc/reTurn/users.txt" file:</h2>
|
|
<pre><code class="bash">
|
|
# first of all, execute this command:
|
|
# echo -n username:domain.com:password | md5sum
|
|
|
|
# you will get a HASH string: 32 chars
|
|
# domain.com must match "AuthenticationRealm" above "reTurnServer.config"
|
|
username:AboveHashString:domain.com:authorized
|
|
|
|
# more info:
|
|
# https://github.com/resiprocate/resiprocate/blob/master/reTurn/users.txt
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
<h2>Last Step: ReStart reTurnServer:</h2>
|
|
<pre><code class="bash">
|
|
service resiprocate-turn-server restart
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
You can check ports and addresses reTurnServer is listenning on:
|
|
<pre><code class="bash">
|
|
netstat -nlp | grep reTurnServer
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
In your HTML-JavaScript file, you will use original password, NOT the HashString:
|
|
<pre><code class="bash">
|
|
iceServer => {
|
|
urls: 'turn:domain.com:3478',
|
|
credential: 'orignal-password', // NOT Hash
|
|
username: 'username'
|
|
}
|
|
</code></pre>
|
|
</li>
|
|
</ol>
|
|
</section>
|
|
|
|
<section class="experiment" id="pion">
|
|
<h2 style="float: right;margin-top: 0px;display: block;border-left: 1px solid rgb(189, 189, 189);padding: 0px 10px 5px 10px;border-bottom-left-radius: 12px;cursor: pointer;background: #F9F9F9;"><a href="#top">Top</a></h2>
|
|
<h2>
|
|
<a href="#windows">Pion TURN server</a>
|
|
</h2>
|
|
|
|
<p>
|
|
A simple extendable Golang TURN server for Windows, Linux, Darwin and FreeBSD.
|
|
</p>
|
|
<ol>
|
|
<li>
|
|
Create a new directory (optional):
|
|
<pre><code class="bash">
|
|
mkdir pions
|
|
cd pions
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
Download the TURN server's source: (replace "1.0.3" with <a href="https://github.com/pions/turn/releases" target="_blank">latest release</a>)
|
|
<pre><code class="bash">
|
|
wget -q https://github.com/pions/turn/releases/download/1.0.3/simple-turn-linux-amd64
|
|
|
|
# linux: simple-turn-linux-386 or simple-turn-linux-amd64
|
|
# darwin: simple-turn-darwin-amd64
|
|
# freebsd: simple-turn-freebsd-386 and simple-turn-freebsd-amd64
|
|
# windows: simple-turn-windows-386.exe and simple-turn-windows-amd64.exe
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
Give read-write permissions to the DIR:
|
|
<pre><code class="bash">
|
|
chmod +x simple-turn-linux-amd64
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
Set username, password and port: (using EXPORT commands)
|
|
<pre><code class="bash">
|
|
export USERS='username=password'
|
|
export REALM=domain.com
|
|
export UDP_PORT=3478
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
Now run the pions turn server:
|
|
<pre><code class="bash">
|
|
./simple-turn-linux-amd64
|
|
|
|
# or use nohup
|
|
nohup ./simple-turn-linux-amd64 &
|
|
</code></pre>
|
|
</li>
|
|
|
|
<li>
|
|
To check latest releases: <a href="https://github.com/pions/turn/releases" target="_blank">https://github.com/pions/turn/releases</a>
|
|
</li>
|
|
|
|
</ol>
|
|
</section>
|
|
|
|
<br />
|
|
<section class="experiment">
|
|
<small id="send-message"></small>
|
|
</section>
|
|
</article>
|
|
|
|
<a href="https://github.com/muaz-khan/WebRTC-Experiment" class="fork-left"></a>
|
|
|
|
<footer>
|
|
<p>
|
|
<a href="https://www.webrtc-experiment.com/">WebRTC Experiments</a>
|
|
© <a href="https://plus.google.com/+MuazKhan" rel="author" target="_blank">Muaz Khan</a>
|
|
<a href="mailto:muazkh@gmail.com" target="_blank">muazkh@gmail.com</a>
|
|
</p>
|
|
</footer>
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/default.min.css">
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
|
|
<script>hljs.initHighlightingOnLoad();</script>
|
|
|
|
<!-- commits.js is useless for you! -->
|
|
<script src="https://cdn.webrtc-experiment.com/common.js" async> </script>
|
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
|
<script>
|
|
$(function() {
|
|
$('a[href*="#"]:not([href="#"])').click(function() {
|
|
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
|
|
var target = $(this.hash);
|
|
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
|
|
if (target.length) {
|
|
$('html, body').animate({
|
|
scrollTop: target.offset().top
|
|
}, 1000);
|
|
// return false;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|