diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 22f4b68..d2830ff 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -50,8 +50,8 @@ listen.mode = 0600 ; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. -user = www-data -group = www-data +user = __USER__ +group = __USER__ ; Choose how the process manager will control the number of child processes. ; Possible Values: diff --git a/scripts/install b/scripts/install index f3feffb..0ac85b4 100644 --- a/scripts/install +++ b/scripts/install @@ -90,6 +90,13 @@ ynh_setup_source "$final_path" # Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# CREATE DEDICATED USER +#================================================= + +# Create a system user +ynh_system_user_create "$app" + #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -143,15 +150,15 @@ touch $final_path/admin/stdout.log #================================================= # Set permissions -chown -R www-data: $final_path +chown -R "$app": "$final_path" #================================================= # Run database initilization #================================================= -init_composer "www-data" "$final_path" +init_composer "$app" "$final_path" -sudo -u "www-data" php "$final_path/admin/migration.php" +sudo -u "$app" php "$final_path/admin/migration.php" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index ccefeb4..f9d1c93 100644 --- a/scripts/remove +++ b/scripts/remove @@ -55,3 +55,12 @@ ynh_remove_nginx_config # Remove the dedicated php-fpm config ynh_remove_fpm_config + +#================================================= +# GENERIC FINALIZATION +#================================================= +# REMOVE DEDICATED USER +#================================================= + +# Delete a system user +ynh_system_user_delete "$app" diff --git a/scripts/restore b/scripts/restore index 1e87551..99d0854 100644 --- a/scripts/restore +++ b/scripts/restore @@ -61,13 +61,19 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file "$final_path" +#================================================= +# CREATE DEDICATED USER +#================================================= + +# Create a system user +ynh_system_user_create "$app" + #================================================= # RESTORE USER RIGHTS #================================================= # Set permissions -chown -R www-data:www-data $final_path - +chown -R "$app": "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 62db76e..b152c15 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -104,6 +104,13 @@ ynh_setup_source "$final_path" # Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# CREATE DEDICATED USER +#================================================= + +# Create a system user +ynh_system_user_create "$app" + #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -158,15 +165,15 @@ touch $final_path/admin/stdout.log #================================================= # Set permissions to roundcube directory -chown -R www-data: $final_path +chown -R "$app": "$final_path" #================================================= # Run database initilization #================================================= -init_composer "www-data" "$final_path" +init_composer "$app" "$final_path" -sudo -u "www-data" php "$final_path/admin/migration.php" +sudo -u "$app" php "$final_path/admin/migration.php" #================================================= # SETUP SSOWAT