ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dillido...@apache.org
Subject git commit: ARGUS-27: usersync installation fails when using comples user search filter
Date Wed, 27 Aug 2014 21:24:04 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master 0521c1426 -> b27ae69da


ARGUS-27: usersync installation fails when using comples user search filter


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

Branch: refs/heads/master
Commit: b27ae69da6a7ee311e48112bb36a662278d0cb35
Parents: 0521c14
Author: Dilli Dorai Arumugam <darumugam@hortonworks.com>
Authored: Tue Aug 26 17:31:28 2014 -0700
Committer: Dilli Dorai Arumugam <darumugam@hortonworks.com>
Committed: Wed Aug 27 14:22:42 2014 -0700

----------------------------------------------------------------------
 unixauthservice/scripts/install.sh | 196 +++++++++++++++-----------------
 unixauthservice/scripts/start.sh   |   1 +
 2 files changed, 95 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/b27ae69d/unixauthservice/scripts/install.sh
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/install.sh b/unixauthservice/scripts/install.sh
index 6377ba0..df36e00 100755
--- a/unixauthservice/scripts/install.sh
+++ b/unixauthservice/scripts/install.sh
@@ -1,33 +1,28 @@
 #!/bin/bash
 
-#
-# Ensure that the user is root
-#
-
 INSTALL_BASE=/usr/lib
 
 MOD_NAME="uxugsync"
 
-MY_ID=`id -u`
+INSTALL_DIR=${INSTALL_BASE}/${MOD_NAME}
 
+# Ensure that the user is root
+MY_ID=`id -u`
 if [ "${MY_ID}" -ne 0 ]
 then
-	echo "ERROR: You must run the installation as root user."
-	exit 1
+  echo "ERROR: You must run the installation as root user."
+  exit 1
 fi
 
+# Ensure JAVA_HOME is set
 if [ "${JAVA_HOME}" == "" ]
 then
-	echo "ERROR: JAVA_HOME environment property not defined, aborting installation"
-	exit 1
+  echo "ERROR: JAVA_HOME environment property not defined, aborting installation"
+  exit 2
 fi
 
-INSTALL_DIR=${INSTALL_BASE}/${MOD_NAME}
-
-#
-# Embed the configuration from install.properties to conf/unixauthservice.properties
-#
 
+# Grep configuration properties from install.properties
 cdir=`dirname $0`
 
 POLICY_MGR_URL=`grep '^[ \t]*POLICY_MGR_URL[ \t]*=' ${cdir}/install.properties | awk -F=
'{ print $2 }' | sed -e 's:[ \t]*::g'`
@@ -49,7 +44,7 @@ SYNC_LDAP_USER_SEARCH_SCOPE=`grep '^[ \t]*SYNC_LDAP_USER_SEARCH_SCOPE[ \t]*='
${
 
 SYNC_LDAP_USER_OBJECT_CLASS=`grep '^[ \t]*SYNC_LDAP_USER_OBJECT_CLASS[ \t]*=' ${cdir}/install.properties
| awk -F= '{ print $2 }' | sed -e 's:[ \t]*::g'`
 
-SYNC_LDAP_USER_SEARCH_FILTER=`grep '^[ \t]*SYNC_LDAP_USER_SEARCH_FILTER[ \t]*=' ${cdir}/install.properties
| sed -e 's:^[ \t]*SYNC_LDAP_SEARCH_FILTER[ \t]*=[ \t]*::'`
+SYNC_LDAP_USER_SEARCH_FILTER=`grep '^[ \t]*SYNC_LDAP_USER_SEARCH_FILTER[ \t]*=' ${cdir}/install.properties
| sed -e 's:^[ \t]*SYNC_LDAP_USER_SEARCH_FILTER[ \t]*=[ \t]*::'`
 
 SYNC_LDAP_USER_NAME_ATTRIBUTE=`grep '^[ \t]*SYNC_LDAP_USER_NAME_ATTRIBUTE[ \t]*=' ${cdir}/install.properties
| awk -F= '{ print $2 }' | sed -e 's:[ \t]*::g'`
 
@@ -91,7 +86,7 @@ then
   SYNC_SOURCE="com.xasecure.ldapusersync.process.LdapUserGroupBuilder"
 else
   echo "Unsupported value for SYNC_SOURCE: ${SYNC_SOURCE}, supported values: ldap, unix,
default: unix"
-  exit 2
+  exit 3
 fi
 
 
@@ -106,19 +101,19 @@ then
   if [ "${SYNC_LDAP_URL}" == "" ]
   then
     echo "SYNC_LDAP_URL must be specified when SYNC_SOURCE is ldap"
-    exit 3
+    exit 4
   fi
 
   if [ "${SYNC_LDAP_BIND_DN}" == "" ]
   then
     echo "SYNC_LDAP_BIND_DN must be specified when SYNC_SOURCE is ldap"
-    exit 4
+    exit 5
   fi
 
   if [ "${SYNC_LDAP_USER_SEARCH_BASE}" == "" ]
   then
     echo "SYNC_LDAP_USER_SEARCH_BASE must be specified when SYNC_SOURCE is ldap"
-    exit 5
+    exit 6
   fi
 
   if [ "${SYNC_LDAP_USER_SEARCH_SCOPE}" == "" ]
@@ -129,7 +124,7 @@ then
   if [ "${SYNC_LDAP_USER_SEARCH_SCOPE}" != "base" ] && [ "${SYNC_LDAP_USER_SEARCH_SCOPE}"
!= "one" ] && [ "${SYNC_LDAP_USER_SEARCH_SCOPE}" != "sub" ]
   then
     echo "Unsupported value for SYNC_LDAP_USER_SEARCH_SCOPE: ${SYNC_LDAP_USER_SEARCH_SCOPE},
supported values: base, one, sub"
-    exit 6
+    exit 7
   fi
 
   if [ "${SYNC_LDAP_USER_OBJECT_CLASS}" == "" ]
@@ -147,19 +142,58 @@ then
     SYNC_LDAP_USER_NAME_ATTRIBUTE="memberof,ismemberof"
   fi
 
-#ldap credential keystore creation  
-	echo "Starting configuration for LDAP credentials:"		
-   	if [[ "${SYNC_LDAP_BIND_ALIAS}" != ""  && "${SYNC_LDAP_BIND_KEYSTOREPATH}" !=
"" ]]
-   	then
-		mkdir -p `dirname "${SYNC_LDAP_BIND_KEYSTOREPATH}"`
+  # Store ldap bind password in credential store
+  if [[ "${SYNC_LDAP_BIND_ALIAS}" != ""  && "${SYNC_LDAP_BIND_KEYSTOREPATH}" != ""
]]
+  then
+    echo "Storing ldap bind password in credential store"
+   	mkdir -p `dirname "${SYNC_LDAP_BIND_KEYSTOREPATH}"`
 		java -cp "./lib/*" com.hortonworks.credentialapi.buildks create $SYNC_LDAP_BIND_ALIAS -value
$SYNC_LDAP_BIND_PASSWORD -provider jceks://file$SYNC_LDAP_BIND_KEYSTOREPATH
-    	SYNC_LDAP_BIND_PASSWORD="_"
+    SYNC_LDAP_BIND_PASSWORD="_"
+  fi
+
+fi
+# END Grep configuration properties from install.properties
+
+
+# Back up previously installed service folder and copy new service folder
+if [ "${cdir}" = "." ]
+then
+  cdir=`pwd`
+fi
+
+cdirname=`basename ${cdir}`
+
+if [ "${cdirname}" != "" ]
+then
+
+  dstdir=${INSTALL_BASE}/${cdirname}
+
+  if [ -d ${dstdir} ]
+  then
+    ctime=`date '+%s'`
+    archive_dir=${dstdir}-${ctime}
+    mkdir -p ${archive_dir}
+    mv ${dstdir} ${archive_dir}    
+  fi
+
+  mkdir ${dstdir}
+  
+  if [ -L ${INSTALL_DIR} ]
+    then
+        rm -f ${INSTALL_DIR}
     fi
-#
+
+  ln -s  ${dstdir} ${INSTALL_DIR}
+
+  (cd ${cdir} ; find . -print | cpio -pdm ${dstdir}) 
+  (cd ${cdir} ; cat start.sh | sed -e "s|[ \t]*JAVA_HOME=| JAVA_HOME=${JAVA_HOME}|" >
${dstdir}/start.sh)
+
 fi
+# END Back up previously installed service folder and copy new service folder
 
+# Create $INSTALL_DIR/conf/unixauthservice.properties
 CFG_FILE="${cdir}/conf/unixauthservice.properties"
-NEW_CFG_FILE=${CFG_FILE}_`date '+%s'`
+NEW_CFG_FILE=${dstdir}/conf/unixauthservice.properties
 
 if [ -f  ${CFG_FILE}  ]
 then
@@ -176,94 +210,52 @@ then
     -e "s|^\( *ldapGroupSync.userSearchBase *=\).*|\1 ${SYNC_LDAP_USER_SEARCH_BASE}|" \
     -e "s|^\( *ldapGroupSync.userSearchScope *=\).*|\1 ${SYNC_LDAP_USER_SEARCH_SCOPE}|" \
     -e "s|^\( *ldapGroupSync.userObjectClass *=\).*|\1 ${SYNC_LDAP_USER_OBJECT_CLASS}|" \
-    -e "s|^\( *ldapGroupSync.userSearchFilter *=\).*-|1 ${SYNC_LDAP_USER_SEARCH_FILTER}|"
\
+    -e "s%^\( *ldapGroupSync.userSearchFilter *=\).*%\1 ${SYNC_LDAP_USER_SEARCH_FILTER}%"
\
     -e "s|^\( *ldapGroupSync.userNameAttribute *=\).*|\1 ${SYNC_LDAP_USER_NAME_ATTRIBUTE}|"
\
     -e "s|^\( *ldapGroupSync.userGroupNameAttribute *=\).*|\1 ${SYNC_LDAP_USER_GROUP_NAME_ATTRIBUTE}|"
\
     -e "s|^\( *ldapGroupSync.username.caseConversion *=\).*|\1 ${SYNC_LDAP_USERNAME_CASE_CONVERSION}|"
\
     -e "s|^\( *ldapGroupSync.groupname.caseConversion *=\).*|\1 ${SYNC_LDAP_GROUPNAME_CASE_CONVERSION}|"
\
     ${CFG_FILE} > ${NEW_CFG_FILE}
-	mv ${CFG_FILE}  ${CFG_FILE}_archive_`date '+%s'`
-	mv ${NEW_CFG_FILE}  ${CFG_FILE}
-fi
-
-#
-# get current directory name
-#
-
-if [ "${cdir}" = "." ]
-then
-	cdir=`pwd`
-fi
-
-cdirname=`basename ${cdir}`
-
-if [ "${cdirname}" != "" ]
-then
-
-	dstdir=${INSTALL_BASE}/${cdirname}
-
-	if [ -d ${dstdir} ]
-	then
-		ctime=`date '+%s'`
-        archive_dir=${dstdir}-${ctime}
-        mkdir -p ${archive_dir}
-        mv ${dstdir} ${archive_dir}		
-	fi
-
-	mkdir ${dstdir}
-	
-	if [ -L ${INSTALL_DIR} ]
-    then
-        rm -f ${INSTALL_DIR}
-    fi
-
-	ln -s  ${dstdir} ${INSTALL_DIR}
-
-	(cd ${cdir} ; find . -print | cpio -pdm ${dstdir}) 
-	(cd ${cdir} ; cat start.sh | sed -e "s|[ \t]*JAVA_HOME=| JAVA_HOME=${JAVA_HOME}|" > ${dstdir}/start.sh)
-
+else
+  echo "ERROR: Required file, not found: ${CFG_FILE}, Aborting installation"
+  exit 8
 fi
+#END Create $INSTALL_DIR/conf/unixauthservice.properties
 
-#
 # Install the init.d process in /etc/init.d and create appropriate link to /etc/rc2.d folder
-#
-
 if [ -d /etc/init.d ]
 then
-	cp ${cdir}/initd  /etc/init.d/${MOD_NAME}
-	chmod +x /etc/init.d/${MOD_NAME}
-	
-	if [ -d /etc/rc2.d ] 
-	then
-		echo "Creating boot script S99${MOD_NAME} in rc2.d directory .... "
-		ln -sf /etc/init.d/${MOD_NAME}  /etc/rc2.d/S99${MOD_NAME}
-		ln -sf /etc/init.d/${MOD_NAME}  /etc/rc2.d/K00${MOD_NAME}
-	fi
-	if [ -d /etc/rc3.d ]
-	then
-		echo "Creating boot script S99${MOD_NAME} in rc3.d directory .... "
-		ln -sf /etc/init.d/${MOD_NAME}  /etc/rc3.d/S99${MOD_NAME}
-		ln -sf /etc/init.d/${MOD_NAME}  /etc/rc3.d/K00${MOD_NAME}
-	fi
+  cp ${cdir}/initd  /etc/init.d/${MOD_NAME}
+  chmod +x /etc/init.d/${MOD_NAME}
+  
+  if [ -d /etc/rc2.d ] 
+  then
+    echo "Creating boot script S99${MOD_NAME} in rc2.d directory .... "
+    ln -sf /etc/init.d/${MOD_NAME}  /etc/rc2.d/S99${MOD_NAME}
+    ln -sf /etc/init.d/${MOD_NAME}  /etc/rc2.d/K00${MOD_NAME}
+  fi
+  if [ -d /etc/rc3.d ]
+  then
+    echo "Creating boot script S99${MOD_NAME} in rc3.d directory .... "
+    ln -sf /etc/init.d/${MOD_NAME}  /etc/rc3.d/S99${MOD_NAME}
+    ln -sf /etc/init.d/${MOD_NAME}  /etc/rc3.d/K00${MOD_NAME}
+  fi
 
   # SUSE has rc2.d and rc3.d under /etc/rc.d
-	if [ -d /etc/rc.d/rc2.d ] 
-	then
-		echo "Creating boot script S99${MOD_NAME} in rc2.d directory .... "
-		ln -sf /etc/init.d/${MOD_NAME}  /etc/rc.d/rc2.d/S99${MOD_NAME}
-		ln -sf /etc/init.d/${MOD_NAME}  /etc/rc.d/rc2.d/K00${MOD_NAME}
-	fi
-	if [ -d /etc/rc.d/rc3.d ]
-	then
-		echo "Creating boot script S99${MOD_NAME} in rc3.d directory .... "
-		ln -sf /etc/init.d/${MOD_NAME}  /etc/rc.d/rc3.d/S99${MOD_NAME}
-		ln -sf /etc/init.d/${MOD_NAME}  /etc/rc.d/rc3.d/K00${MOD_NAME}
-	fi
+  if [ -d /etc/rc.d/rc2.d ] 
+  then
+    echo "Creating boot script S99${MOD_NAME} in rc2.d directory .... "
+    ln -sf /etc/init.d/${MOD_NAME}  /etc/rc.d/rc2.d/S99${MOD_NAME}
+    ln -sf /etc/init.d/${MOD_NAME}  /etc/rc.d/rc2.d/K00${MOD_NAME}
+  fi
+  if [ -d /etc/rc.d/rc3.d ]
+  then
+    echo "Creating boot script S99${MOD_NAME} in rc3.d directory .... "
+    ln -sf /etc/init.d/${MOD_NAME}  /etc/rc.d/rc3.d/S99${MOD_NAME}
+    ln -sf /etc/init.d/${MOD_NAME}  /etc/rc.d/rc3.d/K00${MOD_NAME}
+  fi
 
 fi
 
-#
 # Start the service
-#
-
 service ${MOD_NAME} start

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/b27ae69d/unixauthservice/scripts/start.sh
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/start.sh b/unixauthservice/scripts/start.sh
index 34bfcc8..4b03e91 100755
--- a/unixauthservice/scripts/start.sh
+++ b/unixauthservice/scripts/start.sh
@@ -1,5 +1,6 @@
 #!/bin/bash
 
+echo "Starting UnixAuthenticationService"
 export JAVA_HOME=
 export PATH=$JAVA_HOME/bin:$PATH
 


Mime
View raw message