From 924532315435632389179a5d2a07e8afeb820637 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 11:16:53 +0100 Subject: [PATCH 01/18] Update Coturn_config_rotate.sh --- sources/Coturn_config_rotate.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/Coturn_config_rotate.sh b/sources/Coturn_config_rotate.sh index f1351d6..aa980ca 100644 --- a/sources/Coturn_config_rotate.sh +++ b/sources/Coturn_config_rotate.sh @@ -2,6 +2,8 @@ source /usr/share/yunohost/helpers +coturn_config_path="/etc/turnserver.conf" + external_IP_line="external-ip=__IPV4__,__IPV6__" public_ip4="$(curl ip.yunohost.org)" || true @@ -25,7 +27,7 @@ new_config_line=$(egrep "^external-ip=.*\$" "/etc/turnserver.conf") if [ "$old_config_line" != "$new_config_line" ] then - systemctl restart $app.service + systemctl restart __APP__.service fi exit 0 From 389466f6c527422e78085763bf273276eae1bddd Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 11:21:17 +0100 Subject: [PATCH 02/18] Closing ports --- scripts/remove | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/scripts/remove b/scripts/remove index 28f82b8..db413ff 100644 --- a/scripts/remove +++ b/scripts/remove @@ -85,21 +85,20 @@ ynh_secure_remove --file="/var/log/$app/" ynh_secure_remove --file="/var/lib/turn/" #================================================= -# CLOSE A PORT +# CLOSE PORTS #================================================= -closeport() { - local port=$1 - if yunohost firewall list | grep -q "\- $turnserver_tls_port$" - then - ynh_script_progression --message="Closing port $turnserver_tls_port port" - ynh_exec_warn_less yunohost firewall disallow Both $turnserver_tls_port - elif yunohost firewall list | grep -q "\- $turnserver_alt_tls_port$" - then - ynh_script_progression --message="Closing port $turnserver_alt_tls_port port" - ynh_exec_warn_less yunohost firewall disallow Both $turnserver_alt_tls_port - fi -} +if yunohost firewall list | grep -q "\- $turnserver_tls_port$" +then + ynh_script_progression --message="Closing port $turnserver_tls_port$..." --weight=1 + ynh_exec_warn_less yunohost firewall disallow Both $turnserver_tls_port +fi + +if yunohost firewall list | grep -q "\- $turnserver_alt_tls_port$" +then + ynh_script_progression --message="Closing port $turnserver_alt_tls_port$..." --weight=1 + ynh_exec_warn_less yunohost firewall disallow Both $turnserver_alt_tls_port +fi #================================================= # GENERIC FINALIZATION From ad6c3dadbfc847894aeba3d2d4c1620a0ec2efae Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 11:21:44 +0100 Subject: [PATCH 03/18] Update remove --- scripts/remove | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index db413ff..00a86e0 100644 --- a/scripts/remove +++ b/scripts/remove @@ -90,13 +90,13 @@ ynh_secure_remove --file="/var/lib/turn/" if yunohost firewall list | grep -q "\- $turnserver_tls_port$" then - ynh_script_progression --message="Closing port $turnserver_tls_port$..." --weight=1 + ynh_script_progression --message="Closing port $turnserver_tls_port..." --weight=1 ynh_exec_warn_less yunohost firewall disallow Both $turnserver_tls_port fi if yunohost firewall list | grep -q "\- $turnserver_alt_tls_port$" then - ynh_script_progression --message="Closing port $turnserver_alt_tls_port$..." --weight=1 + ynh_script_progression --message="Closing port $turnserver_alt_tls_port..." --weight=1 ynh_exec_warn_less yunohost firewall disallow Both $turnserver_alt_tls_port fi From a2db23ab782b7c88ae767c2e630b2a0156bfc82e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 11:37:28 +0100 Subject: [PATCH 04/18] Update manifest.json --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 05886ff..aa36401 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "coturn", "packaging_format": 1, "description": { - "en": "Videoconferencing server that is easy to deploy", - "fr": "Serveur de visioconférence facile à déployer" + "en": "VoIP media traffic NAT traversal server and gateway", + "fr": "Serveur et passerelle NAT du trafic média VoIP" }, "version": "4.5.1.1~ynh1", "url": "https://github.com/coturn/coturn", From d6af1d96e038453ba7364575fc9a6bcbfb552d65 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 11:56:38 +0100 Subject: [PATCH 05/18] Update install --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index b786bf0..ec8609d 100644 --- a/scripts/install +++ b/scripts/install @@ -179,6 +179,8 @@ ynh_use_logrotate --logfile "/var/log/$app" # Set permissions to app files chown root: -R $data_path chown -R turnserver:root /var/log/$app +chmod 770 $data_path/Coturn_config_rotate.sh +chmod 770 $coturn_config_path setfacl -R -m user:turnserver:rwX /var/log/$app #================================================= From fcb75a805dc4fe217f6d33a79ac0c2d64bb3cf72 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 12:07:59 +0100 Subject: [PATCH 06/18] Fix --- scripts/install | 1 - sources/Coturn_config_rotate.sh | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index ec8609d..0d51853 100644 --- a/scripts/install +++ b/scripts/install @@ -179,7 +179,6 @@ ynh_use_logrotate --logfile "/var/log/$app" # Set permissions to app files chown root: -R $data_path chown -R turnserver:root /var/log/$app -chmod 770 $data_path/Coturn_config_rotate.sh chmod 770 $coturn_config_path setfacl -R -m user:turnserver:rwX /var/log/$app diff --git a/sources/Coturn_config_rotate.sh b/sources/Coturn_config_rotate.sh index aa980ca..774c996 100644 --- a/sources/Coturn_config_rotate.sh +++ b/sources/Coturn_config_rotate.sh @@ -9,14 +9,18 @@ external_IP_line="external-ip=__IPV4__,__IPV6__" public_ip4="$(curl ip.yunohost.org)" || true public_ip6="$(curl ipv6.yunohost.org)" || true -if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4" +if [[ -n "$public_ip4" ]] && ynh_validate_ip 4 "$public_ip4" then - echo "external-ip=$public_ip4" >> "$coturn_config_path" + external_IP_line="${external_IP_line/'__IPV4__'/$public_ip4}" +else + external_IP_line="${external_IP_line/'__IPV4__,'/}" fi -if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6" +if [[ -n "$public_ip6" ]] && ynh_validate_ip 6 "$public_ip6" then - echo "external-ip=$public_ip6" >> "$coturn_config_path" + external_IP_line="${external_IP_line/'__IPV6__'/$public_ip6}" +else + external_IP_line="${external_IP_line/',__IPV6__'/}" fi old_config_line=$(egrep "^external-ip=.*\$" "/etc/turnserver.conf") From 94501cea19265aa90a9457f2b2cfbab49900a02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 25 Jan 2021 12:27:31 +0100 Subject: [PATCH 07/18] Update sources/Coturn_config_rotate.sh Co-authored-by: Kayou --- sources/Coturn_config_rotate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/Coturn_config_rotate.sh b/sources/Coturn_config_rotate.sh index 774c996..7f41aa4 100644 --- a/sources/Coturn_config_rotate.sh +++ b/sources/Coturn_config_rotate.sh @@ -9,7 +9,7 @@ external_IP_line="external-ip=__IPV4__,__IPV6__" public_ip4="$(curl ip.yunohost.org)" || true public_ip6="$(curl ipv6.yunohost.org)" || true -if [[ -n "$public_ip4" ]] && ynh_validate_ip 4 "$public_ip4" +if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4" then external_IP_line="${external_IP_line/'__IPV4__'/$public_ip4}" else From 41ec15555436eac9514af1b62856ed86ce902938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 25 Jan 2021 12:27:40 +0100 Subject: [PATCH 08/18] Update sources/Coturn_config_rotate.sh Co-authored-by: Kayou --- sources/Coturn_config_rotate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/Coturn_config_rotate.sh b/sources/Coturn_config_rotate.sh index 7f41aa4..2780efd 100644 --- a/sources/Coturn_config_rotate.sh +++ b/sources/Coturn_config_rotate.sh @@ -16,7 +16,7 @@ else external_IP_line="${external_IP_line/'__IPV4__,'/}" fi -if [[ -n "$public_ip6" ]] && ynh_validate_ip 6 "$public_ip6" +if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6" then external_IP_line="${external_IP_line/'__IPV6__'/$public_ip6}" else From e758f2bd74e8c8bb911cddc20100dcf570b863bf Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 12:32:36 +0100 Subject: [PATCH 09/18] Replace __APP__ --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 0d51853..5a45ea8 100644 --- a/scripts/install +++ b/scripts/install @@ -154,6 +154,7 @@ ynh_store_file_checksum --file="$coturn_config_path" data_path="/home/yunohost.app/$app" mkdir -p $data_path cp -f ../sources/Coturn_config_rotate.sh $data_path/ +ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file=$data_path/Coturn_config_rotate.sh chmod +x $data_path/Coturn_config_rotate.sh #================================================= From a11b173ec3c7963ad50f60d957a85b39147e3bef Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 13:45:30 +0100 Subject: [PATCH 10/18] Update install --- scripts/install | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 5a45ea8..4a9ff98 100644 --- a/scripts/install +++ b/scripts/install @@ -133,14 +133,19 @@ ynh_print_ON public_ip4="$(curl ip.yunohost.org)" || true public_ip6="$(curl ipv6.yunohost.org)" || true -if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4" -then - echo "external-ip=$public_ip4" >> "$coturn_config_path" -fi +# if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4" +# then +# echo "external-ip=$public_ip4" >> "$coturn_config_path" +# fi -if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6" +# if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6" +# then +# echo "external-ip=$public_ip6" >> "$coturn_config_path" +# fi + +if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" ) then - echo "external-ip=$public_ip6" >> "$coturn_config_path" + echo "external-ip=${public_ip4},${public_ip6}" >> "$coturn_config_path" fi ynh_store_file_checksum --file="$coturn_config_path" From 597b1b0af72bb202f7e09186ed9d231a22d1e4e8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 13:51:32 +0100 Subject: [PATCH 11/18] Update install --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index 4a9ff98..2cfd7a8 100644 --- a/scripts/install +++ b/scripts/install @@ -185,7 +185,6 @@ ynh_use_logrotate --logfile "/var/log/$app" # Set permissions to app files chown root: -R $data_path chown -R turnserver:root /var/log/$app -chmod 770 $coturn_config_path setfacl -R -m user:turnserver:rwX /var/log/$app #================================================= From b4e6b1476673327f20d0542b62e2bf82eda27bc4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 13:58:38 +0100 Subject: [PATCH 12/18] Update remove --- scripts/remove | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/remove b/scripts/remove index 00a86e0..86255eb 100644 --- a/scripts/remove +++ b/scripts/remove @@ -75,6 +75,7 @@ ynh_secure_remove --file="/home/yunohost.app/$app" #================================================= # REMOVE CRON JOB #================================================= + # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" @@ -108,6 +109,7 @@ fi ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user +userdel turnserver ssl-cert ynh_system_user_delete --username=turnserver #================================================= From db0993f14ae4c46d24b94cc4fe7cb3c2969f4867 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 14:06:45 +0100 Subject: [PATCH 13/18] Update remove --- scripts/remove | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/remove b/scripts/remove index 86255eb..736b4c4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -77,13 +77,13 @@ ynh_secure_remove --file="/home/yunohost.app/$app" #================================================= # Remove a cron file -ynh_secure_remove --file="/etc/cron.d/$app" +ynh_secure_remove --file=/etc/cron.d/$app # Remove the log files -ynh_secure_remove --file="/var/log/$app/" +ynh_secure_remove --file=/var/log/$app # Remove the sqlitedb file -ynh_secure_remove --file="/var/lib/turn/" +ynh_secure_remove --file=/var/lib/turn #================================================= # CLOSE PORTS @@ -109,7 +109,6 @@ fi ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -userdel turnserver ssl-cert ynh_system_user_delete --username=turnserver #================================================= From cc82330ef8bce4ac1abdd27efed5bad27e5385cc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 14:10:39 +0100 Subject: [PATCH 14/18] Update remove --- scripts/remove | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/remove b/scripts/remove index 736b4c4..5bfc634 100644 --- a/scripts/remove +++ b/scripts/remove @@ -109,6 +109,7 @@ fi ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user +deluser turnserver ssl-cert ynh_system_user_delete --username=turnserver #================================================= From 59f19c86926e324e285f5341eaf497b60fc9fe97 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 14:22:08 +0100 Subject: [PATCH 15/18] Update remove --- scripts/remove | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 5bfc634..b5e86a4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -83,7 +83,7 @@ ynh_secure_remove --file=/etc/cron.d/$app ynh_secure_remove --file=/var/log/$app # Remove the sqlitedb file -ynh_secure_remove --file=/var/lib/turn +#ynh_secure_remove --file=/var/lib/turn #================================================= # CLOSE PORTS From 97ad3b2739824c3d7f4cab490633a7bead72ebdc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 15:40:59 +0100 Subject: [PATCH 16/18] Update install --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 2cfd7a8..ae7bc56 100644 --- a/scripts/install +++ b/scripts/install @@ -145,7 +145,7 @@ public_ip6="$(curl ipv6.yunohost.org)" || true if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" ) then - echo "external-ip=${public_ip4},${public_ip6}" >> "$coturn_config_path" + echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path" fi ynh_store_file_checksum --file="$coturn_config_path" @@ -185,6 +185,7 @@ ynh_use_logrotate --logfile "/var/log/$app" # Set permissions to app files chown root: -R $data_path chown -R turnserver:root /var/log/$app +chown turnserver:root /etc/turnserver.conf setfacl -R -m user:turnserver:rwX /var/log/$app #================================================= From 369892e1633ac328d4dcdaefa9dd7bc0f93eb359 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 15:44:00 +0100 Subject: [PATCH 17/18] Update Coturn_config_rotate.sh --- sources/Coturn_config_rotate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/Coturn_config_rotate.sh b/sources/Coturn_config_rotate.sh index 2780efd..4d40a87 100644 --- a/sources/Coturn_config_rotate.sh +++ b/sources/Coturn_config_rotate.sh @@ -4,7 +4,7 @@ source /usr/share/yunohost/helpers coturn_config_path="/etc/turnserver.conf" -external_IP_line="external-ip=__IPV4__,__IPV6__" +external_IP_line="external-ip=__IPV4__/__IPV6__" public_ip4="$(curl ip.yunohost.org)" || true public_ip6="$(curl ipv6.yunohost.org)" || true From 13709ebd04731228069f5305bb5772d75623a0e3 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 25 Jan 2021 16:30:48 +0100 Subject: [PATCH 18/18] Update Coturn_config_rotate.sh --- sources/Coturn_config_rotate.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/Coturn_config_rotate.sh b/sources/Coturn_config_rotate.sh index 4d40a87..ce7d6c5 100644 --- a/sources/Coturn_config_rotate.sh +++ b/sources/Coturn_config_rotate.sh @@ -13,14 +13,14 @@ if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4" then external_IP_line="${external_IP_line/'__IPV4__'/$public_ip4}" else - external_IP_line="${external_IP_line/'__IPV4__,'/}" + external_IP_line="${external_IP_line/'__IPV4__/'/}" fi if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6" then external_IP_line="${external_IP_line/'__IPV6__'/$public_ip6}" else - external_IP_line="${external_IP_line/',__IPV6__'/}" + external_IP_line="${external_IP_line/'/__IPV6__'/}" fi old_config_line=$(egrep "^external-ip=.*\$" "/etc/turnserver.conf")