From 363602eb4c25ac49d93fdd4a0b1801385893c0a0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 12 Jan 2021 19:15:36 +0100 Subject: [PATCH] Fix --- scripts/restore | 7 ++++++- scripts/upgrade | 30 +++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/scripts/restore b/scripts/restore index 620494b..c7cec04 100755 --- a/scripts/restore +++ b/scripts/restore @@ -73,8 +73,13 @@ adduser turnserver ssl-cert #================================================= # Restore permissions on app files +# Set permissions on app files chown -R $app: $final_path chmod -R 755 $final_path +chmod u=rwX,g=rX,o= -R /etc/$app +chmod 770 $final_path/Coturn_config_rotate.sh +setfacl -R -m user:turnserver:rX /etc/$app +setfacl -R -m user:turnserver:rwX /var/log/$app #================================================= # SPECIFIC RESTORATION @@ -135,7 +140,7 @@ ynh_print_ON # WARNING : these commands are used in INSTALL, UPGRADE # For any update do it in all files -coturn_config_path="/etc/matrix-$app/coturn.conf" +coturn_config_path="/etc/$app/coturn.conf" cp ../settings/conf/turnserver.conf "$coturn_config_path" diff --git a/scripts/upgrade b/scripts/upgrade index dde48d6..be7ef87 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -106,7 +106,7 @@ fi # MULTINSTANCE SUPPORT #================================================= -if [ ! -e /etc/matrix-$app/coturn.conf ] +if [ ! -e /etc/$app/coturn.conf ] then ynh_script_progression --message="Creating an independant service for coturn..." --weight=1 @@ -187,6 +187,30 @@ ynh_store_file_checksum --file="$coturn_config_path" cp ../sources/Coturn_config_rotate.sh $final_path/ ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/Coturn_config_rotate.sh" +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +cp ../conf/passwd $final_path/data/passwd + +ynh_replace_string --match_string=__ADMIN__ --replace_string=$admin --target_file="$final_path/data/passwd" +ynh_replace_string --match_string=__PASSWORD__ --replace_string=$password --target_file="$final_path/data/passwd" + +mv -f $final_path/groups/groupname.json $final_path/groups/$group_name.json + +ynh_replace_string --match_string=__ADMIN__ --replace_string=$admin --target_file="$final_path/groups/$group_name.json" +ynh_replace_string --match_string=__PASSWORD__ --replace_string=$password --target_file="$final_path/groups/$group_name.json" + +cp ../conf/ice-servers.json $final_path/data/ice-servers.json + +ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="$final_path/data/ice-servers.json" +ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/data/ice-servers.json" +ynh_replace_string --match_string=__TLS_PORT__ --replace_string=$turnserver_tls_port --target_file="$final_path/data/ice-servers.json" +ynh_replace_string --match_string=__TLS_ALT_PORT__ --replace_string=$turnserver_alt_tls_port --target_file="$final_path/data/ice-servers.json" +ynh_print_OFF +ynh_replace_string --match_string=__TURNPWD__ --replace_string=$turnserver_pwd --target_file="$final_path/data/ice-servers.json" +ynh_print_ON + #================================================= # NGINX CONFIGURATION #================================================= @@ -230,8 +254,8 @@ chown -R $app: $final_path chmod -R 755 $final_path chmod u=rwX,g=rX,o= -R /etc/$app chmod 770 $final_path/Coturn_config_rotate.sh -setfacl -R -m user:turnserver:rX /etc/matrix-$app -setfacl -R -m user:turnserver:rwX /var/log/matrix-$app +setfacl -R -m user:turnserver:rX /etc/$app +setfacl -R -m user:turnserver:rwX /var/log/$app #================================================= # SETUP LOGROTATE