From 1094175c3bd08ecf5c83c91605e9fd1d02052108 Mon Sep 17 00:00:00 2001 From: Konstantinos Natsakis <5933427+knatsakis@users.noreply.github.com> Date: Mon, 11 Nov 2019 21:16:42 +0200 Subject: Ownership and permissions of /etc/netdata (#7244) * make install takes care of ownership and permissions of /etc/netdata Instead of netdata-installer.sh * Fix identation in Makefile.am files * netdata-installer.sh: Clearer variable assignment * netdata-installer.sh: Set /etc/netdata/netdata.conf ownership to root:root and permissions to 0644 * netdata-installer.sh: Set /etc/netdata/.environment permissions to 0644 * install-or-update.sh: Set permissions for /opt/netdata/etc/netdata.conf to 0644 * install-or-update.sh: Use ${NETDATA_PREFIX} more * install-or-update.sh: Improve indentation * install-or-update.sh: Do not create /opt/netdata/etc/netdata directories * debian/rules: /etc/netdata files and directories are now installed by make install * debian/rules: Properly copy files across directories When destination directory exists * netdata.spec.in: /etc/netdata ownership and permissions * Revert "Fix identation in Makefile.am files" This reverts commit 63fdb299b69152fda6984f81b0fef02f364c5efe. * Remove uninstall-local recipes from Makefile.am files * Removed superfluous whitespace and hash --- netdata-installer.sh | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'netdata-installer.sh') diff --git a/netdata-installer.sh b/netdata-installer.sh index b679bcc231..9f9704645a 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -590,7 +590,7 @@ if [ "${UID}" = "0" ]; then ROOT_USER="root" else NETDATA_USER="${USER}" - ROOT_USER="${NETDATA_USER}" + ROOT_USER="${USER}" fi NETDATA_GROUP="$(id -g -n "${NETDATA_USER}")" [ -z "${NETDATA_GROUP}" ] && NETDATA_GROUP="${NETDATA_USER}" @@ -649,19 +649,6 @@ if [ ! -d "${NETDATA_RUN_DIR}" ]; then run mkdir -p "${NETDATA_RUN_DIR}" || exit 1 fi -# --- conf dir ---- - -for x in "python.d" "charts.d" "node.d" "health.d" "statsd.d" "go.d" "custom-plugins.d" "ssl"; do - if [ ! -d "${NETDATA_USER_CONFIG_DIR}/${x}" ]; then - echo >&2 "Creating directory '${NETDATA_USER_CONFIG_DIR}/${x}'" - run mkdir -p "${NETDATA_USER_CONFIG_DIR}/${x}" || exit 1 - fi -done -run chown -R "${ROOT_USER}:${NETDATA_GROUP}" "${NETDATA_USER_CONFIG_DIR}" -run find "${NETDATA_USER_CONFIG_DIR}" -type f -exec chmod 0640 {} \; -run find "${NETDATA_USER_CONFIG_DIR}" -type d -exec chmod 0755 {} \; -run chmod 755 "${NETDATA_USER_CONFIG_DIR}/edit-config" - # --- stock conf dir ---- [ ! -d "${NETDATA_STOCK_CONFIG_DIR}" ] && mkdir -p "${NETDATA_STOCK_CONFIG_DIR}" @@ -920,10 +907,7 @@ else run_ok "netdata started!" create_netdata_conf "${NETDATA_PREFIX}/etc/netdata/netdata.conf" "http://localhost:${NETDATA_PORT}/netdata.conf" fi -if [ "${UID}" -eq 0 ]; then - run chown "${NETDATA_USER}" "${NETDATA_PREFIX}/etc/netdata/netdata.conf" -fi -run chmod 0664 "${NETDATA_PREFIX}/etc/netdata/netdata.conf" +run chmod 0644 "${NETDATA_PREFIX}/etc/netdata/netdata.conf" if [ "$(uname)" = "Linux" ]; then # ------------------------------------------------------------------------- @@ -1086,6 +1070,7 @@ RELEASE_CHANNEL="${RELEASE_CHANNEL}" IS_NETDATA_STATIC_BINARY="${IS_NETDATA_STATIC_BINARY}" NETDATA_LIB_DIR="${NETDATA_LIB_DIR}" EOF +run chmod 0644 "${NETDATA_USER_CONFIG_DIR}/.environment" echo >&2 "Setting netdata.tarball.checksum to 'new_installation'" cat < "${NETDATA_LIB_DIR}/netdata.tarball.checksum" -- cgit v1.2.3