From e81269e2ed1853634189b39054357003b8e2ba33 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 11:08:47 +0100 Subject: [PATCH 01/16] Add cron --- README.md | 2 +- conf/cron_coturn | 3 +++ scripts/_common.sh | 2 -- scripts/install | 21 +++++++++++++++++++++ scripts/remove | 15 ++++++++++++++- sources/Coturn_config_rotate.sh | 31 +++++++++++++++++++++++++++++++ 6 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 conf/cron_coturn create mode 100644 sources/Coturn_config_rotate.sh diff --git a/README.md b/README.md index 308fe88..6363e5c 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ How to configure this app: a plain file with SSH. For testing we can use Trickle-Ice testing tool. Go to [trickle-ice page](https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice) and enter following details. ``` -STUN or TURN URI : turn::5349 +TURN URI : turn::5349 TURN username: TURN password: ``` diff --git a/conf/cron_coturn b/conf/cron_coturn new file mode 100644 index 0000000..4fe0cc3 --- /dev/null +++ b/conf/cron_coturn @@ -0,0 +1,3 @@ +# Check if the IP as not changed at every 15th minute +# */15 * * * * root bash /__SCRIPT_PATH__/Coturn_config_rotate.sh; +*/15 * * * * __USER__ bash /__SCRIPT_PATH__/Coturn_config_rotate.sh; \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index b293f7c..1ab2257 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -15,7 +15,6 @@ pkg_dependencies="sqlite3 libsqlite3-dev coturn acl" # EXPERIMENTAL HELPERS #================================================= - # Send an email to inform the administrator # # usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type] @@ -152,4 +151,3 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service # Send the email to the recipients cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients" } - diff --git a/scripts/install b/scripts/install index 971deb1..a988000 100644 --- a/scripts/install +++ b/scripts/install @@ -146,6 +146,27 @@ fi ynh_store_file_checksum --file="$coturn_config_path" + +#================================================= +# ADD SCRIPT FOR COTURN CRON +#================================================= + +# WARNING : theses command are used in INSTALL, UPGRADE +# For any update do it in all files +script_path=/opt/yunohost/coturn +ynh_app_setting_set --app=$app --key=script_path --value=$script_path +mkdir $script_path +cp ../sources/Coturn_config_rotate.sh $script_path/Coturn_config_rotate.sh +chmod +x $script_path/Coturn_config_rotate.sh + +#================================================= +# SET COTURN CRON +#================================================= + +cp ../conf/cron_coturn /etc/cron.d/$app +ynh_replace_string --match_string="__USER__" --replace_string=turnserver --target_file=/etc/cron.d/$app +ynh_replace_string --match_string="__SCRIPT_PATH__" --replace_string=$script_path --target_file=/etc/cron.d/$app + #================================================= # SETUP LOGROTATE #================================================= diff --git a/scripts/remove b/scripts/remove index 4212dd4..50b141c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,6 +22,7 @@ turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name +script_path=$(ynh_app_setting_get --app=$app --key=script_path) #================================================= # STANDARD REMOVE @@ -42,7 +43,6 @@ fi ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 # Remove the dedicated systemd config -#ynh_remove_systemd_config ynh_remove_systemd_config #================================================= @@ -71,6 +71,19 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= # Remove the app-specific logrotate config ynh_remove_logrotate +#================================================= +# REMOVE SCRIPT +#================================================= + +# Remove coturn/Coturn_config_rotate.sh +ynh_secure_remove --file=$script_path + +#================================================= +# REMOVE CRON JOB +#================================================= + +ynh_secure_remove --file="/etc/cron.d/$app" + #================================================= # CLOSE A PORT #================================================= diff --git a/sources/Coturn_config_rotate.sh b/sources/Coturn_config_rotate.sh new file mode 100644 index 0000000..9ac92e4 --- /dev/null +++ b/sources/Coturn_config_rotate.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +source /usr/share/yunohost/helpers + +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" +then + echo "external-ip=$public_ip4" >> "$coturn_config_path" +fi + +if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6" +then + echo "external-ip=$public_ip6" >> "$coturn_config_path" +fi + +old_config_line=$(egrep "^external-ip=.*\$" "/etc/turnserver.conf") +ynh_replace_string "^external-ip=.*\$" "$external_IP_line" "/etc/turnserver.conf" +new_config_line=$(egrep "^external-ip=.*\$" "/etc/turnserver.conf") + +#setfacl -R -m user:turnserver:rX /etc/$app_instance + +if [ "$old_config_line" != "$new_config_line" ] +then + systemctl restart coturn.service +fi + +exit 0 From b3717cce49151d2a0d268194cd5d10568bd8d26e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 11:17:18 +0100 Subject: [PATCH 02/16] Fix --- manifest.json | 2 +- scripts/install | 18 +++++++++++++----- scripts/remove | 4 ++-- sources/Coturn_config_rotate.sh | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/manifest.json b/manifest.json index 6fcf136..05886ff 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "version": "4.5.1.1~ynh1", "url": "https://github.com/coturn/coturn", - "license": "MIT", + "license": "", "maintainer": { "name": "", "email": "" diff --git a/scripts/install b/scripts/install index a988000..d4b34d8 100644 --- a/scripts/install +++ b/scripts/install @@ -29,6 +29,17 @@ path_url="/" app=$YNH_APP_INSTANCE_NAME +#================================================= +# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS +#================================================= +ynh_script_progression --message="Validating installation parameters..." --weight=1 + +final_path=/opt/yunohost/$app +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" + +# Register (book) web path +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url + #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -153,11 +164,8 @@ ynh_store_file_checksum --file="$coturn_config_path" # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files -script_path=/opt/yunohost/coturn -ynh_app_setting_set --app=$app --key=script_path --value=$script_path -mkdir $script_path -cp ../sources/Coturn_config_rotate.sh $script_path/Coturn_config_rotate.sh -chmod +x $script_path/Coturn_config_rotate.sh +cp ../sources/Coturn_config_rotate.sh $final_path/Coturn_config_rotate.sh +chmod +x $final_path/Coturn_config_rotate.sh #================================================= # SET COTURN CRON diff --git a/scripts/remove b/scripts/remove index 50b141c..f6f0ff7 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,7 +22,7 @@ turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -script_path=$(ynh_app_setting_get --app=$app --key=script_path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE @@ -76,7 +76,7 @@ ynh_remove_logrotate #================================================= # Remove coturn/Coturn_config_rotate.sh -ynh_secure_remove --file=$script_path +ynh_secure_remove --file=$final_path #================================================= # REMOVE CRON JOB diff --git a/sources/Coturn_config_rotate.sh b/sources/Coturn_config_rotate.sh index 9ac92e4..f1351d6 100644 --- a/sources/Coturn_config_rotate.sh +++ b/sources/Coturn_config_rotate.sh @@ -25,7 +25,7 @@ new_config_line=$(egrep "^external-ip=.*\$" "/etc/turnserver.conf") if [ "$old_config_line" != "$new_config_line" ] then - systemctl restart coturn.service + systemctl restart $app.service fi exit 0 From be81d234c0d7736008ea5e65ae1395cd8df01bd9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 11:21:19 +0100 Subject: [PATCH 03/16] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index d4b34d8..8721211 100644 --- a/scripts/install +++ b/scripts/install @@ -164,7 +164,7 @@ ynh_store_file_checksum --file="$coturn_config_path" # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files -cp ../sources/Coturn_config_rotate.sh $final_path/Coturn_config_rotate.sh +cp ../sources/Coturn_config_rotate.sh $final_path/ chmod +x $final_path/Coturn_config_rotate.sh #================================================= From 560ef6284464f2c4ad865c724cfb0bba8e74c66c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 13:52:16 +0100 Subject: [PATCH 04/16] Update install --- scripts/install | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 8721211..fbf589c 100644 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" #admin=$YNH_APP_ARG_ADMIN +data_path="/home/yunohost.app/$app" app=$YNH_APP_INSTANCE_NAME @@ -47,6 +48,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=4 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=no_sso --value true #ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= @@ -164,14 +166,15 @@ ynh_store_file_checksum --file="$coturn_config_path" # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files -cp ../sources/Coturn_config_rotate.sh $final_path/ +mkdir -p $data_path +cp -f ../sources/Coturn_config_rotate.sh $data_path/ chmod +x $final_path/Coturn_config_rotate.sh #================================================= # SET COTURN CRON #================================================= -cp ../conf/cron_coturn /etc/cron.d/$app +cp -f ../conf/cron_coturn /etc/cron.d/$app ynh_replace_string --match_string="__USER__" --replace_string=turnserver --target_file=/etc/cron.d/$app ynh_replace_string --match_string="__SCRIPT_PATH__" --replace_string=$script_path --target_file=/etc/cron.d/$app @@ -189,6 +192,7 @@ ynh_use_logrotate #================================================= # Set permissions to app files +chown turnserver: -R $data_path #chown -R root /var/log/$app #hown -R root /etc/$app #chmod -R u=rwX,g=rX,o= /etc/$app From 0814e0847fa73235e91166b7b70b0a05954ca43f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 13:53:33 +0100 Subject: [PATCH 05/16] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index fbf589c..91ccd28 100644 --- a/scripts/install +++ b/scripts/install @@ -26,9 +26,9 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" #admin=$YNH_APP_ARG_ADMIN -data_path="/home/yunohost.app/$app" app=$YNH_APP_INSTANCE_NAME +data_path="/home/yunohost.app/$app" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS From f65860e5e6977d8873fad36222936346467932fc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 13:56:29 +0100 Subject: [PATCH 06/16] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 91ccd28..b2b2bf1 100644 --- a/scripts/install +++ b/scripts/install @@ -168,7 +168,7 @@ ynh_store_file_checksum --file="$coturn_config_path" # For any update do it in all files mkdir -p $data_path cp -f ../sources/Coturn_config_rotate.sh $data_path/ -chmod +x $final_path/Coturn_config_rotate.sh +chmod +x $data_path/Coturn_config_rotate.sh #================================================= # SET COTURN CRON From b5ebb58ba1fd9b307073dd07fa44ff8da737345e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 13:59:49 +0100 Subject: [PATCH 07/16] fix --- conf/cron_coturn | 2 +- scripts/install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/cron_coturn b/conf/cron_coturn index 4fe0cc3..648c18c 100644 --- a/conf/cron_coturn +++ b/conf/cron_coturn @@ -1,3 +1,3 @@ # Check if the IP as not changed at every 15th minute # */15 * * * * root bash /__SCRIPT_PATH__/Coturn_config_rotate.sh; -*/15 * * * * __USER__ bash /__SCRIPT_PATH__/Coturn_config_rotate.sh; \ No newline at end of file +*/15 * * * * __USER__ bash /__DATA_PATH__/Coturn_config_rotate.sh; \ No newline at end of file diff --git a/scripts/install b/scripts/install index b2b2bf1..6b30016 100644 --- a/scripts/install +++ b/scripts/install @@ -176,7 +176,7 @@ chmod +x $data_path/Coturn_config_rotate.sh cp -f ../conf/cron_coturn /etc/cron.d/$app ynh_replace_string --match_string="__USER__" --replace_string=turnserver --target_file=/etc/cron.d/$app -ynh_replace_string --match_string="__SCRIPT_PATH__" --replace_string=$script_path --target_file=/etc/cron.d/$app +ynh_replace_string --match_string="__DATA_PATH__" --replace_string=$data_path --target_file=/etc/cron.d/$app #================================================= # SETUP LOGROTATE From b2ee0e0fea39b0463aaa9697c6243aa3f146c818 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 14:08:04 +0100 Subject: [PATCH 08/16] Update remove --- scripts/remove | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index f6f0ff7..7ca3bef 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,7 +22,6 @@ turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE @@ -76,7 +75,7 @@ ynh_remove_logrotate #================================================= # Remove coturn/Coturn_config_rotate.sh -ynh_secure_remove --file=$final_path +ynh_secure_remove --file="/home/yunohost.app/$app" #================================================= # REMOVE CRON JOB @@ -110,6 +109,7 @@ ynh_script_progression --message="Removing the dedicated system user..." --weigh # Delete a system user deluser turnserver ssl-cert +ynh_system_user_delete --username=turnserver #================================================= # END OF SCRIPT From 794ff052de246c1f843b78340b6073a922ba3f8c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 14:13:18 +0100 Subject: [PATCH 09/16] Fix --- scripts/install | 4 +--- scripts/remove | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 6b30016..1286c80 100644 --- a/scripts/install +++ b/scripts/install @@ -25,10 +25,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" -#admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME -data_path="/home/yunohost.app/$app" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -49,7 +47,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=4 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=no_sso --value true -#ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= # CREATE A DH FILE @@ -166,6 +163,7 @@ ynh_store_file_checksum --file="$coturn_config_path" # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files +data_path="/home/yunohost.app/$app" mkdir -p $data_path cp -f ../sources/Coturn_config_rotate.sh $data_path/ chmod +x $data_path/Coturn_config_rotate.sh diff --git a/scripts/remove b/scripts/remove index 7ca3bef..ba03581 100644 --- a/scripts/remove +++ b/scripts/remove @@ -20,8 +20,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name #================================================= # STANDARD REMOVE @@ -108,7 +106,6 @@ closeport() { 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 1f335288e1277199c64efba391e56cbb3fd78b29 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 15:17:19 +0100 Subject: [PATCH 10/16] Update install --- scripts/install | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/scripts/install b/scripts/install index 1286c80..572e88f 100644 --- a/scripts/install +++ b/scripts/install @@ -28,17 +28,6 @@ path_url="/" app=$YNH_APP_INSTANCE_NAME -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -final_path=/opt/yunohost/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= From 05ec8a5eef14215899b921b0e6dc57ea762b8ec7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 15:17:52 +0100 Subject: [PATCH 11/16] Update remove --- scripts/remove | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index ba03581..ad05464 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,7 +17,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port) From e31670fbff3291b530a4a9dbcb3956ff4773dbab Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 15:20:38 +0100 Subject: [PATCH 12/16] Update install --- scripts/install | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index 572e88f..4ab0c46 100644 --- a/scripts/install +++ b/scripts/install @@ -180,11 +180,8 @@ ynh_use_logrotate # Set permissions to app files chown turnserver: -R $data_path -#chown -R root /var/log/$app -#hown -R root /etc/$app -#chmod -R u=rwX,g=rX,o= /etc/$app -#setfacl -R -m user:turnserver:rX /etc/$app -#setfacl -R -m user:turnserver:rwX /var/log/$app +chown -R root /var/log/$app +setfacl -R -m user:turnserver:rwX /var/log/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST From 0b82b583e936e8337e9b0959ee9b3a13f0975c79 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 15:32:35 +0100 Subject: [PATCH 13/16] Update remove --- scripts/remove | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/remove b/scripts/remove index ad05464..d0430a8 100644 --- a/scripts/remove +++ b/scripts/remove @@ -54,9 +54,7 @@ ynh_remove_app_dependencies #================================================= ynh_script_progression --message="Removing Coturn main directory..." --weight=2 -ynh_secure_remove --file=/var/log/$app - -ynh_secure_remove --file=/etc/turnserver.conf +ynh_secure_remove --file="/etc/turnserver.conf" mv /etc/turnserver.conf.orig /etc/turnserver.conf #================================================= @@ -77,9 +75,12 @@ ynh_secure_remove --file="/home/yunohost.app/$app" #================================================= # REMOVE CRON JOB #================================================= - +# Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" +# Remove the log files +ynh_secure_remove --file="/var/log/$app/" + #================================================= # CLOSE A PORT #================================================= From 4197b58b7bc55c913da72eedf786003eda586516 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 15:42:22 +0100 Subject: [PATCH 14/16] Fix --- conf/cron_coturn | 3 +-- scripts/install | 4 +--- scripts/remove | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/conf/cron_coturn b/conf/cron_coturn index 648c18c..89b54ba 100644 --- a/conf/cron_coturn +++ b/conf/cron_coturn @@ -1,3 +1,2 @@ # Check if the IP as not changed at every 15th minute -# */15 * * * * root bash /__SCRIPT_PATH__/Coturn_config_rotate.sh; -*/15 * * * * __USER__ bash /__DATA_PATH__/Coturn_config_rotate.sh; \ No newline at end of file +*/15 * * * * root bash /__DATA_PATH__/Coturn_config_rotate.sh; \ No newline at end of file diff --git a/scripts/install b/scripts/install index 4ab0c46..5ff9d20 100644 --- a/scripts/install +++ b/scripts/install @@ -145,7 +145,6 @@ fi ynh_store_file_checksum --file="$coturn_config_path" - #================================================= # ADD SCRIPT FOR COTURN CRON #================================================= @@ -162,7 +161,6 @@ chmod +x $data_path/Coturn_config_rotate.sh #================================================= cp -f ../conf/cron_coturn /etc/cron.d/$app -ynh_replace_string --match_string="__USER__" --replace_string=turnserver --target_file=/etc/cron.d/$app ynh_replace_string --match_string="__DATA_PATH__" --replace_string=$data_path --target_file=/etc/cron.d/$app #================================================= @@ -179,7 +177,7 @@ ynh_use_logrotate #================================================= # Set permissions to app files -chown turnserver: -R $data_path +chown root: -R $data_path chown -R root /var/log/$app setfacl -R -m user:turnserver:rwX /var/log/$app diff --git a/scripts/remove b/scripts/remove index d0430a8..1e2cf71 100644 --- a/scripts/remove +++ b/scripts/remove @@ -52,7 +52,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing Coturn main directory..." --weight=2 +ynh_script_progression --message="Removing Coturn configuration file..." --weight=2 ynh_secure_remove --file="/etc/turnserver.conf" mv /etc/turnserver.conf.orig /etc/turnserver.conf From ec171a291ef6f12f9cea09ea08081acd968d4f9b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 16:07:51 +0100 Subject: [PATCH 15/16] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 5ff9d20..b786bf0 100644 --- a/scripts/install +++ b/scripts/install @@ -168,7 +168,7 @@ ynh_replace_string --match_string="__DATA_PATH__" --replace_string=$data_path -- #================================================= ynh_script_progression --message="Configuring log rotation..." --weight=1 -ynh_use_logrotate +ynh_use_logrotate --logfile "/var/log/$app" #================================================= # GENERIC FINALIZATION @@ -178,7 +178,7 @@ ynh_use_logrotate # Set permissions to app files chown root: -R $data_path -chown -R root /var/log/$app +chown -R turnserver:root /var/log/$app setfacl -R -m user:turnserver:rwX /var/log/$app #================================================= From 35e2f58bd1555020b7f0726307eea0adf46989b9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 17:05:52 +0100 Subject: [PATCH 16/16] Update remove --- scripts/remove | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/remove b/scripts/remove index 1e2cf71..28f82b8 100644 --- a/scripts/remove +++ b/scripts/remove @@ -81,6 +81,9 @@ ynh_secure_remove --file="/etc/cron.d/$app" # Remove the log files ynh_secure_remove --file="/var/log/$app/" +# Remove the sqlitedb file +ynh_secure_remove --file="/var/lib/turn/" + #================================================= # CLOSE A PORT #=================================================