From 7bed0cfb836e628044afea261ef2e5cabde1503d Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Tue, 28 Jan 2020 08:13:10 +0100 Subject: [PATCH 1/4] fix wrong user in hooks --- hooks/post_user_create | 3 ++- hooks/post_user_delete | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index 782d74b..1509e89 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,6 +1,7 @@ #!/bin/bash app="wallabag2" +user="wallabag2" # Retrieve arguments username=$1 @@ -14,5 +15,5 @@ user_pass=$(ynh_string_random) # Create the new user in Wallabag (cd "/var/www/$app" && \ - sudo sudo -u "www-data" php "bin/console" --no-interaction --env=prod \ + sudo -u "$user" php "bin/console" --no-interaction --env=prod \ fos:user:create "$username" "$user_email" "$user_pass") diff --git a/hooks/post_user_delete b/hooks/post_user_delete index 7420339..acda6ad 100644 --- a/hooks/post_user_delete +++ b/hooks/post_user_delete @@ -1,6 +1,7 @@ #!/bin/bash app="wallabag2" +user="wallabag2" # Retrieve arguments username=$1 @@ -8,5 +9,5 @@ purge=$2 # Deactivate the user from Wallabg (cd "/var/www/$app" && \ - sudo sudo -u "www-data" php "bin/console" --no-interaction --env=prod \ + sudo -u "$user" php "bin/console" --no-interaction --env=prod \ fos:user:deactivate "$username") From 6cfb7e2be7828e4233e353df175fb373b8e56007 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Sat, 21 Mar 2020 01:31:24 +0100 Subject: [PATCH 2/4] Fix hooks --- hooks/post_user_create | 4 ++-- hooks/post_user_delete | 4 ++-- scripts/install | 7 +++++++ scripts/upgrade | 7 +++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index 1509e89..40b0216 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,7 +1,7 @@ #!/bin/bash -app="wallabag2" -user="wallabag2" +app="__APP__" +user="__APP__" # Retrieve arguments username=$1 diff --git a/hooks/post_user_delete b/hooks/post_user_delete index acda6ad..6a39516 100644 --- a/hooks/post_user_delete +++ b/hooks/post_user_delete @@ -1,7 +1,7 @@ #!/bin/bash -app="wallabag2" -user="wallabag2" +app="__APP__" +user="__APP__" # Retrieve arguments username=$1 diff --git a/scripts/install b/scripts/install index 0a58263..1005880 100644 --- a/scripts/install +++ b/scripts/install @@ -167,6 +167,13 @@ chmod 600 $wb_conf chown -R $app: $final_path chmod 755 $final_path +#================================================= +# SETUP HOOKS +#================================================= + +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_create" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_delete" + #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 13fcb68..812e649 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -187,6 +187,13 @@ chmod 600 $wb_conf chown -R $app: $final_path chmod 755 $final_path +#================================================= +# SETUP HOOKS +#================================================= + +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_create" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_delete" + #================================================= # SETUP SSOWAT #================================================= From d06f1c97b1a076ad16392c508176980c6866d9ea Mon Sep 17 00:00:00 2001 From: Kayou Date: Sun, 5 Apr 2020 20:49:19 +0200 Subject: [PATCH 3/4] Update upgrade --- scripts/upgrade | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 812e649..01df566 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -180,8 +180,11 @@ fi # SECURE FILES AND DIRECTORIES #================================================= -# Restrict rights to Wallabag user only -chmod 600 $wb_conf +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + # Restrict rights to Wallabag user only + chmod 600 $wb_conf +fi # Set permissions to app files chown -R $app: $final_path From 1f600ce67f56b52f7cb517557c95852ab2eefd92 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Fri, 1 May 2020 15:10:55 +0200 Subject: [PATCH 4/4] Revert "Update upgrade" This reverts commit d06f1c97b1a076ad16392c508176980c6866d9ea. --- scripts/upgrade | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 01df566..812e649 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -180,11 +180,8 @@ fi # SECURE FILES AND DIRECTORIES #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - # Restrict rights to Wallabag user only - chmod 600 $wb_conf -fi +# Restrict rights to Wallabag user only +chmod 600 $wb_conf # Set permissions to app files chown -R $app: $final_path