ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject [2/4] ambari git commit: AMBARI-18526. Ambari breaks sudo and user access if Ambari Agent misconfigured (dlysnichenko)
Date Thu, 06 Oct 2016 17:02:25 GMT
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/351b8f19
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/351b8f19
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/351b8f19

Branch: refs/heads/branch-2.5
Commit: 351b8f1954db7edf8523698bbb33cc480afc6096
Parents: 8678f46
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Thu Oct 6 19:57:25 2016 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Thu Oct 6 19:58:07 2016 +0300

----------------------------------------------------------------------
 ambari-agent/conf/unix/ambari-agent | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/351b8f19/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


Mime
View raw message