You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2016/10/06 17:02:26 UTC
[3/4] ambari git commit: AMBARI-18526. Ambari breaks sudo and user
access if Ambari Agent misconfigured (dlysnichenko)
AMBARI-18526. Ambari breaks sudo and user access if Ambari Agent misconfigured (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ffa1bbf6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ffa1bbf6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ffa1bbf6
Branch: refs/heads/branch-2.4
Commit: ffa1bbf6345859f6070b0636a318e20fa2ab918e
Parents: 9373517
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Oct 6 19:57:25 2016 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Thu Oct 6 19:58:45 2016 +0300
----------------------------------------------------------------------
ambari-agent/conf/unix/ambari-agent | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ffa1bbf6/ambari-agent/conf/unix/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent
index ccb0b7a..30897dd 100755
--- a/ambari-agent/conf/unix/ambari-agent
+++ b/ambari-agent/conf/unix/ambari-agent
@@ -39,6 +39,17 @@ get_agent_property() {
echo $value
}
+valid_path() {
+ value=${1:?}
+ value=$(readlink -m ${value})
+ if [ "$value" == "/" ]; then
+ echo "path $1 not valid" 1>&2
+ exit 1
+ fi
+ echo $value
+}
+
+
export PATH=/usr/sbin:/sbin:/usr/lib/ambari-server/*:$PATH
export AMBARI_CONF_DIR=/etc/ambari-server/conf:$PATH
@@ -46,8 +57,14 @@ export AMBARI_CONF_DIR=/etc/ambari-server/conf:$PATH
export PYTHONPATH=/usr/lib/python2.6/site-packages:${PYTHONPATH:-}
export AMBARI_PID_DIR=`get_agent_property piddir`
+export AMBARI_PID_DIR=`valid_path "${AMBARI_PID_DIR:?}"`
+export AMBARI_PID_DIR="${AMBARI_PID_DIR:?}"
export AMBARI_AGENT_LOG_DIR=`get_agent_property logdir`
+export AMBARI_AGENT_LOG_DIR=`valid_path "${AMBARI_AGENT_LOG_DIR:?}"`
+export AMBARI_AGENT_LOG_DIR="${AMBARI_AGENT_LOG_DIR:?}"
KEYSDIR=`get_agent_property keysdir`
+KEYSDIR=`valid_path "${KEYSDIR:?}"`
+KEYSDIR="${KEYSDIR:?}"
AMBARI_AGENT=ambari-agent
PYTHON_WRAP=/usr/bin/ambari-python-wrap