Table of Contents

, , , , ,

Monitoring turn & stun server

Sources

HowTo

Install coturn and disable it

apt -y install coturn
systemctl disable coturn
systemctl stop coturn

now turnutils_uclient can be used to check the connection to the turn server

turnutils_uclient -T -W <STATIC_AUTH_PASSWORD> <hostname.domain.tld>

0: Total connect time is 1
0: 2 connections are completed
0: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
0: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: start_mclient: msz=2, tot_send_msgs=5, tot_recv_msgs=5, tot_send_bytes ~ 500, tot_recv_bytes ~ 500
4: start_mclient: tot_send_msgs=10, tot_recv_msgs=10
4: start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000
4: Total transmit time is 5
4: Total lost packets 0 (0.000000%), total send dropped 0 (0.000000%)
4: Average round trip delay 43.400000 ms; min = 24 ms, max = 72 ms
4: Average jitter 18.800000 ms; min = 4 ms, max = 48 ms

timeout 5 turnutils_stunclient -p 3478 hostname.domain.tld

using netcat, something like this should work for stun (see SO Link):

stunserver=hostname.domain.tld; stunport=3478; listenport=20000; echo -ne "\x00\x01\x00\x00YOGO\x59\x4f\x47\x4fSTACFLOW" | nc -u -p $listenport $stunserver $stunport -w 1; timeout 5 nc -l -u -p $listenport | head -c 32 | tail -c 4 | hexdump -e '/1 "%u" "."' | grep -o ".*[^.]" && echo yes-no-problem || echo "Error in Tun server:$stunserver:$stunport"


~~DISCUSSION~~