You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by zh...@apache.org on 2017/03/23 00:35:08 UTC

ranger git commit: RANGER-1470:The logic of the solr_for_audit_setup installer parsing the properites file is inconsistent with the other installers. It treated these attributes as environment variable. There are security risks in the solr_for_audit_setu

Repository: ranger
Updated Branches:
  refs/heads/master 683f1e3a6 -> a2291f0a8


RANGER-1470:The logic of the solr_for_audit_setup installer parsing the properites file is inconsistent with the other installers. It treated these attributes as environment variable. There are security risks in the solr_for_audit_setup installer.

Signed-off-by: zhangqiang2 <zh...@zte.com.cn>


Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/a2291f0a
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/a2291f0a
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/a2291f0a

Branch: refs/heads/master
Commit: a2291f0a821e9c51f4fb5779fae1eb5a9b13f733
Parents: 683f1e3
Author: peng.jianhua <pe...@zte.com.cn>
Authored: Wed Mar 22 03:16:41 2017 -0400
Committer: zhangqiang2 <zh...@zte.com.cn>
Committed: Wed Mar 22 20:34:32 2017 -0400

----------------------------------------------------------------------
 .../contrib/solr_for_audit_setup/setup.sh       | 33 +++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/a2291f0a/security-admin/contrib/solr_for_audit_setup/setup.sh
----------------------------------------------------------------------
diff --git a/security-admin/contrib/solr_for_audit_setup/setup.sh b/security-admin/contrib/solr_for_audit_setup/setup.sh
index c4a8817..99a3086 100755
--- a/security-admin/contrib/solr_for_audit_setup/setup.sh
+++ b/security-admin/contrib/solr_for_audit_setup/setup.sh
@@ -16,7 +16,38 @@
 
 #This script downloads Solr (optional) and sets up Solr for Ranger Audit Server
 curr_dir=`pwd`
-. ./install.properties
+PROPFILE=$PWD/install.properties
+
+if [ ! -f ${PROPFILE} ]
+then
+	echo "$PROPFILE file not found....!!";
+	exit 1;
+fi
+
+get_prop(){
+	validateProperty=$(sed '/^\#/d' $2 | grep "^$1\s*="  | tail -n 1) # for validation
+	if  test -z "$validateProperty" ; then log "[E] '$1' not found in $2 file while getting....!!"; exit 1; fi
+	value=$(echo $validateProperty | cut -d "=" -f2-)
+	echo $value
+}
+
+SOLR_INSTALL_FOLDER=$(get_prop 'SOLR_INSTALL_FOLDER' $PROPFILE)
+SOLR_RANGER_HOME=$(get_prop 'SOLR_RANGER_HOME' $PROPFILE)
+SOLR_RANGER_PORT=$(get_prop 'SOLR_RANGER_PORT' $PROPFILE)
+SOLR_DEPLOYMENT=$(get_prop 'SOLR_DEPLOYMENT' $PROPFILE)
+SOLR_RANGER_DATA_FOLDER=$(get_prop 'SOLR_RANGER_DATA_FOLDER' $PROPFILE)
+SOLR_ZK=$(get_prop 'SOLR_ZK' $PROPFILE)
+SOLR_USER=$(get_prop 'SOLR_USER' $PROPFILE)
+SOLR_RANGER_COLLECTION=$(get_prop 'SOLR_RANGER_COLLECTION' $PROPFILE)
+SOLR_INSTALL=$(get_prop 'SOLR_INSTALL' $PROPFILE)
+SOLR_DOWNLOAD_URL=$(get_prop 'SOLR_DOWNLOAD_URL' $PROPFILE)
+SOLR_LOG_FOLDER=$(get_prop 'SOLR_LOG_FOLDER' $PROPFILE)
+MAX_AUDIT_RETENTION_DAYS=$(get_prop 'MAX_AUDIT_RETENTION_DAYS' $PROPFILE)
+RANGER_AUDITS_DATA_FOLDER=$(get_prop 'RANGER_AUDITS_DATA_FOLDER' $PROPFILE)
+SOLR_MAX_MEM=$(get_prop 'SOLR_MAX_MEM' $PROPFILE)
+SOLR_HOST_URL=$(get_prop 'SOLR_HOST_URL' $PROPFILE)
+SOLR_SHARDS=$(get_prop 'SOLR_SHARDS' $PROPFILE)
+SOLR_REPLICATION=$(get_prop 'SOLR_REPLICATION' $PROPFILE)
 
 #Current timestamp
 ts=$(date +"%m%d%y%H%M%S")