From c7acda299d006fd3f82d6d87c5b4de39825cf52c Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Mon, 6 Feb 2017 09:40:19 +0100 Subject: [PATCH] [fix] Properly chmod installed files. Fixes #19 --- scripts/install | 4 +++- scripts/upgrade | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index d50c9da..5d11382 100644 --- a/scripts/install +++ b/scripts/install @@ -77,12 +77,14 @@ sed -i "s@{CALDAV_DOMAIN}@${caldav_domain}@g" "$conf_path" # Install files and set permissions sudo mv "$TMPDIR" "$DESTDIR" + sudo useradd -c "$app system account" \ -d /var/www/$app --system --user-group $app --shell /usr/sbin/nologin \ || ynh_die "Unable to create $app system account" # Protect source code against modifications -sudo chown -hR root: "$DESTDIR" +sudo find "${DESTDIR}" -type f -exec chown root:root {} \; -exec chmod 644 {} \; +sudo find "${DESTDIR}" -type d -exec chown root:root {} \; -exec chmod 755 {} \; # Only agendav user should write here sudo chown -hR $app: "${DESTDIR}/web/var/cache/"{profiler,twig} diff --git a/scripts/upgrade b/scripts/upgrade index 4a63481..df04fac 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -85,7 +85,8 @@ if ! id -u $app > /dev/null 2>&1 ; then fi # Protect source code against modifications -sudo chown -hR root: "$DESTDIR" +sudo find "${DESTDIR}" -type f -exec chown root:root {} \; -exec chmod 644 {} \; +sudo find "${DESTDIR}" -type d -exec chown root:root {} \; -exec chmod 755 {} \; # Only agendav user should write here sudo chown -hR $app: "${DESTDIR}/web/var/cache/"{profiler,twig}