From c46db874fc0633004e14d9241f74aba0899804d2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 28 May 2021 23:43:59 +0200 Subject: [PATCH] Fix --- check_process | 3 --- scripts/install | 23 +++++------------------ scripts/restore | 16 ++++++---------- scripts/upgrade | 18 ++++++------------ 4 files changed, 17 insertions(+), 43 deletions(-) diff --git a/check_process b/check_process index 755a535..ce27054 100644 --- a/check_process +++ b/check_process @@ -1,6 +1,3 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - ;; Test complet ; Manifest domain="domain.tld" diff --git a/scripts/install b/scripts/install index 830c6fa..81413e7 100644 --- a/scripts/install +++ b/scripts/install @@ -90,14 +90,6 @@ ynh_script_progression --message="Configuring system user..." --weight=4 # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=4 - -# Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # CREATE A POSTQRESQL DATABASE #================================================= @@ -118,6 +110,11 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$final_path +# Set permissions to app files +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -164,16 +161,6 @@ ynh_store_file_checksum --file="$final_path/settings.json" ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json" -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" chmod 600 $final_path/credentials.json #================================================= diff --git a/scripts/restore b/scripts/restore index 0b24928..fab65b8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -73,6 +73,12 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" +# Restore permissions on app files +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod 600 $final_path/credentials.json + #================================================= # REINSTALL DEPENDENCIES #================================================= @@ -93,16 +99,6 @@ ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" -chmod 600 $final_path/credentials.json - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 6586d33..5c5d7e8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -104,6 +104,12 @@ then ynh_setup_source --dest_dir="$final_path" --keep="$final_path/settings.json $final_path/credentials.json" fi +# Set permissions on app files +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod 600 $final_path/credentials.json + #================================================= # NGINX CONFIGURATION #================================================= @@ -135,18 +141,6 @@ pushd $final_path || ynh_die ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm install --upgrade popd || ynh_die -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" -chmod 600 $final_path/credentials.json - #================================================= # SETUP SYSTEMD #=================================================