From b0dc8f2c59ac5b252f3a48837f54049716040be6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 2 Aug 2021 19:03:22 +0200 Subject: [PATCH] Add rights --- scripts/restore | 19 ++++++++++++------- scripts/upgrade | 9 +++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/scripts/restore b/scripts/restore index abf39f5..234df6a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -51,6 +51,14 @@ test ! -d "$final_path" \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -58,13 +66,10 @@ ynh_script_progression --message="Restoring Metabase main directory..." --weight ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod +x $final_path/metabase.jar #================================================= # INSTALL DEPENDENCIES diff --git a/scripts/upgrade b/scripts/upgrade index 6143a9d..934d43e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) port=$(ynh_app_setting_get --app=$app --key=port) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -90,6 +89,11 @@ then ynh_setup_source --dest_dir="$final_path" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod +x $final_path/metabase.jar + #================================================= # NGINX CONFIGURATION #================================================= @@ -118,9 +122,6 @@ ynh_add_systemd_config # SECURE FILES AND DIRECTORIES #================================================= -chmod +x $final_path/metabase.jar - -chown -R $app: $final_path chown $app: /var/log/$app.log chmod 640 /etc/default/$app