diff --git a/check_process b/check_process index 0658fdd..65abecf 100644 --- a/check_process +++ b/check_process @@ -1,7 +1,7 @@ ;; Complete test ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) + domain="domain.tld" + path="/path" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -13,7 +13,6 @@ upgrade=1 from_commit=7a99e018f12d91876c84efd04e0a4e7f178fdd80 backup_restore=1 multi_instance=1 - port_already_use=0 change_url=1 ;;; Upgrade options ; commit=7a99e018f12d91876c84efd04e0a4e7f178fdd80 diff --git a/manifest.json b/manifest.json index a71c616..6c3a738 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ }, "multi_instance": true, "requirements": { - "yunohost": ">= 4.1.0" + "yunohost": ">= 4.2.0" }, "services": [ "nginx", diff --git a/scripts/install b/scripts/install index 841d8eb..c1d7f7f 100644 --- a/scripts/install +++ b/scripts/install @@ -49,6 +49,14 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=2 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -58,6 +66,10 @@ 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" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -68,14 +80,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=2 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -95,16 +99,6 @@ for i in $final_path/bridges/*.php ; do echo $(basename $i) | sed "s|Bridge.php$||g" | tee -a $final_path/whitelist.txt done -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chown -R root: $final_path -chown -R $app: $final_path/cache - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/restore b/scripts/restore index 5ae68b5..c3b6500 100644 --- 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=1 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -58,21 +66,9 @@ ynh_script_progression --message="Restoring RSS-Bridge main directory..." --weig ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files -chown -R root: $final_path -chown -R $app: $final_path/cache +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 43f4d3e..55d2ce9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -53,6 +53,14 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -65,6 +73,10 @@ 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" + #================================================= # NGINX CONFIGURATION #================================================= @@ -73,14 +85,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -99,14 +103,6 @@ for i in $final_path/bridges/*.php ; do echo $(basename $i) | sed "s|Bridge.php$||g" | tee -a $final_path/whitelist.txt done -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R root: $final_path -chown -R $app: $final_path/cache - #================================================= # RELOAD NGINX #=================================================