From a77cd9d782f73050809bcebed0b55d1d5677a7a6 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 27 Jul 2020 12:15:56 -0500 Subject: [PATCH] [build] fix chmod errors (#72768) * inherit data permisions * tmp add all-platforms flag * Revert "inherit data permisions" This reverts commit ce30dd7b3aae1ee92acb3a2b49cc4ce681d0975c. * silent chmod, move to configure sectino * simplify chown and fix babel cache * rm empty lines * Revert "tmp add all-platforms flag" This reverts commit f1ae815ca9966b873fc735fde03fd8bfdc256aa4. Co-authored-by: Elastic Machine --- .../package_scripts/post_install.sh | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/dev/build/tasks/os_packages/package_scripts/post_install.sh b/src/dev/build/tasks/os_packages/package_scripts/post_install.sh index 3618e1f7e7546..c49b291d1a0c9 100644 --- a/src/dev/build/tasks/os_packages/package_scripts/post_install.sh +++ b/src/dev/build/tasks/os_packages/package_scripts/post_install.sh @@ -3,6 +3,22 @@ set -e export KBN_PATH_CONF=${KBN_PATH_CONF:-<%= configDir %>} +set_chmod() { + chmod -f 660 ${KBN_PATH_CONF}/kibana.yml || true + chmod -f 2750 <%= dataDir %> || true + chmod -f 2750 ${KBN_PATH_CONF} || true +} + +set_chown() { + chown -R <%= user %>:<%= group %> <%= dataDir %> + chown -R root:<%= group %> ${KBN_PATH_CONF} +} + +set_access() { + set_chmod + set_chown +} + case $1 in # Debian configure) @@ -14,6 +30,8 @@ case $1 in adduser --quiet --system --no-create-home --disabled-password \ --ingroup "<%= group %>" --shell /bin/false "<%= user %>" fi + + set_access ;; abort-deconfigure|abort-upgrade|abort-remove) ;; @@ -28,6 +46,8 @@ case $1 in useradd -r -g "<%= group %>" -M -s /sbin/nologin \ -c "kibana service user" "<%= user %>" fi + + set_access ;; *) @@ -35,13 +55,3 @@ case $1 in exit 1 ;; esac - -chown -R <%= user %>:<%= group %> <%= dataDir %> -chown -R <%= user %>:<%= group %> <%= optimizeDir %> -chmod 2750 <%= dataDir %> -chmod -R 2755 <%= dataDir %>/* - -chown :<%= group %> ${KBN_PATH_CONF} -chown :<%= group %> ${KBN_PATH_CONF}/kibana.yml -chmod 2750 ${KBN_PATH_CONF} -chmod 660 ${KBN_PATH_CONF}/kibana.yml