From d209033b9af6487fc522a67ca48ab6e775309eb1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 30 Jan 2018 10:32:30 +0000 Subject: [PATCH] Add avahi service for turn --- src/freedombone-utils-turn | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/freedombone-utils-turn b/src/freedombone-utils-turn index 49b8f5a9..91afbd84 100755 --- a/src/freedombone-utils-turn +++ b/src/freedombone-utils-turn @@ -48,6 +48,7 @@ function generate_turn_key { function remove_turn { firewall_remove ${TURN_HTTP_PORT} + firewall_remove ${TURN_PORT} systemctl stop turn systemctl disable turn if [ -f /etc/systemd/system/turn.service ]; then @@ -59,6 +60,7 @@ function remove_turn { rm -rf /var/lib/turn sed -i "/# TURN Server/,/# End of TURN Server/d" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} remove_onion_service turn ${TURN_ONION_PORT} + rm /etc/avahi/services/turn.service systemctl restart nginx } @@ -173,10 +175,26 @@ function install_turn { systemctl daemon-reload systemctl start turn - firewall_add turn ${TURN_HTTP_PORT} + firewall_add turn ${TURN_PORT} + firewall_add turn-http ${TURN_HTTP_PORT} TURN_ONION_HOSTNAME=$(add_onion_service turn ${TURN_PORT} ${TURN_ONION_PORT}) + echo '' > /etc/avahi/services/turn.service + echo '' >> /etc/avahi/services/turn.service + echo '' >> /etc/avahi/services/turn.service + echo ' %h TURN' >> /etc/avahi/services/turn.service + echo ' ' >> /etc/avahi/services/turn.service + echo ' _turn._tcp' >> /etc/avahi/services/turn.service + echo " $TURN_PORT" >> /etc/avahi/services/turn.service + echo ' ' >> /etc/avahi/services/turn.service + echo ' ' >> /etc/avahi/services/turn.service + echo ' _turn._udp' >> /etc/avahi/services/turn.service + echo " $TURN_PORT" >> /etc/avahi/services/turn.service + echo ' ' >> /etc/avahi/services/turn.service + echo '' >> /etc/avahi/services/turn.service + + systemctl restart avahi-daemon systemctl restart nginx }