From 99fddf5f2104824f3e9fda4c642177f0ef1d2eab Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 6 Nov 2017 18:52:19 +0000 Subject: [PATCH] Revert pleroma user permissions if an error occurs --- src/freedombone-app-pleroma | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/freedombone-app-pleroma b/src/freedombone-app-pleroma index af52c8e9..2c804a5c 100755 --- a/src/freedombone-app-pleroma +++ b/src/freedombone-app-pleroma @@ -201,6 +201,8 @@ function pleroma_create_database { if [ ${#PLEROMA_SECRET_KEY} -lt 50 ]; then PLEROMA_SECRET_KEY="$(create_password 30)$(create_password 30)" if [ ${#PLEROMA_SECRET_KEY} -lt 50 ]; then + run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;" + run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;" echo $'Pleroma secret key not created' exit 6782352 fi @@ -224,6 +226,8 @@ function pleroma_create_database { chown -R pleroma:pleroma * sudo -u pleroma mix local.rebar --force if [ ! "$?" = "0" ]; then + run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;" + run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;" echo $'mix local.rebar failed' exit 73528562 fi @@ -231,11 +235,15 @@ function pleroma_create_database { sudo -u pleroma mix deps.compile mimerl sudo -u pleroma mix ecto.create --force if [ ! "$?" = "0" ]; then + run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;" + run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;" echo $'mix ecto.create failed' exit 83653582 fi sudo -u pleroma mix ecto.migrate --force if [ ! "$?" = "0" ]; then + run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;" + run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;" echo $'mix ecto.migrate failed' exit 73752573 fi